diagnostics: simpler 83556 handling by bailing out
This commit is contained in:
parent
3799af3337
commit
58ef3a0ec9
3 changed files with 4 additions and 20 deletions
|
@ -1765,9 +1765,9 @@ fn check_variances_for_type_defn<'tcx>(
|
||||||
}
|
}
|
||||||
|
|
||||||
let ty_param = &ty_generics.params[index];
|
let ty_param = &ty_generics.params[index];
|
||||||
let mut hir_param = &hir_generics.params[index];
|
let hir_param = &hir_generics.params[index];
|
||||||
|
|
||||||
if ty_param.name != hir_param.name.ident().name {
|
if ty_param.def_id != hir_param.def_id.into() {
|
||||||
// valid programs always have lifetimes before types in the generic parameter list
|
// valid programs always have lifetimes before types in the generic parameter list
|
||||||
// ty_generics are normalized to be in this required order, and variances are built
|
// ty_generics are normalized to be in this required order, and variances are built
|
||||||
// from ty generics, not from hir generics. but we need hir generics to get
|
// from ty generics, not from hir generics. but we need hir generics to get
|
||||||
|
@ -1777,12 +1777,7 @@ fn check_variances_for_type_defn<'tcx>(
|
||||||
// got an error about it (or I'm wrong about this)
|
// got an error about it (or I'm wrong about this)
|
||||||
tcx.sess
|
tcx.sess
|
||||||
.delay_span_bug(hir_param.span, "hir generics and ty generics in different order");
|
.delay_span_bug(hir_param.span, "hir generics and ty generics in different order");
|
||||||
for hp in hir_generics.params {
|
continue;
|
||||||
if hp.name.ident().name == ty_param.name {
|
|
||||||
hir_param = hp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
match hir_param.name {
|
match hir_param.name {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
struct Foo<T, 'a>(&'a ());
|
struct Foo<T, 'a>(&'a ());
|
||||||
//~^ ERROR lifetime parameters must be declared prior to
|
//~^ ERROR lifetime parameters must be declared prior to
|
||||||
//~| ERROR parameter `T` is never used
|
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -4,15 +4,5 @@ error: lifetime parameters must be declared prior to type and const parameters
|
||||||
LL | struct Foo<T, 'a>(&'a ());
|
LL | struct Foo<T, 'a>(&'a ());
|
||||||
| ----^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T>`
|
| ----^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T>`
|
||||||
|
|
||||||
error[E0392]: parameter `T` is never used
|
error: aborting due to previous error
|
||||||
--> $DIR/issue-83556.rs:1:12
|
|
||||||
|
|
|
||||||
LL | struct Foo<T, 'a>(&'a ());
|
|
||||||
| ^ unused parameter
|
|
||||||
|
|
|
||||||
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
|
|
||||||
= help: if you intended `T` to be a const parameter, use `const T: usize` instead
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0392`.
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue