File tree 3 files changed +4
-20
lines changed
compiler/rustc_hir_analysis/src/check
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>(
1765
1765
}
1766
1766
1767
1767
let ty_param = & ty_generics. params [ index] ;
1768
- let mut hir_param = & hir_generics. params [ index] ;
1768
+ let hir_param = & hir_generics. params [ index] ;
1769
1769
1770
- if ty_param. name != hir_param. name . ident ( ) . name {
1770
+ if ty_param. def_id != hir_param. def_id . into ( ) {
1771
1771
// valid programs always have lifetimes before types in the generic parameter list
1772
1772
// ty_generics are normalized to be in this required order, and variances are built
1773
1773
// 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>(
1777
1777
// got an error about it (or I'm wrong about this)
1778
1778
tcx. sess
1779
1779
. 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 ;
1786
1781
}
1787
1782
1788
1783
match hir_param. name {
Original file line number Diff line number Diff line change 1
1
struct Foo < T , ' a > ( & ' a ( ) ) ;
2
2
//~^ ERROR lifetime parameters must be declared prior to
3
- //~| ERROR parameter `T` is never used
4
3
5
4
fn 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
4
4
LL | struct Foo<T, 'a>(&'a ());
5
5
| ----^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T>`
6
6
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
17
8
18
- For more information about this error, try `rustc --explain E0392`.
You can’t perform that action at this time.
0 commit comments