Driveby fixes
This commit is contained in:
@@ -984,8 +984,8 @@ impl<'cx, 'tcx> Resolver<'cx, 'tcx> {
|
|||||||
// borrowck, and specifically region constraints will be populated during
|
// borrowck, and specifically region constraints will be populated during
|
||||||
// MIR typeck which is run on the new body.
|
// MIR typeck which is run on the new body.
|
||||||
//
|
//
|
||||||
// We're not using `tcx.erase_and_anonymize_regions` as that also anonymizes bound variables,
|
// We're not using `tcx.erase_and_anonymize_regions` as that also
|
||||||
// regressing borrowck diagnostics.
|
// anonymizes bound variables, regressing borrowck diagnostics.
|
||||||
value = fold_regions(tcx, value, |_, _| tcx.lifetimes.re_erased);
|
value = fold_regions(tcx, value, |_, _| tcx.lifetimes.re_erased);
|
||||||
|
|
||||||
// Normalize consts in writeback, because GCE doesn't normalize eagerly.
|
// Normalize consts in writeback, because GCE doesn't normalize eagerly.
|
||||||
|
|||||||
@@ -131,9 +131,8 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||||||
/// Creates a hash of the type `Ty` which will be the same no matter what crate
|
/// Creates a hash of the type `Ty` which will be the same no matter what crate
|
||||||
/// context it's calculated within. This is used by the `type_id` intrinsic.
|
/// context it's calculated within. This is used by the `type_id` intrinsic.
|
||||||
pub fn type_id_hash(self, ty: Ty<'tcx>) -> Hash128 {
|
pub fn type_id_hash(self, ty: Ty<'tcx>) -> Hash128 {
|
||||||
// We want the type_id be independent of the types free regions, so we
|
// We don't have region information, so we erase all free regions. Equal types
|
||||||
// erase them. We also want type_id to be independnt of the names of bound
|
// must have the same `TypeId`, so we must anonymize all bound regions as well.
|
||||||
// regions so we anonymize them.
|
|
||||||
let ty = self.erase_and_anonymize_regions(ty);
|
let ty = self.erase_and_anonymize_regions(ty);
|
||||||
|
|
||||||
self.with_stable_hashing_context(|mut hcx| {
|
self.with_stable_hashing_context(|mut hcx| {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ impl<'tcx> TailCallCkVisitor<'_, 'tcx> {
|
|||||||
"`become` outside of functions should have been disallowed by hir_typeck"
|
"`become` outside of functions should have been disallowed by hir_typeck"
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
// While the `caller_sig` does have its regions erased, it does not have its
|
// While the `caller_sig` does have its free regions erased, it does not have its
|
||||||
// binders anonymized. We call `erase_and_anonymize_regions` once again to anonymize any binders
|
// binders anonymized. We call `erase_and_anonymize_regions` once again to anonymize any binders
|
||||||
// within the signature, such as in function pointer or `dyn Trait` args.
|
// within the signature, such as in function pointer or `dyn Trait` args.
|
||||||
let caller_sig = self.tcx.erase_and_anonymize_regions(caller_sig);
|
let caller_sig = self.tcx.erase_and_anonymize_regions(caller_sig);
|
||||||
|
|||||||
@@ -350,6 +350,8 @@ pub fn dtorck_constraint_for_ty_inner<'tcx>(
|
|||||||
// Note that we don't care about whether the resume type has any drops since this is
|
// Note that we don't care about whether the resume type has any drops since this is
|
||||||
// redundant; there is no storage for the resume type, so if it is actually stored
|
// redundant; there is no storage for the resume type, so if it is actually stored
|
||||||
// in the interior, we'll already detect the need for a drop by checking the interior.
|
// in the interior, we'll already detect the need for a drop by checking the interior.
|
||||||
|
//
|
||||||
|
// FIXME(@lcnr): Why do we erase regions in the env here? Seems odd
|
||||||
let typing_env = tcx.erase_and_anonymize_regions(typing_env);
|
let typing_env = tcx.erase_and_anonymize_regions(typing_env);
|
||||||
let needs_drop = tcx.mir_coroutine_witnesses(def_id).is_some_and(|witness| {
|
let needs_drop = tcx.mir_coroutine_witnesses(def_id).is_some_and(|witness| {
|
||||||
witness.field_tys.iter().any(|field| field.ty.needs_drop(tcx, typing_env))
|
witness.field_tys.iter().any(|field| field.ty.needs_drop(tcx, typing_env))
|
||||||
|
|||||||
@@ -426,9 +426,7 @@ pub(crate) mod rustc {
|
|||||||
assert!(def.is_enum());
|
assert!(def.is_enum());
|
||||||
|
|
||||||
// Computes the layout of a variant.
|
// Computes the layout of a variant.
|
||||||
let layout_of_variant = |index,
|
let layout_of_variant = |index, encoding: Option<_>| -> Result<Self, Err> {
|
||||||
encoding: Option<TagEncoding<VariantIdx>>|
|
|
||||||
-> Result<Self, Err> {
|
|
||||||
let variant_layout = ty_variant(cx, (ty, layout), index);
|
let variant_layout = ty_variant(cx, (ty, layout), index);
|
||||||
if variant_layout.is_uninhabited() {
|
if variant_layout.is_uninhabited() {
|
||||||
return Ok(Self::uninhabited());
|
return Ok(Self::uninhabited());
|
||||||
|
|||||||
@@ -398,7 +398,7 @@ impl std::fmt::Debug for HasTypeFlagsVisitor {
|
|||||||
// looks, particular for `Ty`/`Predicate` where it's just a field access.
|
// looks, particular for `Ty`/`Predicate` where it's just a field access.
|
||||||
//
|
//
|
||||||
// N.B. The only case where this isn't totally true is binders, which also
|
// N.B. The only case where this isn't totally true is binders, which also
|
||||||
// add `HAS_{RE,TY,CT}_LATE_BOUND` flag depending on the *bound variables* that
|
// add `HAS_BINDER_VARS` flag depending on the *bound variables* that
|
||||||
// are present, regardless of whether those bound variables are used. This
|
// are present, regardless of whether those bound variables are used. This
|
||||||
// is important for anonymization of binders in `TyCtxt::erase_and_anonymize_regions`. We
|
// is important for anonymization of binders in `TyCtxt::erase_and_anonymize_regions`. We
|
||||||
// specifically detect this case in `visit_binder`.
|
// specifically detect this case in `visit_binder`.
|
||||||
|
|||||||
Reference in New Issue
Block a user