Skip recording resolution for duplicated generic params.
This commit is contained in:
parent
cab4fd678c
commit
b1514108e2
@ -2360,8 +2360,8 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
|
||||
if let GenericParamKind::Lifetime = param.kind {
|
||||
// Record lifetime res, so lowering knows there is something fishy.
|
||||
self.record_lifetime_param(param.id, LifetimeRes::Error);
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
Entry::Vacant(entry) => {
|
||||
entry.insert(param.ident.span);
|
||||
|
4
src/test/ui/const-generics/defaults/self-referential.rs
Normal file
4
src/test/ui/const-generics/defaults/self-referential.rs
Normal file
@ -0,0 +1,4 @@
|
||||
trait Foo<const M: u8, const M: u8 = M> {}
|
||||
//~^ ERROR the name `M` is already used for a generic parameter in this item's generic parameters
|
||||
impl Foo<2> for () {}
|
||||
fn main() {}
|
11
src/test/ui/const-generics/defaults/self-referential.stderr
Normal file
11
src/test/ui/const-generics/defaults/self-referential.stderr
Normal file
@ -0,0 +1,11 @@
|
||||
error[E0403]: the name `M` is already used for a generic parameter in this item's generic parameters
|
||||
--> $DIR/self-referential.rs:1:30
|
||||
|
|
||||
LL | trait Foo<const M: u8, const M: u8 = M> {}
|
||||
| - ^ already used
|
||||
| |
|
||||
| first use of `M`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0403`.
|
@ -55,10 +55,10 @@ LL | impl<T,T> Qux<T,T> for Option<T> {}
|
||||
| first use of `T`
|
||||
|
||||
error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
|
||||
--> $DIR/duplicate-type-parameter.rs:24:6
|
||||
--> $DIR/duplicate-type-parameter.rs:24:8
|
||||
|
|
||||
LL | impl<T,T> Qux<T,T> for Option<T> {}
|
||||
| ^ unconstrained type parameter
|
||||
| ^ unconstrained type parameter
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user