@@ -337,6 +337,11 @@ where
337337 goal : Goal < I , Self > ,
338338 ) -> Result < Candidate < I > , NoSolution > ;
339339
340+ fn consider_builtin_try_as_dyn_candidate (
341+ ecx : & mut EvalCtxt < ' _ , D > ,
342+ goal : Goal < I , Self > ,
343+ ) -> Result < Candidate < I > , NoSolution > ;
344+
340345 /// Consider (possibly several) candidates to upcast or unsize a type to another
341346 /// type, excluding the coercion of a sized type into a `dyn Trait`.
342347 ///
@@ -530,6 +535,10 @@ where
530535 let cx = self . cx ( ) ;
531536 let trait_def_id = goal. predicate . trait_def_id ( cx) ;
532537
538+ if let TypingMode :: Reflection = self . typing_mode ( ) {
539+ return ;
540+ }
541+
533542 // N.B. When assembling built-in candidates for lang items that are also
534543 // `auto` traits, then the auto trait candidate that is assembled in
535544 // `consider_auto_trait_candidate` MUST be disqualified to remain sound.
@@ -622,6 +631,9 @@ where
622631 Some ( SolverTraitLangItem :: BikeshedGuaranteedNoDrop ) => {
623632 G :: consider_builtin_bikeshed_guaranteed_no_drop_candidate ( self , goal)
624633 }
634+ Some ( SolverTraitLangItem :: TryAsDyn ) => {
635+ G :: consider_builtin_try_as_dyn_candidate ( self , goal)
636+ }
625637 Some ( SolverTraitLangItem :: Field ) => G :: consider_builtin_field_candidate ( self , goal) ,
626638 _ => Err ( NoSolution ) ,
627639 }
@@ -804,6 +816,10 @@ where
804816 return ;
805817 }
806818
819+ if let TypingMode :: Reflection = self . typing_mode ( ) {
820+ return ;
821+ }
822+
807823 let self_ty = goal. predicate . self_ty ( ) ;
808824 let bounds = match self_ty. kind ( ) {
809825 ty:: Bool
0 commit comments