]> git.proxmox.com Git - rustc.git/blob - compiler/rustc_trait_selection/src/traits/engine.rs
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / compiler / rustc_trait_selection / src / traits / engine.rs
1 use rustc_middle::ty::TyCtxt;
2
3 use super::TraitEngine;
4 use super::{ChalkFulfillmentContext, FulfillmentContext};
5
6 pub trait TraitEngineExt<'tcx> {
7 fn new(tcx: TyCtxt<'tcx>) -> Box<Self>;
8 }
9
10 impl<'tcx> TraitEngineExt<'tcx> for dyn TraitEngine<'tcx> {
11 fn new(tcx: TyCtxt<'tcx>) -> Box<Self> {
12 if tcx.sess.opts.debugging_opts.chalk {
13 Box::new(ChalkFulfillmentContext::new())
14 } else {
15 Box::new(FulfillmentContext::new())
16 }
17 }
18 }