]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_trait_selection/src/traits/engine.rs
Merge commit 'ea199bacef07213dbe008841b89c450e3bf0c638' into rustfmt-sync
[rust.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 }