diff options
Diffstat (limited to 'compiler/rustc_trait_selection/src')
6 files changed, 14 insertions, 12 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/auto_trait.rs b/compiler/rustc_trait_selection/src/traits/auto_trait.rs index 5763e6d1b55..294c81d0b21 100644 --- a/compiler/rustc_trait_selection/src/traits/auto_trait.rs +++ b/compiler/rustc_trait_selection/src/traits/auto_trait.rs @@ -205,7 +205,7 @@ impl<'tcx> AutoTraitFinder<'tcx> { // At this point, we already have all of the bounds we need. FulfillmentContext is used // to store all of the necessary region/lifetime bounds in the InferContext, as well as // an additional sanity check. - let mut fulfill = FulfillmentContext::new(); + let mut fulfill = <dyn TraitEngine<'tcx>>::new(tcx); fulfill.register_bound(&infcx, full_env, ty, trait_did, ObligationCause::dummy()); let errors = fulfill.select_all_or_error(&infcx); diff --git a/compiler/rustc_trait_selection/src/traits/codegen.rs b/compiler/rustc_trait_selection/src/traits/codegen.rs index 4b575ea660a..c0700748c79 100644 --- a/compiler/rustc_trait_selection/src/traits/codegen.rs +++ b/compiler/rustc_trait_selection/src/traits/codegen.rs @@ -5,7 +5,7 @@ use crate::infer::{DefiningAnchor, TyCtxtInferExt}; use crate::traits::{ - FulfillmentContext, ImplSource, Obligation, ObligationCause, SelectionContext, TraitEngine, + ImplSource, Obligation, ObligationCause, SelectionContext, TraitEngine, TraitEngineExt, Unimplemented, }; use rustc_middle::traits::CodegenObligationError; @@ -53,7 +53,7 @@ pub fn codegen_fulfill_obligation<'tcx>( // Currently, we use a fulfillment context to completely resolve // all nested obligations. This is because they can inform the // inference of the impl's type parameters. - let mut fulfill_cx = FulfillmentContext::new(); + let mut fulfill_cx = <dyn TraitEngine<'tcx>>::new(tcx); let impl_source = selection.map(|predicate| { fulfill_cx.register_predicate_obligation(&infcx, predicate); }); diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs index f62ccb99df5..1c8cdf4ca8f 100644 --- a/compiler/rustc_trait_selection/src/traits/coherence.rs +++ b/compiler/rustc_trait_selection/src/traits/coherence.rs @@ -11,7 +11,7 @@ use crate::traits::util::impl_subject_and_oblig; use crate::traits::SkipLeakCheck; use crate::traits::{ self, FulfillmentContext, Normalized, Obligation, ObligationCause, PredicateObligation, - PredicateObligations, SelectionContext, + PredicateObligations, SelectionContext, TraitEngineExt, }; use rustc_data_structures::fx::FxIndexSet; use rustc_errors::Diagnostic; @@ -385,7 +385,7 @@ fn resolve_negative_obligation<'cx, 'tcx>( return false; }; - let mut fulfillment_cx = FulfillmentContext::new(); + let mut fulfillment_cx = <dyn TraitEngine<'tcx>>::new(infcx.tcx); fulfillment_cx.register_predicate_obligation(infcx, o); let errors = fulfillment_cx.select_all_or_error(infcx); diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs index d0a17f712d3..9c6bb0731f4 100644 --- a/compiler/rustc_trait_selection/src/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/mod.rs @@ -164,7 +164,7 @@ pub fn type_known_to_meet_bound_modulo_regions<'a, 'tcx>( // The handling of regions in this area of the code is terrible, // see issue #29149. We should be able to improve on this with // NLL. - let mut fulfill_cx = FulfillmentContext::new(); + let mut fulfill_cx = <dyn TraitEngine<'tcx>>::new(infcx.tcx); // We can use a dummy node-id here because we won't pay any mind // to region obligations that arise (there shouldn't really be any diff --git a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs index 5f77aae6f22..28a1cb273a7 100644 --- a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs @@ -14,7 +14,9 @@ use specialization_graph::GraphExt; use crate::infer::{InferCtxt, InferOk, TyCtxtInferExt}; use crate::traits::select::IntercrateAmbiguityCause; -use crate::traits::{self, coherence, FutureCompatOverlapErrorKind, ObligationCause, TraitEngine}; +use crate::traits::{ + self, coherence, FutureCompatOverlapErrorKind, ObligationCause, TraitEngine, TraitEngineExt, +}; use rustc_data_structures::fx::{FxHashSet, FxIndexSet}; use rustc_errors::{struct_span_err, EmissionGuarantee, LintDiagnosticBuilder}; use rustc_hir::def_id::{DefId, LocalDefId}; @@ -24,8 +26,8 @@ use rustc_session::lint::builtin::COHERENCE_LEAK_CHECK; use rustc_session::lint::builtin::ORDER_DEPENDENT_TRAIT_OBJECTS; use rustc_span::{Span, DUMMY_SP}; -use super::util; -use super::{FulfillmentContext, SelectionContext}; +use super::SelectionContext; +use super::{util, FulfillmentContext}; /// Information pertinent to an overlapping impl error. #[derive(Debug)] @@ -207,7 +209,7 @@ fn fulfill_implication<'a, 'tcx>( // (which are packed up in penv) infcx.save_and_restore_in_snapshot_flag(|infcx| { - let mut fulfill_cx = FulfillmentContext::new(); + let mut fulfill_cx = <dyn TraitEngine<'tcx>>::new(infcx.tcx); for oblig in obligations.chain(more_obligations) { fulfill_cx.register_predicate_obligation(&infcx, oblig); } diff --git a/compiler/rustc_trait_selection/src/traits/structural_match.rs b/compiler/rustc_trait_selection/src/traits/structural_match.rs index c278752e3d9..5829a0f92ee 100644 --- a/compiler/rustc_trait_selection/src/traits/structural_match.rs +++ b/compiler/rustc_trait_selection/src/traits/structural_match.rs @@ -1,6 +1,6 @@ use crate::infer::{InferCtxt, TyCtxtInferExt}; use crate::traits::ObligationCause; -use crate::traits::{self, TraitEngine}; +use crate::traits::{TraitEngine, TraitEngineExt}; use rustc_data_structures::fx::FxHashSet; use rustc_hir as hir; @@ -72,7 +72,7 @@ fn type_marked_structural<'tcx>( adt_ty: Ty<'tcx>, cause: ObligationCause<'tcx>, ) -> bool { - let mut fulfillment_cx = traits::FulfillmentContext::new(); + let mut fulfillment_cx = <dyn TraitEngine<'tcx>>::new(infcx.tcx); // require `#[derive(PartialEq)]` let structural_peq_def_id = infcx.tcx.require_lang_item(LangItem::StructuralPeq, Some(cause.span)); |
