1
Fork 0

no more Reveal :(

This commit is contained in:
lcnr 2024-11-20 11:31:49 +01:00
parent f4b516b10c
commit 319843d8cd
46 changed files with 112 additions and 299 deletions

View file

@ -155,7 +155,7 @@ fn resolve_associated_item<'tcx>(
return Ok(None);
}
let typing_env = typing_env.with_reveal_all_normalized(tcx);
let typing_env = typing_env.with_post_analysis_normalized(tcx);
let (infcx, param_env) = tcx.infer_ctxt().build_with_typing_env(typing_env);
let args = rcvr_args.rebase_onto(tcx, trait_def_id, impl_data.args);
let args = translate_args(

View file

@ -49,7 +49,7 @@ fn layout_of<'tcx>(
// Optimization: We convert to RevealAll and convert opaque types in the where bounds
// to their hidden types. This reduces overall uncached invocations of `layout_of` and
// is thus a small performance improvement.
let typing_env = typing_env.with_reveal_all_normalized(tcx);
let typing_env = typing_env.with_post_analysis_normalized(tcx);
let unnormalized_ty = ty;
// FIXME: We might want to have two different versions of `layout_of`:

View file

@ -158,8 +158,7 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
let local_did = def_id.as_local();
let unnormalized_env =
ty::ParamEnv::new(tcx.mk_clauses(&predicates), traits::Reveal::UserFacing);
let unnormalized_env = ty::ParamEnv::new(tcx.mk_clauses(&predicates));
let body_id = local_did.unwrap_or(CRATE_DEF_ID);
let cause = traits::ObligationCause::misc(tcx.def_span(def_id), body_id);
@ -249,8 +248,10 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ImplTraitInTraitFinder<'_, 'tcx> {
}
}
fn param_env_reveal_all_normalized(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
tcx.param_env(def_id).with_reveal_all_normalized(tcx)
fn param_env_normalized_for_post_analysis(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
// This is a bit ugly but the easiest way to avoid code duplication.
let typing_env = ty::TypingEnv::non_body_analysis(tcx, def_id);
typing_env.with_post_analysis_normalized(tcx).param_env
}
/// If the given trait impl enables exploiting the former order dependence of trait objects,
@ -362,7 +363,7 @@ pub(crate) fn provide(providers: &mut Providers) {
asyncness,
adt_sized_constraint,
param_env,
param_env_reveal_all_normalized,
param_env_normalized_for_post_analysis,
self_ty_of_trait_impl_enabling_order_dep_trait_object_hack,
defaultness,
unsizing_params_for_adt,