-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
rustbot
added
A-mir-opt
Area: MIR optimizations
A-mir-opt-inlining
Area: MIR inlining
labels
Dec 10, 2022
#[track_caller]
fn another() {
panic!("line 3, right?")
}
#[inline]
fn nested() {
another();
}
fn main() {
nested();
}
|
tmiasko
added
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
regression-from-stable-to-stable
Performance or correctness regression from one stable version to another.
labels
Dec 14, 2022
rustbot
added
the
I-prioritize
Issue: Indicates that prioritization has been requested for this issue.
label
Dec 14, 2022
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-medium |
rustbot
added
P-medium
Medium priority
and removed
I-prioritize
Issue: Indicates that prioritization has been requested for this issue.
labels
Dec 21, 2022
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: