Skip to content

Commit

Permalink
Stall computing instance for drop shim until it has no unsubstituted …
Browse files Browse the repository at this point in the history
…const params
  • Loading branch information
compiler-errors committed Jun 28, 2024
1 parent 5c4798b commit d62c70c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 262 deletions.
11 changes: 10 additions & 1 deletion compiler/rustc_ty_utils/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rustc_middle::query::Providers;
use rustc_middle::traits::{BuiltinImplSource, CodegenObligationError};
use rustc_middle::ty::util::AsyncDropGlueMorphology;
use rustc_middle::ty::GenericArgsRef;
use rustc_middle::ty::{self, Instance, TyCtxt, TypeVisitableExt};
use rustc_middle::ty::{self, Instance, TyCtxt, TypeFlags, TypeVisitableExt};
use rustc_span::sym;
use rustc_trait_selection::traits;
use rustc_type_ir::ClosureKind;
Expand Down Expand Up @@ -53,6 +53,15 @@ fn resolve_instance<'tcx>(
_ => return Ok(None),
}

// FIXME(#127030): `ConstParamHasTy` has bad interactions with
// the drop shim builder, which does not evaluate predicates in
// the correct param-env for types being dropped. Stall resolving
// the MIR for this instance until all of its const params are
// substituted.
if ty.has_type_flags(TypeFlags::HAS_CT_PARAM) {
return Ok(None);
}

ty::InstanceKind::DropGlue(def_id, Some(ty))
} else {
debug!(" => trivial drop glue");
Expand Down
5 changes: 1 addition & 4 deletions tests/ui/const-generics/polymorphic-drop-shim.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
//@ compile-flags: -Zinline-mir=yes --crate-type=lib

//@ known-bug: unknown
//@ build-fail
//@ failure-status: 101
//@ build-pass

use std::mem::ManuallyDrop;

Expand Down
Loading

0 comments on commit d62c70c

Please sign in to comment.