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

BacktraceStatus is borked #100399

Closed
dtolnay opened this issue Aug 11, 2022 · 3 comments · Fixed by #100418 or #100431
Closed

BacktraceStatus is borked #100399

dtolnay opened this issue Aug 11, 2022 · 3 comments · Fixed by #100418 or #100431
Labels
A-error-handling Area: Error handling 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. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@dtolnay
Copy link
Member

dtolnay commented Aug 11, 2022

fn main() {
    let _ = std::backtrace::BacktraceStatus::Captured;
}

As of current nightly rustc 1.65.0-nightly (29e4a9e 2022-08-10):

warning: Error finalizing incremental compilation session directory `/git/repro/target/debug/incremental/repro-23roub2a2ui7m/s-gchtf270bu-9k52gi-working`: No such file or directory (os error 2)

error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: encountered unmarked API: DefId(1:10648 ~ std[0cb1]::backtrace::BacktraceStatus::Captured::{constructor#0})
 --> src/main.rs:2:13
  |
2 |     let _ = std::backtrace::BacktraceStatus::Captured;
  |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: delayed at compiler/rustc_middle/src/middle/stability.rs:603:27

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1425:13
stack backtrace:
   0:     0x7f9cbef657e0 - std::backtrace_rs::backtrace::libunwind::trace::hea82fac2aae29b23
                               at /rustc/29e4a9ee0253cd39e552a77f51f11f9a5f1c41e6/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7f9cbef657e0 - std::backtrace_rs::backtrace::trace_unsynchronized::h5517a70ae29c4a37
                               at /rustc/29e4a9ee0253cd39e552a77f51f11f9a5f1c41e6/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9cbef657e0 - std::sys_common::backtrace::_print_fmt::h15ae471bcdd82d93
                               at /rustc/29e4a9ee0253cd39e552a77f51f11f9a5f1c41e6/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f9cbef657e0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h7e2315bde9966038
                               at /rustc/29e4a9ee0253cd39e552a77f51f11f9a5f1c41e6/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f9cbefc0cfc - core::fmt::write::h6c731326a8a30a57
                               at /rustc/29e4a9ee0253cd39e552a77f51f11f9a5f1c41e6/library/core/src/fmt/mod.rs:1198:17
   5:     0x7f9cbef56935 - std::io::Write::write_fmt::h71584a2dd6c3063c
                               at /rustc/29e4a9ee0253cd39e552a77f51f11f9a5f1c41e6/library/std/src/io/mod.rs:1672:15
   6:     0x7f9cbef684b1 - std::sys_common::backtrace::_print::h24f1c9f87e80a8e0
                               at /rustc/29e4a9ee0253cd39e552a77f51f11f9a5f1c41e6/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f9cbef684b1 - std::sys_common::backtrace::print::hf0c5754f46015782
                               at /rustc/29e4a9ee0253cd39e552a77f51f11f9a5f1c41e6/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f9cbef684b1 - std::panicking::default_hook::{{closure}}::h92f4071e73011988
                               at /rustc/29e4a9ee0253cd39e552a77f51f11f9a5f1c41e6/library/std/src/panicking.rs:295:22
   9:     0x7f9cbef68183 - std::panicking::default_hook::h97b116f9b96b6bfa
                               at /rustc/29e4a9ee0253cd39e552a77f51f11f9a5f1c41e6/library/std/src/panicking.rs:314:9
  10:     0x7f9cc17ea414 - rustc_driver[788d642ecae1365]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f9cbef68ce6 - std::panicking::rust_panic_with_hook::hd6e7d786bac2c17a
                               at /rustc/29e4a9ee0253cd39e552a77f51f11f9a5f1c41e6/library/std/src/panicking.rs:702:17
  12:     0x7f9cc28b4b01 - std[cb15343d4403b06]::panicking::begin_panic::<rustc_errors[f53c5e75797f2c2c]::ExplicitBug>::{closure#0}
  13:     0x7f9cc28b48e6 - std[cb15343d4403b06]::sys_common::backtrace::__rust_end_short_backtrace::<std[cb15343d4403b06]::panicking::begin_panic<rustc_errors[f53c5e75797f2c2c]::ExplicitBug>::{closure#0}, !>
  14:     0x7f9cc28af0a6 - std[cb15343d4403b06]::panicking::begin_panic::<rustc_errors[f53c5e75797f2c2c]::ExplicitBug>
  15:     0x7f9cc28b1566 - std[cb15343d4403b06]::panic::panic_any::<rustc_errors[f53c5e75797f2c2c]::ExplicitBug>
  16:     0x7f9cc12f73e3 - <rustc_errors[f53c5e75797f2c2c]::HandlerInner as core[99438563fdc9f911]::ops::drop::Drop>::drop
  17:     0x7f9cc0fd1268 - core[99438563fdc9f911]::ptr::drop_in_place::<rustc_session[3e6e1c7aab68e7e]::parse::ParseSess>
  18:     0x7f9cc0fc74f3 - <alloc[44a602b2dcc58bae]::rc::Rc<rustc_session[3e6e1c7aab68e7e]::session::Session> as core[99438563fdc9f911]::ops::drop::Drop>::drop
  19:     0x7f9cc0fc64bd - core[99438563fdc9f911]::ptr::drop_in_place::<rustc_interface[a7fb64d19efedbd1]::interface::Compiler>
  20:     0x7f9cc0fc5ed9 - rustc_span[752667cdfed889fa]::with_source_map::<core[99438563fdc9f911]::result::Result<(), rustc_errors[f53c5e75797f2c2c]::ErrorGuaranteed>, rustc_interface[a7fb64d19efedbd1]::interface::create_compiler_and_run<core[99438563fdc9f911]::result::Result<(), rustc_errors[f53c5e75797f2c2c]::ErrorGuaranteed>, rustc_driver[788d642ecae1365]::run_compiler::{closure#1}>::{closure#1}>
  21:     0x7f9cc0fc56f0 - rustc_interface[a7fb64d19efedbd1]::interface::create_compiler_and_run::<core[99438563fdc9f911]::result::Result<(), rustc_errors[f53c5e75797f2c2c]::ErrorGuaranteed>, rustc_driver[788d642ecae1365]::run_compiler::{closure#1}>
  22:     0x7f9cc0fc3a61 - <scoped_tls[e6c3a7675e4d4aef]::ScopedKey<rustc_span[752667cdfed889fa]::SessionGlobals>>::set::<rustc_interface[a7fb64d19efedbd1]::interface::run_compiler<core[99438563fdc9f911]::result::Result<(), rustc_errors[f53c5e75797f2c2c]::ErrorGuaranteed>, rustc_driver[788d642ecae1365]::run_compiler::{closure#1}>::{closure#0}, core[99438563fdc9f911]::result::Result<(), rustc_errors[f53c5e75797f2c2c]::ErrorGuaranteed>>
  23:     0x7f9cc0fc374f - std[cb15343d4403b06]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[a7fb64d19efedbd1]::util::run_in_thread_pool_with_globals<rustc_interface[a7fb64d19efedbd1]::interface::run_compiler<core[99438563fdc9f911]::result::Result<(), rustc_errors[f53c5e75797f2c2c]::ErrorGuaranteed>, rustc_driver[788d642ecae1365]::run_compiler::{closure#1}>::{closure#0}, core[99438563fdc9f911]::result::Result<(), rustc_errors[f53c5e75797f2c2c]::ErrorGuaranteed>>::{closure#0}, core[99438563fdc9f911]::result::Result<(), rustc_errors[f53c5e75797f2c2c]::ErrorGuaranteed>>
  24:     0x7f9cc16119b9 - <<std[cb15343d4403b06]::thread::Builder>::spawn_unchecked_<rustc_interface[a7fb64d19efedbd1]::util::run_in_thread_pool_with_globals<rustc_interface[a7fb64d19efedbd1]::interface::run_compiler<core[99438563fdc9f911]::result::Result<(), rustc_errors[f53c5e75797f2c2c]::ErrorGuaranteed>, rustc_driver[788d642ecae1365]::run_compiler::{closure#1}>::{closure#0}, core[99438563fdc9f911]::result::Result<(), rustc_errors[f53c5e75797f2c2c]::ErrorGuaranteed>>::{closure#0}, core[99438563fdc9f911]::result::Result<(), rustc_errors[f53c5e75797f2c2c]::ErrorGuaranteed>>::{closure#1} as core[99438563fdc9f911]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  25:     0x7f9cbef72913 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb881e57abf2e61a2
                               at /rustc/29e4a9ee0253cd39e552a77f51f11f9a5f1c41e6/library/alloc/src/boxed.rs:1935:9
  26:     0x7f9cbef72913 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd53432c78099d0ef
                               at /rustc/29e4a9ee0253cd39e552a77f51f11f9a5f1c41e6/library/alloc/src/boxed.rs:1935:9
  27:     0x7f9cbef72913 - std::sys::unix::thread::Thread::new::thread_start::hc7417f6a39490db3
                               at /rustc/29e4a9ee0253cd39e552a77f51f11f9a5f1c41e6/library/std/src/sys/unix/thread.rs:108:17
  28:     0x7f9cbecb1b43 - start_thread
                               at ./nptl/./nptl/pthread_create.c:442:8
  29:     0x7f9cbed43a00 - clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  30:                0x0 - <unknown>

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.65.0-nightly (29e4a9ee0 2022-08-10) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
warning: `repro` (bin "repro") generated 1 warning
error: could not compile `repro`; 1 warning emitted

Meta

rustc --version --verbose:

rustc 1.65.0-nightly (29e4a9ee0 2022-08-10)
binary: rustc
commit-hash: 29e4a9ee0253cd39e552a77f51f11f9a5f1c41e6
commit-date: 2022-08-10
host: x86_64-unknown-linux-gnu
release: 1.65.0-nightly
LLVM version: 14.0.6

Mentioning erstwhile tracking issue #53487.
Mentioning @tbodt @yaahc in connection with #99573.

@dtolnay dtolnay added 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. C-bug Category: This is a bug. T-libs Relevant to the library team, which will review and decide on the PR/issue. A-error-handling Area: Error handling labels Aug 11, 2022
@dtolnay
Copy link
Member Author

dtolnay commented Aug 11, 2022

"encountered unmarked API" — maybe it's that there is no #[stable] attribute on the enum variants, like there is in other stable enums? I'd have expected that to be caught during the libstd build, so we should fix whatever was supposed to catch it, not just add the attributes.

@tbodt
Copy link
Contributor

tbodt commented Aug 11, 2022

Indeed, I didn't realize that enum variants also needed stable attributes.

@tbodt
Copy link
Contributor

tbodt commented Aug 11, 2022

#100418

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 11, 2022
Add stability attributes to BacktraceStatus variants

Fixes rust-lang#100399
@bors bors closed this as completed in 121fab0 Aug 12, 2022
compiler-errors added a commit to compiler-errors/rust that referenced this issue Aug 14, 2022
…stab, r=estebank

Enum variant ctor inherits the stability of the enum variant

Fixes rust-lang#100399
Fixes rust-lang#100420

Context rust-lang#71481 for why enum variants don't need stability
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-error-handling Area: Error handling 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. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
2 participants