-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
MIR inlining breaks Location::caller() #105538
Labels
A-mir-opt
Area: MIR optimizations
A-mir-opt-inlining
Area: MIR inlining
C-bug
Category: This is a bug.
P-medium
Medium priority
regression-from-stable-to-stable
Performance or correctness regression from one stable version to another.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
#[track_caller]
fn another() {
panic!("line 3, right?")
}
#[inline]
fn nested() {
another();
}
fn main() {
nested();
}
|
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-medium |
use std::panic::Location;
macro_rules! f {
() => { Location::caller() }
}
#[inline(always)]
fn g() -> &'static Location<'static> {
f!()
}
fn main() {
println!("{:?}", g());
} $ rustc a.rs && ./a
Location { file: "a.rs", line: 9, col: 5 }
$ rustc a.rs -O && ./a
Location { file: "a.rs", line: 4, col: 13 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-mir-opt
Area: MIR optimizations
A-mir-opt-inlining
Area: MIR inlining
C-bug
Category: This is a bug.
P-medium
Medium priority
regression-from-stable-to-stable
Performance or correctness regression from one stable version to another.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
In debug mode, this prints
But with optimizations, this prints:
With optimizations and
-Zinline-mir=no
, this prints:This check in the MIR inliner is hiding this problem from the track-caller UI tests:
rust/compiler/rustc_mir_transform/src/inline.rs
Lines 336 to 344 in 32da230
@rustbot label +A-mir-opt +A-mir-opt-inlining
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: