]> git.proxmox.com Git - rustc.git/blob - src/librustc_trait_selection/traits/engine.rs
New upstream version 1.47.0+dfsg1
[rustc.git] / src / librustc_trait_selection / 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 }