File tree Expand file tree Collapse file tree
compiler/rustc_hir_analysis/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -135,9 +135,6 @@ fn build_generics<'tcx>(
135135 // }
136136 own_params. sort_by_key ( |key| key. kind . is_ty_or_const ( ) ) ;
137137
138- let param_def_id_to_index =
139- own_params. iter ( ) . map ( |param| ( param. def_id , param. index ) ) . collect ( ) ;
140-
141138 let ( parent_count, has_self) = if let Some ( def_id) = parent {
142139 let parent_generics = tcx. generics_of ( def_id) ;
143140 let parent_kind = tcx. def_kind ( def_id) ;
@@ -162,6 +159,9 @@ fn build_generics<'tcx>(
162159 }
163160 }
164161
162+ let param_def_id_to_index =
163+ own_params. iter ( ) . map ( |param| ( param. def_id , param. index ) ) . collect ( ) ;
164+
165165 ty:: Generics {
166166 parent,
167167 parent_count,
Original file line number Diff line number Diff line change 1+ #![ feature( fn_delegation) ]
2+ #![ allow( incomplete_features) ]
3+
4+ mod to_reuse {
5+ pub fn foo < T > ( ) -> T {
6+ unimplemented ! ( )
7+ }
8+ }
9+
10+ struct S < T > ( T ) ;
11+
12+ trait Trait {
13+ reuse to_reuse:: foo;
14+ }
15+
16+ impl Trait for S {
17+ //~^ ERROR: missing generics for struct `S`
18+ reuse Trait :: foo;
19+ }
20+
21+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0107]: missing generics for struct `S`
2+ --> $DIR/ice-issue-150673.rs:16:16
3+ |
4+ LL | impl Trait for S {
5+ | ^ expected 1 generic argument
6+ |
7+ note: struct defined here, with 1 generic parameter: `T`
8+ --> $DIR/ice-issue-150673.rs:10:8
9+ |
10+ LL | struct S<T>(T);
11+ | ^ -
12+ help: add missing generic argument
13+ |
14+ LL | impl Trait for S<T> {
15+ | +++
16+
17+ error: aborting due to 1 previous error
18+
19+ For more information about this error, try `rustc --explain E0107`.
You can’t perform that action at this time.
0 commit comments