@@ -118,8 +118,10 @@ impl<'tcx> OpaqueTypeCollector<'tcx> {
118118 return ;
119119 }
120120
121+ let tcx = self . tcx ;
122+
121123 // 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 ( ) ) ;
123125 trace ! ( ?origin) ;
124126 match origin {
125127 rustc_hir:: OpaqueTyOrigin :: FnReturn ( _) | rustc_hir:: OpaqueTyOrigin :: AsyncFn ( _) => { }
@@ -134,12 +136,11 @@ impl<'tcx> OpaqueTypeCollector<'tcx> {
134136
135137 self . opaques . push ( alias_ty. def_id . expect_local ( ) ) ;
136138
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 ;
138140 // Only check that the parent generics of the TAIT/RPIT are unique.
139141 // the args owned by the opaque are going to always be duplicate
140142 // lifetime params for RPITs, and empty for TAITs.
141- match self
142- . tcx
143+ match tcx
143144 . uses_unique_generic_params ( & alias_ty. args [ ..parent_count] , CheckRegions :: FromFunction )
144145 {
145146 Ok ( ( ) ) => {
@@ -150,27 +151,25 @@ impl<'tcx> OpaqueTypeCollector<'tcx> {
150151 // Collect opaque types nested within the associated type bounds of this opaque type.
151152 // We use identity args here, because we already know that the opaque type uses
152153 // 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 ( )
157156 {
158157 trace ! ( ?pred) ;
159158 self . visit ( span, pred) ;
160159 }
161160 }
162161 Err ( NotUniqueParam :: NotParam ( arg) ) => {
163- self . tcx . dcx ( ) . emit_err ( NotParam {
162+ tcx. dcx ( ) . emit_err ( NotParam {
164163 arg,
165164 span : self . span ( ) ,
166- opaque_span : self . tcx . def_span ( alias_ty. def_id ) ,
165+ opaque_span : tcx. def_span ( alias_ty. def_id ) ,
167166 } ) ;
168167 }
169168 Err ( NotUniqueParam :: DuplicateParam ( arg) ) => {
170- self . tcx . dcx ( ) . emit_err ( DuplicateArg {
169+ tcx. dcx ( ) . emit_err ( DuplicateArg {
171170 arg,
172171 span : self . span ( ) ,
173- opaque_span : self . tcx . def_span ( alias_ty. def_id ) ,
172+ opaque_span : tcx. def_span ( alias_ty. def_id ) ,
174173 } ) ;
175174 }
176175 }
0 commit comments