File tree 5 files changed +14
-0
lines changed
rustc_trait_selection/src/traits
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> {
2337
2337
self . sess . opts . unstable_opts . trait_solver == rustc_session:: config:: TraitSolver :: Next
2338
2338
}
2339
2339
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
+
2340
2348
pub fn lower_impl_trait_in_trait_to_assoc_ty ( self ) -> bool {
2341
2349
self . sess . opts . unstable_opts . lower_impl_trait_in_trait_to_assoc_ty
2342
2350
}
Original file line number Diff line number Diff line change @@ -610,6 +610,8 @@ pub enum TraitSolver {
610
610
Chalk ,
611
611
/// Experimental trait solver in `rustc_trait_selection::solve`
612
612
Next ,
613
+ /// Use the new trait solver during coherence
614
+ NextCoherence ,
613
615
}
614
616
615
617
pub enum Input {
Original file line number Diff line number Diff line change @@ -986,6 +986,7 @@ mod parse {
986
986
Some ( "classic" ) => * slot = TraitSolver :: Classic ,
987
987
Some ( "chalk" ) => * slot = TraitSolver :: Chalk ,
988
988
Some ( "next" ) => * slot = TraitSolver :: Next ,
989
+ Some ( "next-coherence" ) => * slot = TraitSolver :: NextCoherence ,
989
990
// default trait solver is subject to change..
990
991
Some ( "default" ) => * slot = TraitSolver :: Classic ,
991
992
_ => return false ,
Original file line number Diff line number Diff line change @@ -182,6 +182,7 @@ fn overlap<'tcx>(
182
182
. with_opaque_type_inference ( DefiningAnchor :: Bubble )
183
183
. skip_leak_check ( skip_leak_check. is_yes ( ) )
184
184
. intercrate ( true )
185
+ . with_next_trait_solver ( tcx. next_trait_solver_in_coherence ( ) )
185
186
. build ( ) ;
186
187
let selcx = & mut SelectionContext :: new ( & infcx) ;
187
188
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> {
35
35
fn new ( tcx : TyCtxt < ' tcx > ) -> Box < Self > {
36
36
match tcx. sess . opts . unstable_opts . trait_solver {
37
37
TraitSolver :: Classic => Box :: new ( FulfillmentContext :: new ( ) ) ,
38
+ TraitSolver :: NextCoherence => Box :: new ( FulfillmentContext :: new ( ) ) ,
38
39
TraitSolver :: Chalk => Box :: new ( ChalkFulfillmentContext :: new ( ) ) ,
39
40
TraitSolver :: Next => Box :: new ( NextFulfillmentCtxt :: new ( ) ) ,
40
41
}
@@ -43,6 +44,7 @@ impl<'tcx> TraitEngineExt<'tcx> for dyn TraitEngine<'tcx> {
43
44
fn new_in_snapshot ( tcx : TyCtxt < ' tcx > ) -> Box < Self > {
44
45
match tcx. sess . opts . unstable_opts . trait_solver {
45
46
TraitSolver :: Classic => Box :: new ( FulfillmentContext :: new_in_snapshot ( ) ) ,
47
+ TraitSolver :: NextCoherence => Box :: new ( FulfillmentContext :: new_in_snapshot ( ) ) ,
46
48
TraitSolver :: Chalk => Box :: new ( ChalkFulfillmentContext :: new_in_snapshot ( ) ) ,
47
49
TraitSolver :: Next => Box :: new ( NextFulfillmentCtxt :: new ( ) ) ,
48
50
}
You can’t perform that action at this time.
0 commit comments