Skip to content

MIR inliner doesn't support return place used as an index #105466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tmiasko opened this issue Dec 8, 2022 · 1 comment
Closed

MIR inliner doesn't support return place used as an index #105466

tmiasko opened this issue Dec 8, 2022 · 1 comment
Labels
A-mir-opt-inlining Area: MIR inlining C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way.

Comments

@tmiasko
Copy link
Contributor

tmiasko commented Dec 8, 2022

#![feature(box_syntax)]

#[inline(always)]
pub fn f(a: usize, b: &mut usize, c: &[usize]) -> usize {
    let x = a + a;
    *b = c[x];
    x
}

pub fn g(a: usize, b: &mut usize, c: &[usize]) -> usize {
    f(a, b, c)
}

pub fn h(a: usize, b: &mut usize, c: &[usize]) -> Box<usize> {
    box f(a, b, c)
}
$ rustc a.rs --crate-type=lib -O -Zmir-opt-level=3
thread '<unnamed>' panicked at 'assertion failed: `(left != right)`
  left: `Index(_0)`,
 right: `Index(_0)`', compiler/rustc_mir_transform/src/inline.rs:1035:13
@tmiasko tmiasko added C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. A-mir-opt-inlining Area: MIR inlining labels Dec 8, 2022
@tmiasko
Copy link
Contributor Author

tmiasko commented Jan 17, 2023

Fixed in #106850.

@tmiasko tmiasko closed this as completed Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir-opt-inlining Area: MIR inlining C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way.
Projects
None yet
Development

No branches or pull requests

1 participant