diff options
| author | lcnr <rust@lcnr.de> | 2024-11-19 18:07:55 +0100 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2024-11-19 18:35:41 +0100 |
| commit | 4813fda2e6d89c948c56685e83c1dcb90ed30f5d (patch) | |
| tree | 92cbdd48d23b24fc4256302cdbc4d731bb469be6 /compiler/rustc_trait_selection/src/traits/auto_trait.rs | |
| parent | f74951fdf1a46af01efdc72f50f1df2a7cb49b49 (diff) | |
| download | rust-4813fda2e6d89c948c56685e83c1dcb90ed30f5d.tar.gz rust-4813fda2e6d89c948c56685e83c1dcb90ed30f5d.zip | |
rustdoc: yeet `TypingEnv::from_param_env`
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits/auto_trait.rs')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/auto_trait.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/auto_trait.rs b/compiler/rustc_trait_selection/src/traits/auto_trait.rs index 103f7c76a86..fac0414d714 100644 --- a/compiler/rustc_trait_selection/src/traits/auto_trait.rs +++ b/compiler/rustc_trait_selection/src/traits/auto_trait.rs @@ -9,7 +9,6 @@ use rustc_data_structures::unord::UnordSet; use rustc_infer::infer::DefineOpaqueTypes; use rustc_middle::ty::{Region, RegionVid}; use tracing::debug; -use ty::TypingMode; use super::*; use crate::errors::UnableToConstructConstantValue; @@ -71,7 +70,7 @@ impl<'tcx> AutoTraitFinder<'tcx> { pub fn find_auto_trait_generics<A>( &self, ty: Ty<'tcx>, - orig_env: ty::ParamEnv<'tcx>, + typing_env: ty::TypingEnv<'tcx>, trait_did: DefId, mut auto_trait_callback: impl FnMut(AutoTraitInfo<'tcx>) -> A, ) -> AutoTraitResult<A> { @@ -79,7 +78,7 @@ impl<'tcx> AutoTraitFinder<'tcx> { let trait_ref = ty::TraitRef::new(tcx, trait_did, [ty]); - let infcx = tcx.infer_ctxt().build(TypingMode::non_body_analysis()); + let (infcx, orig_env) = tcx.infer_ctxt().build_with_typing_env(typing_env); let mut selcx = SelectionContext::new(&infcx); for polarity in [ty::PredicatePolarity::Positive, ty::PredicatePolarity::Negative] { let result = selcx.select(&Obligation::new( @@ -89,17 +88,13 @@ impl<'tcx> AutoTraitFinder<'tcx> { ty::TraitPredicate { trait_ref, polarity }, )); if let Ok(Some(ImplSource::UserDefined(_))) = result { - debug!( - "find_auto_trait_generics({:?}): \ - manual impl found, bailing out", - trait_ref - ); + debug!("find_auto_trait_generics({trait_ref:?}): manual impl found, bailing out"); // If an explicit impl exists, it always takes priority over an auto impl return AutoTraitResult::ExplicitImpl; } } - let infcx = tcx.infer_ctxt().build(TypingMode::non_body_analysis()); + let (infcx, orig_env) = tcx.infer_ctxt().build_with_typing_env(typing_env); let mut fresh_preds = FxIndexSet::default(); // Due to the way projections are handled by SelectionContext, we need to run |
