@@ -118,8 +118,10 @@ impl<'tcx> OpaqueTypeCollector<'tcx> {
118
118
return ;
119
119
}
120
120
121
+ let tcx = self . tcx ;
122
+
121
123
// TAITs outside their defining scopes are ignored.
122
- let origin = self . tcx . opaque_type_origin ( alias_ty. def_id . expect_local ( ) ) ;
124
+ let origin = tcx. opaque_type_origin ( alias_ty. def_id . expect_local ( ) ) ;
123
125
trace ! ( ?origin) ;
124
126
match origin {
125
127
rustc_hir:: OpaqueTyOrigin :: FnReturn ( _) | rustc_hir:: OpaqueTyOrigin :: AsyncFn ( _) => { }
@@ -134,12 +136,11 @@ impl<'tcx> OpaqueTypeCollector<'tcx> {
134
136
135
137
self . opaques . push ( alias_ty. def_id . expect_local ( ) ) ;
136
138
137
- let parent_count = self . tcx . generics_of ( alias_ty. def_id ) . parent_count ;
139
+ let parent_count = tcx. generics_of ( alias_ty. def_id ) . parent_count ;
138
140
// Only check that the parent generics of the TAIT/RPIT are unique.
139
141
// the args owned by the opaque are going to always be duplicate
140
142
// lifetime params for RPITs, and empty for TAITs.
141
- match self
142
- . tcx
143
+ match tcx
143
144
. uses_unique_generic_params ( & alias_ty. args [ ..parent_count] , CheckRegions :: FromFunction )
144
145
{
145
146
Ok ( ( ) ) => {
@@ -150,27 +151,25 @@ impl<'tcx> OpaqueTypeCollector<'tcx> {
150
151
// Collect opaque types nested within the associated type bounds of this opaque type.
151
152
// We use identity args here, because we already know that the opaque type uses
152
153
// only generic parameters, and thus instantiating would not give us more information.
153
- for ( pred, span) in self
154
- . tcx
155
- . explicit_item_bounds ( alias_ty. def_id )
156
- . instantiate_identity_iter_copied ( )
154
+ for ( pred, span) in
155
+ tcx. explicit_item_bounds ( alias_ty. def_id ) . instantiate_identity_iter_copied ( )
157
156
{
158
157
trace ! ( ?pred) ;
159
158
self . visit ( span, pred) ;
160
159
}
161
160
}
162
161
Err ( NotUniqueParam :: NotParam ( arg) ) => {
163
- self . tcx . dcx ( ) . emit_err ( NotParam {
162
+ tcx. dcx ( ) . emit_err ( NotParam {
164
163
arg,
165
164
span : self . span ( ) ,
166
- opaque_span : self . tcx . def_span ( alias_ty. def_id ) ,
165
+ opaque_span : tcx. def_span ( alias_ty. def_id ) ,
167
166
} ) ;
168
167
}
169
168
Err ( NotUniqueParam :: DuplicateParam ( arg) ) => {
170
- self . tcx . dcx ( ) . emit_err ( DuplicateArg {
169
+ tcx. dcx ( ) . emit_err ( DuplicateArg {
171
170
arg,
172
171
span : self . span ( ) ,
173
- opaque_span : self . tcx . def_span ( alias_ty. def_id ) ,
172
+ opaque_span : tcx. def_span ( alias_ty. def_id ) ,
174
173
} ) ;
175
174
}
176
175
}
0 commit comments