initial revert
This commit is contained in:
parent
b0ec3e09a9
commit
71bbb603f4
127 changed files with 540 additions and 1050 deletions
|
@ -568,7 +568,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
ty::ConstKind::Param(_) | ty::ConstKind::Bound(..) => throw_inval!(TooGeneric),
|
||||
ty::ConstKind::Error(_) => throw_inval!(AlreadyReported(ErrorReported)),
|
||||
ty::ConstKind::Unevaluated(uv) => {
|
||||
let instance = self.resolve(uv.def, uv.substs(*self.tcx))?;
|
||||
let instance = self.resolve(uv.def, uv.substs)?;
|
||||
Ok(self.eval_to_allocation(GlobalId { instance, promoted: uv.promoted })?.into())
|
||||
}
|
||||
ty::ConstKind::Infer(..) | ty::ConstKind::Placeholder(..) => {
|
||||
|
|
|
@ -9,7 +9,7 @@ where
|
|||
T: TypeFoldable<'tcx>,
|
||||
{
|
||||
debug!("ensure_monomorphic_enough: ty={:?}", ty);
|
||||
if !ty.potentially_needs_subst() {
|
||||
if !ty.needs_subst() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
|
@ -21,12 +21,8 @@ where
|
|||
impl<'tcx> TypeVisitor<'tcx> for UsedParamsNeedSubstVisitor<'tcx> {
|
||||
type BreakTy = FoundParam;
|
||||
|
||||
fn tcx_for_anon_const_substs(&self) -> Option<TyCtxt<'tcx>> {
|
||||
Some(self.tcx)
|
||||
}
|
||||
|
||||
fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||
if !ty.potentially_needs_subst() {
|
||||
if !ty.needs_subst() {
|
||||
return ControlFlow::CONTINUE;
|
||||
}
|
||||
|
||||
|
@ -44,7 +40,7 @@ where
|
|||
let is_used = unused_params.contains(index).map_or(true, |unused| !unused);
|
||||
// Only recurse when generic parameters in fns, closures and generators
|
||||
// are used and require substitution.
|
||||
match (is_used, subst.definitely_needs_subst(self.tcx)) {
|
||||
match (is_used, subst.needs_subst()) {
|
||||
// Just in case there are closures or generators within this subst,
|
||||
// recurse.
|
||||
(true, true) => return subst.super_visit_with(self),
|
||||
|
|
|
@ -348,7 +348,7 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
|
|||
fn check_local_or_return_ty(&mut self, ty: Ty<'tcx>, local: Local) {
|
||||
let kind = self.body.local_kind(local);
|
||||
|
||||
for ty in ty.walk(self.tcx) {
|
||||
for ty in ty.walk() {
|
||||
let ty = match ty.unpack() {
|
||||
GenericArgKind::Type(ty) => ty,
|
||||
|
||||
|
|
|
@ -338,7 +338,7 @@ where
|
|||
|
||||
// Check the qualifs of the value of `const` items.
|
||||
if let Some(ct) = constant.literal.const_for_ty() {
|
||||
if let ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs_: _, promoted }) = ct.val {
|
||||
if let ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs: _, promoted }) = ct.val {
|
||||
// Use qualifs of the type for the promoted. Promoteds in MIR body should be possible
|
||||
// only for `NeedsNonConstDrop` with precise drop checking. This is the only const
|
||||
// check performed after the promotion. Verify that with an assertion.
|
||||
|
|
|
@ -843,17 +843,13 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
|
|||
ty,
|
||||
val: ty::ConstKind::Unevaluated(ty::Unevaluated {
|
||||
def,
|
||||
substs_: Some(InternalSubsts::for_item(
|
||||
tcx,
|
||||
def.did,
|
||||
|param, _| {
|
||||
if let ty::GenericParamDefKind::Lifetime = param.kind {
|
||||
tcx.lifetimes.re_erased.into()
|
||||
} else {
|
||||
tcx.mk_param_from_def(param)
|
||||
}
|
||||
},
|
||||
)),
|
||||
substs: InternalSubsts::for_item(tcx, def.did, |param, _| {
|
||||
if let ty::GenericParamDefKind::Lifetime = param.kind {
|
||||
tcx.lifetimes.re_erased.into()
|
||||
} else {
|
||||
tcx.mk_param_from_def(param)
|
||||
}
|
||||
}),
|
||||
promoted: Some(promoted_id),
|
||||
}),
|
||||
})
|
||||
|
@ -969,7 +965,6 @@ pub fn promote_candidates<'tcx>(
|
|||
scope.parent_scope = None;
|
||||
|
||||
let promoted = Body::new(
|
||||
tcx,
|
||||
body.source, // `promoted` gets filled in below
|
||||
IndexVec::new(),
|
||||
IndexVec::from_elem_n(scope, 1),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue