Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//! Regression test for https://github.com/rust-lang/rust/issues/143896.

trait TraitA<'a> {
const K: usize = 0;
}

impl<T> TraitA<'_> for () {}
//~^ ERROR the type parameter `T` is not constrained

impl dyn TraitA<'_> where (): TraitA<'a, K = 0> {}
//~^ ERROR use of undeclared lifetime name `'a`
//~| ERROR associated const equality is incomplete

pub fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/assoc-const-equality-unexpected-region.rs:10:38
|
LL | impl dyn TraitA<'_> where (): TraitA<'a, K = 0> {}
| ^^ undeclared lifetime
|
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
help: consider making the bound lifetime-generic with a new `'a` lifetime
|
LL | impl dyn TraitA<'_> where (): for<'a> TraitA<'a, K = 0> {}
| +++++++
help: consider making the bound lifetime-generic with a new `'a` lifetime
|
LL | impl dyn TraitA<'_> where for<'a> (): TraitA<'a, K = 0> {}
| +++++++
help: consider introducing lifetime `'a` here
|
LL | impl<'a> dyn TraitA<'_> where (): TraitA<'a, K = 0> {}
| ++++

error[E0658]: associated const equality is incomplete
--> $DIR/assoc-const-equality-unexpected-region.rs:10:42
|
LL | impl dyn TraitA<'_> where (): TraitA<'a, K = 0> {}
| ^^^^^
|
= note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information
= help: add `#![feature(min_generic_const_args)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
--> $DIR/assoc-const-equality-unexpected-region.rs:7:6
|
LL | impl<T> TraitA<'_> for () {}
| ^ unconstrained type parameter

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0207, E0261, E0658.
For more information about an error, try `rustc --explain E0207`.
Loading