File tree Expand file tree Collapse file tree 5 files changed +14
-0
lines changed
rustc_trait_selection/src/traits Expand file tree Collapse file tree 5 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -2337,6 +2337,14 @@ impl<'tcx> TyCtxt<'tcx> {
23372337 self . sess . opts . unstable_opts . trait_solver == rustc_session:: config:: TraitSolver :: Next
23382338 }
23392339
2340+ pub fn next_trait_solver_in_coherence ( self ) -> bool {
2341+ matches ! (
2342+ self . sess. opts. unstable_opts. trait_solver,
2343+ rustc_session:: config:: TraitSolver :: Next
2344+ | rustc_session:: config:: TraitSolver :: NextCoherence
2345+ )
2346+ }
2347+
23402348 pub fn lower_impl_trait_in_trait_to_assoc_ty ( self ) -> bool {
23412349 self . sess . opts . unstable_opts . lower_impl_trait_in_trait_to_assoc_ty
23422350 }
Original file line number Diff line number Diff line change @@ -610,6 +610,8 @@ pub enum TraitSolver {
610610 Chalk ,
611611 /// Experimental trait solver in `rustc_trait_selection::solve`
612612 Next ,
613+ /// Use the new trait solver during coherence
614+ NextCoherence ,
613615}
614616
615617pub enum Input {
Original file line number Diff line number Diff line change @@ -986,6 +986,7 @@ mod parse {
986986 Some ( "classic" ) => * slot = TraitSolver :: Classic ,
987987 Some ( "chalk" ) => * slot = TraitSolver :: Chalk ,
988988 Some ( "next" ) => * slot = TraitSolver :: Next ,
989+ Some ( "next-coherence" ) => * slot = TraitSolver :: NextCoherence ,
989990 // default trait solver is subject to change..
990991 Some ( "default" ) => * slot = TraitSolver :: Classic ,
991992 _ => return false ,
Original file line number Diff line number Diff line change @@ -182,6 +182,7 @@ fn overlap<'tcx>(
182182 . with_opaque_type_inference ( DefiningAnchor :: Bubble )
183183 . skip_leak_check ( skip_leak_check. is_yes ( ) )
184184 . intercrate ( true )
185+ . with_next_trait_solver ( tcx. next_trait_solver_in_coherence ( ) )
185186 . build ( ) ;
186187 let selcx = & mut SelectionContext :: new ( & infcx) ;
187188 if track_ambiguity_causes. is_yes ( ) {
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ impl<'tcx> TraitEngineExt<'tcx> for dyn TraitEngine<'tcx> {
3535 fn new ( tcx : TyCtxt < ' tcx > ) -> Box < Self > {
3636 match tcx. sess . opts . unstable_opts . trait_solver {
3737 TraitSolver :: Classic => Box :: new ( FulfillmentContext :: new ( ) ) ,
38+ TraitSolver :: NextCoherence => Box :: new ( FulfillmentContext :: new ( ) ) ,
3839 TraitSolver :: Chalk => Box :: new ( ChalkFulfillmentContext :: new ( ) ) ,
3940 TraitSolver :: Next => Box :: new ( NextFulfillmentCtxt :: new ( ) ) ,
4041 }
@@ -43,6 +44,7 @@ impl<'tcx> TraitEngineExt<'tcx> for dyn TraitEngine<'tcx> {
4344 fn new_in_snapshot ( tcx : TyCtxt < ' tcx > ) -> Box < Self > {
4445 match tcx. sess . opts . unstable_opts . trait_solver {
4546 TraitSolver :: Classic => Box :: new ( FulfillmentContext :: new_in_snapshot ( ) ) ,
47+ TraitSolver :: NextCoherence => Box :: new ( FulfillmentContext :: new_in_snapshot ( ) ) ,
4648 TraitSolver :: Chalk => Box :: new ( ChalkFulfillmentContext :: new_in_snapshot ( ) ) ,
4749 TraitSolver :: Next => Box :: new ( NextFulfillmentCtxt :: new ( ) ) ,
4850 }
You can’t perform that action at this time.
0 commit comments