about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2020-01-01 20:10:55 -0500
committerAaron Hill <aa1ronham@gmail.com>2020-01-01 20:10:55 -0500
commite8e53b56dff3cd1f9e6d65ee30d5e0bfc55d9607 (patch)
tree01164280b7eeceb1a28e10d42a7e371e5dc01010 /src/test
parent0ec370670220b712b042ee09aab067ec7e5878d5 (diff)
Ensure that we process projections during MIR inlining
Fixes #67710

Previously, we were not calling `super_place`, which resulted in us
failing to update any local references that occur in
ProjectionElem::Index. This caused the post-inlining MIR to contain a
reference to a local ID from the inlined callee, leading to an ICE
due to a type mismatch.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/mir/issue-67710-inline-projection.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/ui/mir/issue-67710-inline-projection.rs b/src/test/ui/mir/issue-67710-inline-projection.rs
new file mode 100644
index 00000000000..37d8f2eac9b
--- /dev/null
+++ b/src/test/ui/mir/issue-67710-inline-projection.rs
@@ -0,0 +1,17 @@
+// compile-flags: -Z mir-opt-level=2
+// build-pass
+
+// This used to ICE due to the inling pass not examining projections
+// for references to locals
+
+pub fn parse(version: ()) {
+    p(&b'.', b"0");
+}
+#[inline(always)]
+fn p(byte: &u8, s: &[u8]) {
+    !(s[0] == *byte);
+}
+
+fn main() {
+    parse(());
+}