2020-03-29 14:41:09 +00:00
|
|
|
use rustc_middle::ty::TyCtxt;
|
2018-03-11 02:29:22 +00:00
|
|
|
|
2020-02-22 10:44:18 +00:00
|
|
|
use super::TraitEngine;
|
2020-03-03 16:25:03 +00:00
|
|
|
use super::{ChalkFulfillmentContext, FulfillmentContext};
|
2018-03-11 02:29:22 +00:00
|
|
|
|
2018-06-27 20:04:32 +00:00
|
|
|
pub trait TraitEngineExt<'tcx> {
|
2020-02-22 10:44:18 +00:00
|
|
|
fn new(tcx: TyCtxt<'tcx>) -> Box<Self>;
|
2018-03-11 02:29:22 +00:00
|
|
|
}
|
2018-06-27 20:04:32 +00:00
|
|
|
|
2020-02-22 10:44:18 +00:00
|
|
|
impl<'tcx> TraitEngineExt<'tcx> for dyn TraitEngine<'tcx> {
|
2020-03-03 16:25:03 +00:00
|
|
|
fn new(tcx: TyCtxt<'tcx>) -> Box<Self> {
|
2022-07-06 12:44:47 +00:00
|
|
|
if tcx.sess.opts.unstable_opts.chalk {
|
2020-03-03 16:25:03 +00:00
|
|
|
Box::new(ChalkFulfillmentContext::new())
|
|
|
|
} else {
|
|
|
|
Box::new(FulfillmentContext::new())
|
|
|
|
}
|
2018-06-27 20:04:32 +00:00
|
|
|
}
|
|
|
|
}
|