diff options
| author | bors <bors@rust-lang.org> | 2022-10-29 20:44:01 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-10-29 20:44:01 +0000 |
| commit | 90b3882115c9c499b67824b89b641b51f5c0c40d (patch) | |
| tree | 53c1d1843223a4e9a4f95901b7e06ac9bd9430fc /compiler/rustc_const_eval | |
| parent | 636a78aca875fcba6468eabe750a79f08ee9a635 (diff) | |
| parent | 108b32ea5909e793d053a2590eb5916eac05352d (diff) | |
| download | rust-90b3882115c9c499b67824b89b641b51f5c0c40d.tar.gz rust-90b3882115c9c499b67824b89b641b51f5c0c40d.zip | |
Auto merge of #103739 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
[beta] backport rollup * poll_fn and Unpin: fix pinning #102737 * Support raw-dylib functions being used inside inlined functions #102988 * Fix line numbers for MIR inlined code #103071 * Add architectures to fn create_object_file #103240 * Add eval hack in super_relate_consts back #103279 * Mark std::os::wasi::io::AsFd etc. as stable. #103308 * Truncate thread names on Linux and Apple targets #103379 * Do not consider repeated lifetime params for elision. #103450 * rustdoc: add missing URL redirect #103588 * Remove commit_if_ok probe from NLL type relation #103601 Also includes a copy of the release notes. r? `@ghost`
Diffstat (limited to 'compiler/rustc_const_eval')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/operand.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/operand.rs b/compiler/rustc_const_eval/src/interpret/operand.rs index 29c745a0886..0e3959b61a1 100644 --- a/compiler/rustc_const_eval/src/interpret/operand.rs +++ b/compiler/rustc_const_eval/src/interpret/operand.rs @@ -591,9 +591,16 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { val: &mir::ConstantKind<'tcx>, layout: Option<TyAndLayout<'tcx>>, ) -> InterpResult<'tcx, OpTy<'tcx, M::Provenance>> { + // FIXME(const_prop): normalization needed b/c const prop lint in + // `mir_drops_elaborated_and_const_checked`, which happens before + // optimized MIR. Only after optimizing the MIR can we guarantee + // that the `RevealAll` pass has happened and that the body's consts + // are normalized, so any call to resolve before that needs to be + // manually normalized. + let val = self.tcx.normalize_erasing_regions(self.param_env, *val); match val { - mir::ConstantKind::Ty(ct) => self.const_to_op(*ct, layout), - mir::ConstantKind::Val(val, ty) => self.const_val_to_op(*val, *ty, layout), + mir::ConstantKind::Ty(ct) => self.const_to_op(ct, layout), + mir::ConstantKind::Val(val, ty) => self.const_val_to_op(val, ty, layout), mir::ConstantKind::Unevaluated(uv, _) => { let instance = self.resolve(uv.def, uv.substs)?; Ok(self.eval_to_allocation(GlobalId { instance, promoted: uv.promoted })?.into()) |
