Skip to content
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

Program crashes with #[track_caller] applied to main() #75125

Closed
flowbish opened this issue Aug 4, 2020 · 5 comments · Fixed by #75130
Closed

Program crashes with #[track_caller] applied to main() #75125

flowbish opened this issue Aug 4, 2020 · 5 comments · Fixed by #75130
Assignees
Labels
C-bug Category: This is a bug. I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@flowbish
Copy link

flowbish commented Aug 4, 2020

Code

#[track_caller]
fn main() {
    panic!("{}: oh no", std::panic::Location::caller());
}

Meta

Crash occurs in both 1.46.0 beta and in current nightly.

rustc --version --verbose:

rustc 1.46.0-beta.2 (6f959902b 2020-07-23)
binary: rustc
commit-hash: 6f959902b3103c49ca981fbc01871589c3498489
commit-date: 2020-07-23
host: x86_64-unknown-linux-gnu
release: 1.46.0-beta.2
LLVM version: 10.0
rustc 1.47.0-nightly (81e754c35 2020-08-02)
binary: rustc
commit-hash: 81e754c359c471f91263813c46c67955071716a7
commit-date: 2020-08-02
host: x86_64-unknown-linux-gnu
release: 1.47.0-nightly
LLVM version: 10.0

Error output

memory allocation of 94396265198519 bytes failed
@flowbish flowbish added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 4, 2020
@flowbish flowbish changed the title Rustc crashes with #[track_caller] applied to main() Program crashes with #[track_caller] applied to main() Aug 4, 2020
@flowbish
Copy link
Author

flowbish commented Aug 4, 2020

I made the false assumption that this was rustc crashing, but it's actually the binary that crashes upon running it.

@Mark-Simulacrum
Copy link
Member

Cc @anp

We probably just want to ban track caller on main (and maybe any lang item function?)

@lcnr lcnr added I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness and removed I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Aug 4, 2020
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Aug 4, 2020
@lcnr
Copy link
Contributor

lcnr commented Aug 4, 2020

@rustbot claim

@lcnr
Copy link
Contributor

lcnr commented Aug 4, 2020

Same with #[naked]:

#![feature(naked_functions)]

#[naked]
fn main() {
    println!("hey");
}

results in

/playground/tools/entrypoint.sh: line 11: 7 Segmentation fault timeout --signal=KILL ${timeout} "$@"

edit: I think naked is a more general problem so I won't change that here

Manishearth added a commit to Manishearth/rust that referenced this issue Aug 5, 2020
@JohnTitor
Copy link
Member

Assigning P-high as discussed as part of the Prioritization Working Group procedure and removing I-prioritize.

@JohnTitor JohnTitor added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Aug 5, 2020
@bors bors closed this as completed in 32d14eb Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants