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

Compiler panic #95303

Closed
MendyBerger opened this issue Mar 25, 2022 · 3 comments
Closed

Compiler panic #95303

MendyBerger opened this issue Mar 25, 2022 · 3 comments
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. 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.

Comments

@MendyBerger
Copy link

MendyBerger commented Mar 25, 2022

Code

#![feature(no_core)]
#![feature(lang_items)]

#![no_core]

#[no_mangle]
pub fn add(a: u32) -> u32 {
    a
}

#[lang = "sized"]
pub trait Sized {}

#[lang = "copy"]
pub trait Copy {}

Meta

rustc --version --verbose:

1.61.0-nightly

Error output

   Compiling playground v0.0.1 (/playground)
error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: broken MIR in DefId(0:1 ~ playground[4992]::add) (NoSolution): could not prove Binder(TraitPredicate(<u32 as Copy>, polarity:Positive), [])
  |
  = note: delayed at compiler/rustc_borrowck/src/type_check/canonical.rs:150:13

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1291:13
stack backtrace:
   0:     0x7f1b43d6978d - std::backtrace_rs::backtrace::libunwind::trace::h784cb64f77c799e4
                               at /rustc/8d60bf427a4b055f464122062e76b3ec34d4f8ba/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f1b43d6978d - std::backtrace_rs::backtrace::trace_unsynchronized::h37d0a08044f629a8
                               at /rustc/8d60bf427a4b055f464122062e76b3ec34d4f8ba/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f1b43d6978d - std::sys_common::backtrace::_print_fmt::h3feb324fd310b9a7
                               at /rustc/8d60bf427a4b055f464122062e76b3ec34d4f8ba/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f1b43d6978d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4f4e4f67069248d8
                               at /rustc/8d60bf427a4b055f464122062e76b3ec34d4f8ba/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f1b43dc336c - core::fmt::write::hcec4c22fb8220a38
                               at /rustc/8d60bf427a4b055f464122062e76b3ec34d4f8ba/library/core/src/fmt/mod.rs:1190:17
   5:     0x7f1b43d5ad91 - std::io::Write::write_fmt::haaf00a8ebef82d08
                               at /rustc/8d60bf427a4b055f464122062e76b3ec34d4f8ba/library/std/src/io/mod.rs:1655:15
   6:     0x7f1b43d6c875 - std::sys_common::backtrace::_print::h338729c4a2a845af
                               at /rustc/8d60bf427a4b055f464122062e76b3ec34d4f8ba/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f1b43d6c875 - std::sys_common::backtrace::print::h23fec30a3fa57965
                               at /rustc/8d60bf427a4b055f464122062e76b3ec34d4f8ba/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f1b43d6c875 - std::panicking::default_hook::{{closure}}::h949b3457e1194801
                               at /rustc/8d60bf427a4b055f464122062e76b3ec34d4f8ba/library/std/src/panicking.rs:295:22
   9:     0x7f1b43d6c529 - std::panicking::default_hook::he41e7411e1168615
                               at /rustc/8d60bf427a4b055f464122062e76b3ec34d4f8ba/library/std/src/panicking.rs:314:9
  10:     0x7f1b44507d51 - rustc_driver[90e3bd7925538a32]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f1b43d6cfc0 - std::panicking::rust_panic_with_hook::h186acfbc6602cc8e
                               at /rustc/8d60bf427a4b055f464122062e76b3ec34d4f8ba/library/std/src/panicking.rs:702:17
  12:     0x7f1b4559f431 - std[4fb2078a936f5865]::panicking::begin_panic::<rustc_errors[9ec17d26f4ea7f9f]::ExplicitBug>::{closure#0}
  13:     0x7f1b4559f316 - std[4fb2078a936f5865]::sys_common::backtrace::__rust_end_short_backtrace::<std[4fb2078a936f5865]::panicking::begin_panic<rustc_errors[9ec17d26f4ea7f9f]::ExplicitBug>::{closure#0}, !>
  14:     0x7f1b455a616f - std[4fb2078a936f5865]::panicking::begin_panic::<rustc_errors[9ec17d26f4ea7f9f]::ExplicitBug>
  15:     0x7f1b455b2a76 - std[4fb2078a936f5865]::panic::panic_any::<rustc_errors[9ec17d26f4ea7f9f]::ExplicitBug>
  16:     0x7f1b46c42a0c - <rustc_errors[9ec17d26f4ea7f9f]::HandlerInner as core[ac30665fb42186d6]::ops::drop::Drop>::drop
  17:     0x7f1b4637eff8 - core[ac30665fb42186d6]::ptr::drop_in_place::<rustc_session[d419619141ab55a9]::parse::ParseSess>
  18:     0x7f1b46380fca - <alloc[1efc481e87c7491]::rc::Rc<rustc_session[d419619141ab55a9]::session::Session> as core[ac30665fb42186d6]::ops::drop::Drop>::drop
  19:     0x7f1b46369a1d - core[ac30665fb42186d6]::ptr::drop_in_place::<rustc_interface[afe55cb781ad7894]::interface::Compiler>
  20:     0x7f1b46368fe4 - rustc_span[571b4d67342d6e5]::with_source_map::<core[ac30665fb42186d6]::result::Result<(), rustc_errors[9ec17d26f4ea7f9f]::ErrorGuaranteed>, rustc_interface[afe55cb781ad7894]::interface::create_compiler_and_run<core[ac30665fb42186d6]::result::Result<(), rustc_errors[9ec17d26f4ea7f9f]::ErrorGuaranteed>, rustc_driver[90e3bd7925538a32]::run_compiler::{closure#1}>::{closure#1}>
  21:     0x7f1b46368614 - rustc_interface[afe55cb781ad7894]::interface::create_compiler_and_run::<core[ac30665fb42186d6]::result::Result<(), rustc_errors[9ec17d26f4ea7f9f]::ErrorGuaranteed>, rustc_driver[90e3bd7925538a32]::run_compiler::{closure#1}>
  22:     0x7f1b46353752 - <scoped_tls[d205317d44737de4]::ScopedKey<rustc_span[571b4d67342d6e5]::SessionGlobals>>::set::<rustc_interface[afe55cb781ad7894]::interface::run_compiler<core[ac30665fb42186d6]::result::Result<(), rustc_errors[9ec17d26f4ea7f9f]::ErrorGuaranteed>, rustc_driver[90e3bd7925538a32]::run_compiler::{closure#1}>::{closure#0}, core[ac30665fb42186d6]::result::Result<(), rustc_errors[9ec17d26f4ea7f9f]::ErrorGuaranteed>>
  23:     0x7f1b46351c0f - std[4fb2078a936f5865]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[afe55cb781ad7894]::util::run_in_thread_pool_with_globals<rustc_interface[afe55cb781ad7894]::interface::run_compiler<core[ac30665fb42186d6]::result::Result<(), rustc_errors[9ec17d26f4ea7f9f]::ErrorGuaranteed>, rustc_driver[90e3bd7925538a32]::run_compiler::{closure#1}>::{closure#0}, core[ac30665fb42186d6]::result::Result<(), rustc_errors[9ec17d26f4ea7f9f]::ErrorGuaranteed>>::{closure#0}, core[ac30665fb42186d6]::result::Result<(), rustc_errors[9ec17d26f4ea7f9f]::ErrorGuaranteed>>
  24:     0x7f1b46369d92 - <<std[4fb2078a936f5865]::thread::Builder>::spawn_unchecked_<rustc_interface[afe55cb781ad7894]::util::run_in_thread_pool_with_globals<rustc_interface[afe55cb781ad7894]::interface::run_compiler<core[ac30665fb42186d6]::result::Result<(), rustc_errors[9ec17d26f4ea7f9f]::ErrorGuaranteed>, rustc_driver[90e3bd7925538a32]::run_compiler::{closure#1}>::{closure#0}, core[ac30665fb42186d6]::result::Result<(), rustc_errors[9ec17d26f4ea7f9f]::ErrorGuaranteed>>::{closure#0}, core[ac30665fb42186d6]::result::Result<(), rustc_errors[9ec17d26f4ea7f9f]::ErrorGuaranteed>>::{closure#1} as core[ac30665fb42186d6]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  25:     0x7f1b43d771b3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7b6172238cf57322
                               at /rustc/8d60bf427a4b055f464122062e76b3ec34d4f8ba/library/alloc/src/boxed.rs:1853:9
  26:     0x7f1b43d771b3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h921b28757b015a0f
                               at /rustc/8d60bf427a4b055f464122062e76b3ec34d4f8ba/library/alloc/src/boxed.rs:1853:9
  27:     0x7f1b43d771b3 - std::sys::unix::thread::Thread::new::thread_start::h8d09f4ba73ff0419
                               at /rustc/8d60bf427a4b055f464122062e76b3ec34d4f8ba/library/std/src/sys/unix/thread.rs:108:17
  28:     0x7f1b43ca7609 - start_thread
  29:     0x7f1b43bc0163 - clone
  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.61.0-nightly (8d60bf427 2022-03-19) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

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

query stack during panic:
end of query stack
error: could not compile `playground`
Backtrace

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1291:13
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: std::panic::panic_any::<rustc_errors::ExplicitBug>
   2: <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop
   3: core::ptr::drop_in_place::<rustc_session::parse::ParseSess>
   4: <alloc::rc::Rc<rustc_session::session::Session> as core::ops::drop::Drop>::drop
   5: core::ptr::drop_in_place::<rustc_interface::interface::Compiler>
   6: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
   7: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>
   8: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Playground link https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=a0836f05be8de1341876d601e7af8fa2

Note: not getting error with nightly-2022-01-01

@MendyBerger MendyBerger 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 Mar 25, 2022
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Mar 26, 2022
@SparrowLii
Copy link
Member

Statement impl Copy for u32 {} is necessary since you use #![no_core]

@MendyBerger
Copy link
Author

Thanks @SparrowLii! This seems to resolve the issue, should I close this issue or should I keep it open since the compiler shouldn't panic even in this case?

@SparrowLii
Copy link
Member

This issue appears to be a duplicate of #92495. Personally think this issue can be closed

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. glacier ICE tracked in rust-lang/glacier. 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.
Projects
None yet
Development

No branches or pull requests

3 participants