@@ -279,23 +279,24 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
279279 ImplSourceBuiltinData { nested : obligations }
280280 }
281281
282- #[ instrument( skip( self ) ) ]
282+ #[ instrument( level = "debug" , skip( self ) ) ]
283283 fn confirm_transmutability_candidate (
284284 & mut self ,
285285 obligation : & TraitObligation < ' tcx > ,
286286 ) -> Result < ImplSourceBuiltinData < PredicateObligation < ' tcx > > , SelectionError < ' tcx > > {
287+ #[ instrument( level = "debug" , skip( tcx, obligation, predicate) ) ]
287288 fn flatten_answer_tree < ' tcx > (
288289 tcx : TyCtxt < ' tcx > ,
289290 obligation : & TraitObligation < ' tcx > ,
290291 predicate : TraitPredicate < ' tcx > ,
291292 answer : rustc_transmute:: Answer < rustc_transmute:: layout:: rustc:: Ref < ' tcx > > ,
292293 ) -> Result < Vec < PredicateObligation < ' tcx > > , SelectionError < ' tcx > > {
293294 match answer {
294- rustc_transmute :: Answer :: Yes => Ok ( vec ! [ ] ) ,
295- rustc_transmute :: Answer :: No ( _) => Err ( Unimplemented ) ,
295+ Ok ( None ) => Ok ( vec ! [ ] ) ,
296+ Err ( _) => Err ( Unimplemented ) ,
296297 // FIXME(bryangarza): Add separate `IfAny` case, instead of treating as `IfAll`
297- rustc_transmute:: Answer :: IfAll ( answers)
298- | rustc_transmute:: Answer :: IfAny ( answers) => {
298+ Ok ( Some ( rustc_transmute:: Condition :: IfAll ( answers) ) )
299+ | Ok ( Some ( rustc_transmute:: Condition :: IfAny ( answers) ) ) => {
299300 let mut nested = vec ! [ ] ;
300301 for flattened in answers
301302 . into_iter ( )
@@ -305,7 +306,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
305306 }
306307 Ok ( nested)
307308 }
308- rustc_transmute:: Answer :: IfTransmutable { src, dst } => {
309+ Ok ( Some ( rustc_transmute:: Condition :: IfTransmutable { src, dst } ) ) => {
309310 let trait_def_id = obligation. predicate . def_id ( ) ;
310311 let scope = predicate. trait_ref . substs . type_at ( 2 ) ;
311312 let assume_const = predicate. trait_ref . substs . const_at ( 3 ) ;
@@ -334,8 +335,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
334335 }
335336 }
336337
337- debug ! ( ?obligation, "confirm_transmutability_candidate" ) ;
338-
339338 // We erase regions here because transmutability calls layout queries,
340339 // which does not handle inference regions and doesn't particularly
341340 // care about other regions. Erasing late-bound regions is equivalent
@@ -352,21 +351,21 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
352351 return Err ( Unimplemented ) ;
353352 } ;
354353
354+ let dst = predicate. trait_ref . substs . type_at ( 0 ) ;
355+ let src = predicate. trait_ref . substs . type_at ( 1 ) ;
355356 let mut transmute_env = rustc_transmute:: TransmuteTypeEnv :: new ( self . infcx ) ;
356357 let maybe_transmutable = transmute_env. is_transmutable (
357358 obligation. cause . clone ( ) ,
358- rustc_transmute:: Types {
359- dst : predicate. trait_ref . substs . type_at ( 0 ) ,
360- src : predicate. trait_ref . substs . type_at ( 1 ) ,
361- } ,
359+ rustc_transmute:: Types { dst, src } ,
362360 predicate. trait_ref . substs . type_at ( 2 ) ,
363361 assume,
364362 ) ;
365363
366- info ! ( ?maybe_transmutable) ;
367- let nested = flatten_answer_tree ( self . tcx ( ) , obligation, predicate, maybe_transmutable) ?;
368- info ! ( ?nested) ;
369- Ok ( ImplSourceBuiltinData { nested } )
364+ debug ! ( ?src, ?dst) ;
365+ let fully_flattened =
366+ flatten_answer_tree ( self . tcx ( ) , obligation, predicate, maybe_transmutable) ?;
367+ debug ! ( ?fully_flattened) ;
368+ Ok ( ImplSourceBuiltinData { nested : fully_flattened } )
370369 }
371370
372371 /// This handles the case where an `auto trait Foo` impl is being used.
0 commit comments