Skip to content

Commit 25cd191

Browse files
committed
revert behaviour to warn!
1 parent 1a3a62c commit 25cd191

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

compiler/rustc_codegen_ssa/src/mir/locals.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use rustc_index::IndexVec;
77
use rustc_middle::mir;
88
use rustc_middle::ty::print::with_no_trimmed_paths;
99
use std::ops::{Index, IndexMut};
10-
1110
pub(super) struct Locals<'tcx, V> {
1211
values: IndexVec<mir::Local, LocalRef<'tcx, V>>,
1312
}
@@ -37,7 +36,17 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
3736
pub(super) fn initialize_locals(&mut self, values: Vec<LocalRef<'tcx, Bx::Value>>) {
3837
assert!(self.locals.values.is_empty());
3938
// FIXME(#115215): After #115025 get's merged this might not be necessary
40-
for (_, value) in values.into_iter().enumerate() {
39+
for (local, value) in values.into_iter().enumerate() {
40+
match value {
41+
LocalRef::Place(_) | LocalRef::UnsizedPlace(_) | LocalRef::PendingOperand => (),
42+
LocalRef::Operand(op) => {
43+
let local = mir::Local::from_usize(local);
44+
let expected_ty = self.monomorphize(self.mir.local_decls[local].ty);
45+
if expected_ty != op.layout.ty {
46+
warn!("Unexpected initial operand type. See the issues/114858");
47+
}
48+
}
49+
}
4150
self.locals.values.push(value);
4251
}
4352
}

tests/ui/codegen/subtyping-enforces-type-equality.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// run-pass
1+
// build-pass
22
// edition:2021
3+
#![allow(warnings)]
34
use std::future::Future;
45
use std::pin::Pin;
56

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
WARN rustc_codegen_ssa::mir::locals Unexpected initial operand type. See the issues/114858

0 commit comments

Comments
 (0)