@@ -37,13 +37,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
37
37
candidate : SelectionCandidate < ' tcx > ,
38
38
) -> Result < Selection < ' tcx > , SelectionError < ' tcx > > {
39
39
Ok ( match candidate {
40
- SizedCandidate { has_nested } => {
41
- let data = self . confirm_builtin_candidate ( obligation, has_nested ) ;
40
+ SizedCandidate => {
41
+ let data = self . confirm_builtin_candidate ( obligation) ;
42
42
ImplSource :: Builtin ( BuiltinImplSource :: Misc , data)
43
43
}
44
44
45
- BuiltinCandidate { has_nested } => {
46
- let data = self . confirm_builtin_candidate ( obligation, has_nested ) ;
45
+ BuiltinCandidate => {
46
+ let data = self . confirm_builtin_candidate ( obligation) ;
47
47
ImplSource :: Builtin ( BuiltinImplSource :: Misc , data)
48
48
}
49
49
@@ -249,50 +249,47 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
249
249
}
250
250
}
251
251
252
+ #[ instrument( level = "debug" , skip( self ) , ret) ]
252
253
fn confirm_builtin_candidate (
253
254
& mut self ,
254
255
obligation : & PolyTraitObligation < ' tcx > ,
255
- has_nested : bool ,
256
256
) -> PredicateObligations < ' tcx > {
257
- debug ! ( ?obligation, ?has_nested, "confirm_builtin_candidate" ) ;
258
-
257
+ debug ! ( ?obligation, "confirm_builtin_candidate" ) ;
259
258
let tcx = self . tcx ( ) ;
260
- let obligations = if has_nested {
261
- let trait_def = obligation. predicate . def_id ( ) ;
262
- let conditions = match tcx. as_lang_item ( trait_def) {
263
- Some ( LangItem :: Sized ) => {
264
- self . sizedness_conditions ( obligation, SizedTraitKind :: Sized )
265
- }
266
- Some ( LangItem :: MetaSized ) => {
267
- self . sizedness_conditions ( obligation, SizedTraitKind :: MetaSized )
268
- }
269
- Some ( LangItem :: PointeeSized ) => {
270
- bug ! ( "`PointeeSized` is removing during lowering" ) ;
271
- }
272
- Some ( LangItem :: Copy | LangItem :: Clone ) => self . copy_clone_conditions ( obligation) ,
273
- Some ( LangItem :: FusedIterator ) => self . fused_iterator_conditions ( obligation) ,
274
- other => bug ! ( "unexpected builtin trait {trait_def:?} ({other:?})" ) ,
275
- } ;
276
- let BuiltinImplConditions :: Where ( types) = conditions else {
277
- bug ! ( "obligation {:?} had matched a builtin impl but now doesn't" , obligation) ;
278
- } ;
279
- let types = self . infcx . enter_forall_and_leak_universe ( types) ;
280
-
281
- let cause = obligation. derived_cause ( ObligationCauseCode :: BuiltinDerived ) ;
282
- self . collect_predicates_for_types (
283
- obligation. param_env ,
284
- cause,
285
- obligation. recursion_depth + 1 ,
286
- trait_def,
287
- types,
288
- )
289
- } else {
290
- PredicateObligations :: new ( )
259
+ let trait_def = obligation. predicate . def_id ( ) ;
260
+ let conditions = match tcx. as_lang_item ( trait_def) {
261
+ Some ( LangItem :: Sized ) => self . sizedness_conditions ( obligation, SizedTraitKind :: Sized ) ,
262
+ Some ( LangItem :: MetaSized ) => {
263
+ self . sizedness_conditions ( obligation, SizedTraitKind :: MetaSized )
264
+ }
265
+ Some ( LangItem :: PointeeSized ) => {
266
+ bug ! ( "`PointeeSized` is removing during lowering" ) ;
267
+ }
268
+ Some ( LangItem :: Copy | LangItem :: Clone ) => self . copy_clone_conditions ( obligation) ,
269
+ Some ( LangItem :: FusedIterator ) => self . fused_iterator_conditions ( obligation) ,
270
+ Some (
271
+ LangItem :: Destruct
272
+ | LangItem :: DiscriminantKind
273
+ | LangItem :: FnPtrTrait
274
+ | LangItem :: PointeeTrait
275
+ | LangItem :: Tuple
276
+ | LangItem :: Unpin ,
277
+ ) => BuiltinImplConditions :: Where ( ty:: Binder :: dummy ( vec ! [ ] ) ) ,
278
+ other => bug ! ( "unexpected builtin trait {trait_def:?} ({other:?})" ) ,
291
279
} ;
280
+ let BuiltinImplConditions :: Where ( types) = conditions else {
281
+ bug ! ( "obligation {:?} had matched a builtin impl but now doesn't" , obligation) ;
282
+ } ;
283
+ let types = self . infcx . enter_forall_and_leak_universe ( types) ;
292
284
293
- debug ! ( ?obligations) ;
294
-
295
- obligations
285
+ let cause = obligation. derived_cause ( ObligationCauseCode :: BuiltinDerived ) ;
286
+ self . collect_predicates_for_types (
287
+ obligation. param_env ,
288
+ cause,
289
+ obligation. recursion_depth + 1 ,
290
+ trait_def,
291
+ types,
292
+ )
296
293
}
297
294
298
295
#[ instrument( level = "debug" , skip( self ) ) ]
0 commit comments