Closed
Description
Code
I tried this code (thanks to @jyn514 for the minified version):
fn impl_get_slice() -> &'static [()] {
&[()]
}
#[inline(always)]
fn get_slice() -> &'static [()] {
let ret = (|| { impl_get_slice() })();
ret
}
fn main() {
let output = get_slice().len();
println!("{}", output);
}
I expected the code to print 0
, the length of the slice.
Instead, a random value is printed.
Version it worked on
It most recently worked on:
rustc --version --verbose
:
rustc 1.52.0-nightly (476acbf1e 2021-03-03)
binary: rustc
commit-hash: 476acbf1e9965b5e95c90f0d7d658709812b7003
commit-date: 2021-03-03
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 11.0.1
Version with regression
rustc --version --verbose
:
rustc 1.52.0-nightly (45b3c2851 2021-03-04)
binary: rustc
commit-hash: 45b3c28518e4c45dfd12bc2c4400c0d0e9639927
commit-date: 2021-03-04
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 12.0.0
@rustbot modify labels: +regression-from-nightly-to-nightly -regression-untriaged
Metadata
Metadata
Assignees
Labels
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Category: This is a bug.Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessCritical priorityRelevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from stable to nightly.