diff options
| author | Michael Goulet <michael@errs.io> | 2024-07-11 19:15:00 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-07-11 19:15:04 -0400 |
| commit | 2c8bbeebf1c630d06e44fa131d1cb0908b5ad56c (patch) | |
| tree | 3ccc0b554a4cad25b05e68804d70240fdcdb3234 /compiler/rustc_trait_selection/src/traits/specialize/mod.rs | |
| parent | 0c81f94b9a6207fb1fc080caa83584dea2d71fc6 (diff) | |
| download | rust-2c8bbeebf1c630d06e44fa131d1cb0908b5ad56c.tar.gz rust-2c8bbeebf1c630d06e44fa131d1cb0908b5ad56c.zip | |
Remove fully_normalize
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits/specialize/mod.rs')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/specialize/mod.rs | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs index 6a904ef487e..3c33d13567d 100644 --- a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs @@ -18,9 +18,7 @@ use crate::error_reporting::traits::to_pretty_impl_header; use crate::errors::NegativePositiveConflict; use crate::infer::{InferCtxt, InferOk, TyCtxtInferExt}; use crate::traits::select::IntercrateAmbiguityCause; -use crate::traits::{ - self, coherence, FutureCompatOverlapErrorKind, ObligationCause, ObligationCtxt, -}; +use crate::traits::{coherence, FutureCompatOverlapErrorKind, ObligationCause, ObligationCtxt}; use rustc_data_structures::fx::FxIndexSet; use rustc_errors::{codes::*, Diag, EmissionGuarantee}; use rustc_hir::def_id::{DefId, LocalDefId}; @@ -219,19 +217,17 @@ fn fulfill_implication<'tcx>( param_env, source_trait_ref, target_impl ); - let source_trait_ref = - match traits::fully_normalize(infcx, ObligationCause::dummy(), param_env, source_trait_ref) - { - Ok(source_trait_ref) => source_trait_ref, - Err(_errors) => { - infcx.dcx().span_delayed_bug( - infcx.tcx.def_span(source_impl), - format!("failed to fully normalize {source_trait_ref}"), - ); - source_trait_ref - } - }; + let ocx = ObligationCtxt::new(infcx); + let source_trait_ref = ocx.normalize(&ObligationCause::dummy(), param_env, source_trait_ref); + if !ocx.select_all_or_error().is_empty() { + infcx.dcx().span_delayed_bug( + infcx.tcx.def_span(source_impl), + format!("failed to fully normalize {source_trait_ref}"), + ); + } + + let source_trait_ref = infcx.resolve_vars_if_possible(source_trait_ref); let source_trait = ImplSubject::Trait(source_trait_ref); let selcx = SelectionContext::new(infcx); @@ -253,9 +249,6 @@ fn fulfill_implication<'tcx>( return Err(()); }; - // Needs to be `in_snapshot` because this function is used to rebase - // generic parameters, which may happen inside of a select within a probe. - let ocx = ObligationCtxt::new(infcx); // attempt to prove all of the predicates for impl2 given those for impl1 // (which are packed up in penv) ocx.register_obligations(obligations.chain(more_obligations)); |
