rust/compiler/rustc_trait_selection/src/traits/engine.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
483 B
Rust
Raw Normal View History

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
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
}
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> {
if tcx.sess.opts.debugging_opts.chalk {
Box::new(ChalkFulfillmentContext::new())
} else {
Box::new(FulfillmentContext::new())
}
}
}