This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +4
-20
lines changed
compiler/rustc_hir_analysis/src/check Expand file tree Collapse file tree 3 files changed +4
-20
lines changed Original file line number Diff line number Diff line change @@ -1765,9 +1765,9 @@ fn check_variances_for_type_defn<'tcx>(
17651765 }
17661766
17671767 let ty_param = & ty_generics. params [ index] ;
1768- let mut hir_param = & hir_generics. params [ index] ;
1768+ let hir_param = & hir_generics. params [ index] ;
17691769
1770- if ty_param. name != hir_param. name . ident ( ) . name {
1770+ if ty_param. def_id != hir_param. def_id . into ( ) {
17711771 // valid programs always have lifetimes before types in the generic parameter list
17721772 // ty_generics are normalized to be in this required order, and variances are built
17731773 // 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>(
17771777 // got an error about it (or I'm wrong about this)
17781778 tcx. sess
17791779 . delay_span_bug ( hir_param. span , "hir generics and ty generics in different order" ) ;
1780- for hp in hir_generics. params {
1781- if hp. name . ident ( ) . name == ty_param. name {
1782- hir_param = hp;
1783- break ;
1784- }
1785- }
1780+ continue ;
17861781 }
17871782
17881783 match hir_param. name {
Original file line number Diff line number Diff line change 11struct Foo < T , ' a > ( & ' a ( ) ) ;
22//~^ ERROR lifetime parameters must be declared prior to
3- //~| ERROR parameter `T` is never used
43
54fn main ( ) { }
Original file line number Diff line number Diff line change @@ -4,15 +4,5 @@ error: lifetime parameters must be declared prior to type and const parameters
44LL | struct Foo<T, 'a>(&'a ());
55 | ----^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T>`
66
7- error[E0392]: parameter `T` is never used
8- --> $DIR/issue-83556.rs:1:12
9- |
10- LL | struct Foo<T, 'a>(&'a ());
11- | ^ unused parameter
12- |
13- = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
14- = help: if you intended `T` to be a const parameter, use `const T: usize` instead
15-
16- error: aborting due to 2 previous errors
7+ error: aborting due to previous error
178
18- For more information about this error, try `rustc --explain E0392`.
You can’t perform that action at this time.
0 commit comments