Skip to content

ICE: 'explicit panic', compiler/rustc_ast_lowering/src/lib.rs:1173: #97193

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

extern  {
    fn a(&mut self)  {
    fn b(buf: &Self) {
}

Meta

rustc --version --verbose:

rustc 1.63.0-nightly (cd282d7f7 2022-05-18)
binary: rustc
commit-hash: cd282d7f75da9080fda0f1740a729516e7fbec68
commit-date: 2022-05-18
host: x86_64-unknown-linux-gnu
release: 1.63.0-nightly
LLVM version: 14.0.4

Error output

error: this file contains an unclosed delimiter
 --> icemaker_50911.rs:5:2
  |
1 | extern  {
  |         - unclosed delimiter
2 |     fn a(&mut self)  {
  |                      - unclosed delimiter
3 |     fn b(buf: &Self) {
  |                      - this delimiter might not be properly closed...
4 | }
  | - ...as it matches this but it has different indentation
5 |
  |  ^

error: incorrect function inside `extern` block
 --> icemaker_50911.rs:2:8
  |
1 |   extern  {
  |   ------ `extern` blocks define existing foreign functions and functions inside of them cannot have a body
2 |       fn a(&mut self)  {
  |  ________^_____________-
  | |        |
  | |        cannot have a body
3 | |     fn b(buf: &Self) {
4 | | }
5 | |
  | |_- help: remove the invalid body: `;`
  |
  = help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block
  = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html

error: `self` parameter is only allowed in associated functions
 --> icemaker_50911.rs:2:10
  |
2 |     fn a(&mut self)  {
  |          ^^^^^^^^^ not semantically valid as function parameter
  |
  = note: associated functions are those in `impl` or `trait` definitions
Backtrace

thread 'rustc' panicked at 'explicit panic', compiler/rustc_ast_lowering/src/lib.rs:1173:25
stack backtrace:
   0:     0x7f274909dfcd - std::backtrace_rs::backtrace::libunwind::trace::h792c30771d1dce4e
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f274909dfcd - std::backtrace_rs::backtrace::trace_unsynchronized::h20bd96032223b984
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f274909dfcd - std::sys_common::backtrace::_print_fmt::h55ce8a26aee332a3
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f274909dfcd - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1e608165fd05792c
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f27490f9c5c - core::fmt::write::hdc9f366f1ec7f5cc
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/core/src/fmt/mod.rs:1196:17
   5:     0x7f274908f741 - std::io::Write::write_fmt::hae36452b87a7144a
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/io/mod.rs:1654:15
   6:     0x7f27490a0ce5 - std::sys_common::backtrace::_print::hbfb86fe090e52690
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f27490a0ce5 - std::sys_common::backtrace::print::h4abb1fed1562e0f8
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f27490a0ce5 - std::panicking::default_hook::{{closure}}::hed4b61614b3d60d1
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/panicking.rs:295:22
   9:     0x7f27490a0959 - std::panicking::default_hook::h787a125a3d53fabc
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/panicking.rs:314:9
  10:     0x7f27498eab41 - rustc_driver[af3c34e99bc7132d]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f27490a14b6 - std::panicking::rust_panic_with_hook::he936e1666803a13d
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/panicking.rs:702:17
  12:     0x7f27490a1279 - std::panicking::begin_panic_handler::{{closure}}::h5330690fb8e8d9da
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/panicking.rs:586:13
  13:     0x7f274909e484 - std::sys_common::backtrace::__rust_end_short_backtrace::he03416277ca16606
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7f27490a0fe9 - rust_begin_unwind
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/panicking.rs:584:5
  15:     0x7f2749066263 - core::panicking::panic_fmt::hcb1f1aab333b06ef
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/core/src/panicking.rs:142:14
  16:     0x7f274906612d - core::panicking::panic::hd2944182965f9f6e
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/core/src/panicking.rs:48:5
  17:     0x7f274afd6777 - <rustc_ast_lowering[65fbd9c66a9cd580]::LoweringContext>::lower_ty_direct
  18:     0x7f274afd6ec9 - <rustc_ast_lowering[65fbd9c66a9cd580]::LoweringContext>::lower_fn_decl
  19:     0x7f274afcca94 - <rustc_ast_lowering[65fbd9c66a9cd580]::LoweringContext>::with_hir_id_owner::<<rustc_ast_lowering[65fbd9c66a9cd580]::item::ItemLowerer>::with_lctx<<rustc_ast_lowering[65fbd9c66a9cd580]::item::ItemLowerer>::lower_item::{closure#0}>::{closure#0}>
  20:     0x7f274aff2579 - <rustc_ast_lowering[65fbd9c66a9cd580]::item::ItemLowerer>::lower_node
  21:     0x7f274afcb71c - rustc_ast_lowering[65fbd9c66a9cd580]::lower_crate
  22:     0x7f274b9ba9d7 - <rustc_interface[3e05e90922109e97]::passes::boxed_resolver::BoxedResolver>::access::<rustc_interface[3e05e90922109e97]::passes::create_global_ctxt::{closure#0}, &rustc_hir[cf3704804b10821d]::hir::Crate>
  23:     0x7f274b9b0ae3 - rustc_interface[3e05e90922109e97]::passes::create_global_ctxt
  24:     0x7f274b9d49dd - <rustc_interface[3e05e90922109e97]::queries::Queries>::global_ctxt
  25:     0x7f274b97c962 - <rustc_interface[3e05e90922109e97]::interface::Compiler>::enter::<rustc_driver[af3c34e99bc7132d]::run_compiler::{closure#1}::{closure#2}, core[d4fcbe885e6a87a3]::result::Result<core[d4fcbe885e6a87a3]::option::Option<rustc_interface[3e05e90922109e97]::queries::Linker>, rustc_errors[8ec3179ad5714546]::ErrorGuaranteed>>
  26:     0x7f274b9a533f - rustc_span[59d1c307ce41abbc]::with_source_map::<core[d4fcbe885e6a87a3]::result::Result<(), rustc_errors[8ec3179ad5714546]::ErrorGuaranteed>, rustc_interface[3e05e90922109e97]::interface::create_compiler_and_run<core[d4fcbe885e6a87a3]::result::Result<(), rustc_errors[8ec3179ad5714546]::ErrorGuaranteed>, rustc_driver[af3c34e99bc7132d]::run_compiler::{closure#1}>::{closure#1}>
  27:     0x7f274b97d734 - rustc_interface[3e05e90922109e97]::interface::create_compiler_and_run::<core[d4fcbe885e6a87a3]::result::Result<(), rustc_errors[8ec3179ad5714546]::ErrorGuaranteed>, rustc_driver[af3c34e99bc7132d]::run_compiler::{closure#1}>
  28:     0x7f274b97aec2 - <scoped_tls[cbc0d094596bada1]::ScopedKey<rustc_span[59d1c307ce41abbc]::SessionGlobals>>::set::<rustc_interface[3e05e90922109e97]::interface::run_compiler<core[d4fcbe885e6a87a3]::result::Result<(), rustc_errors[8ec3179ad5714546]::ErrorGuaranteed>, rustc_driver[af3c34e99bc7132d]::run_compiler::{closure#1}>::{closure#0}, core[d4fcbe885e6a87a3]::result::Result<(), rustc_errors[8ec3179ad5714546]::ErrorGuaranteed>>
  29:     0x7f274b99227f - std[5ea0d33796e47bea]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[3e05e90922109e97]::util::run_in_thread_pool_with_globals<rustc_interface[3e05e90922109e97]::interface::run_compiler<core[d4fcbe885e6a87a3]::result::Result<(), rustc_errors[8ec3179ad5714546]::ErrorGuaranteed>, rustc_driver[af3c34e99bc7132d]::run_compiler::{closure#1}>::{closure#0}, core[d4fcbe885e6a87a3]::result::Result<(), rustc_errors[8ec3179ad5714546]::ErrorGuaranteed>>::{closure#0}, core[d4fcbe885e6a87a3]::result::Result<(), rustc_errors[8ec3179ad5714546]::ErrorGuaranteed>>
  30:     0x7f274b9923b9 - <<std[5ea0d33796e47bea]::thread::Builder>::spawn_unchecked_<rustc_interface[3e05e90922109e97]::util::run_in_thread_pool_with_globals<rustc_interface[3e05e90922109e97]::interface::run_compiler<core[d4fcbe885e6a87a3]::result::Result<(), rustc_errors[8ec3179ad5714546]::ErrorGuaranteed>, rustc_driver[af3c34e99bc7132d]::run_compiler::{closure#1}>::{closure#0}, core[d4fcbe885e6a87a3]::result::Result<(), rustc_errors[8ec3179ad5714546]::ErrorGuaranteed>>::{closure#0}, core[d4fcbe885e6a87a3]::result::Result<(), rustc_errors[8ec3179ad5714546]::ErrorGuaranteed>>::{closure#1} as core[d4fcbe885e6a87a3]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  31:     0x7f27490ab3d3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h80876dac74f8f7f5
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/alloc/src/boxed.rs:1872:9
  32:     0x7f27490ab3d3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9cd29f95cc73ffbe
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/alloc/src/boxed.rs:1872:9
  33:     0x7f27490ab3d3 - std::sys::unix::thread::Thread::new::thread_start::hc9488b0bdef72094
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/sys/unix/thread.rs:108:17
  34:     0x7f2748e835c2 - start_thread
  35:     0x7f2748f08584 - __clone
  36:                0x0 - <unknown>

error: internal compiler error: unexpected panic

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.63.0-nightly (cd282d7f7 2022-05-18) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to 3 previous errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions