Skip to content

ICE: missing resolution lifetime #97194

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

extern "" {
    fn bget(&self, index: [usize; Self::DIM]) -> bool {
    type T;
    type T<'a> = &'a str;
}


fn main() {}

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
 --> bad.rs:8:14
  |
1 | extern "" {
  |           - unclosed delimiter
2 |     fn bget(&self, index: [usize; Self::DIM]) -> bool {
  |                                                       - this delimiter might not be properly closed...
...
5 | }
  | - ...as it matches this but it has different indentation
...
8 | fn main() {}
  |              ^

error[E0428]: the name `T` is defined multiple times
 --> bad.rs:4:5
  |
3 |     type T;
  |     ------- previous definition of the type `T` here
4 |     type T<'a> = &'a str;
  |     ^^^^^^^^^^^^^^^^^^^^^ `T` redefined here
  |
  = note: `T` must be defined only once in the type namespace of this block

error: incorrect function inside `extern` block
 --> bad.rs:2:8
  |
1 |   extern "" {
  |   --------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body
2 |       fn bget(&self, index: [usize; Self::DIM]) -> bool {
  |  ________^^^^___________________________________________-
  | |        |
  | |        cannot have a body
3 | |     type T;
4 | |     type T<'a> = &'a str;
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
 --> bad.rs:2:13
  |
2 |     fn bget(&self, index: [usize; Self::DIM]) -> bool {
  |             ^^^^^ not semantically valid as function parameter
  |
  = note: associated functions are those in `impl` or `trait` definitions

error: free type alias without body
 --> bad.rs:3:5
  |
3 |     type T;
  |     ^^^^^^-
  |           |
  |           help: provide a definition for the type: `= <type>;`

error: incorrect function inside `extern` block
 --> bad.rs:8:4
  |
1 | extern "" {
  | --------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body
...
8 | fn main() {}
  |    ^^^^   -- help: remove the invalid body: `;`
  |    |
  |    cannot have a 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[E0433]: failed to resolve: use of undeclared type `Self`
 --> bad.rs:2:35
  |
2 |     fn bget(&self, index: [usize; Self::DIM]) -> bool {
  |                                   ^^^^ use of undeclared type `Self`

error[E0703]: invalid ABI: found ``
 --> bad.rs:1:8
  |
1 | extern "" {
  |        ^^ invalid ABI
  |
  = help: valid ABIs: Rust, C, C-unwind, cdecl, cdecl-unwind, stdcall, stdcall-unwind, fastcall, fastcall-unwind, vectorcall, vectorcall-unwind, thiscall, thiscall-unwind, aapcs, aapcs-unwind, win64, win64-unwind, sysv64, sysv64-unwind, ptx-kernel, msp430-interrupt, x86-interrupt, amdgpu-kernel, efiapi, avr-interrupt, avr-non-blocking-interrupt, C-cmse-nonsecure-call, wasm, system, system-unwind, rust-intrinsic, rust-call, platform-intrinsic, unadjusted
Backtrace

thread 'rustc' panicked at 'Missing resolution for lifetime lifetime(33: 'a) at bad.rs:4:19: 4:21 (#0)', compiler/rustc_ast_lowering/src/lib.rs:1842:32
stack backtrace:
   0:     0x7f795469dfcd - std::backtrace_rs::backtrace::libunwind::trace::h792c30771d1dce4e
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f795469dfcd - std::backtrace_rs::backtrace::trace_unsynchronized::h20bd96032223b984
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f795469dfcd - std::sys_common::backtrace::_print_fmt::h55ce8a26aee332a3
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f795469dfcd - <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:     0x7f79546f9c5c - core::fmt::write::hdc9f366f1ec7f5cc
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/core/src/fmt/mod.rs:1196:17
   5:     0x7f795468f741 - std::io::Write::write_fmt::hae36452b87a7144a
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/io/mod.rs:1654:15
   6:     0x7f79546a0ce5 - std::sys_common::backtrace::_print::hbfb86fe090e52690
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f79546a0ce5 - std::sys_common::backtrace::print::h4abb1fed1562e0f8
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f79546a0ce5 - std::panicking::default_hook::{{closure}}::hed4b61614b3d60d1
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/panicking.rs:295:22
   9:     0x7f79546a0959 - std::panicking::default_hook::h787a125a3d53fabc
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/panicking.rs:314:9
  10:     0x7f7954eeab41 - rustc_driver[af3c34e99bc7132d]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f79546a14b6 - std::panicking::rust_panic_with_hook::he936e1666803a13d
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/panicking.rs:702:17
  12:     0x7f79546a12b7 - std::panicking::begin_panic_handler::{{closure}}::h5330690fb8e8d9da
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/panicking.rs:588:13
  13:     0x7f795469e484 - std::sys_common::backtrace::__rust_end_short_backtrace::he03416277ca16606
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7f79546a0fe9 - rust_begin_unwind
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/panicking.rs:584:5
  15:     0x7f7954666263 - core::panicking::panic_fmt::hcb1f1aab333b06ef
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/core/src/panicking.rs:142:14
  16:     0x7f79565d670d - <rustc_ast_lowering[65fbd9c66a9cd580]::LoweringContext>::lower_ty_direct
  17:     0x7f79565cd24f - <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}>
  18:     0x7f79565f2579 - <rustc_ast_lowering[65fbd9c66a9cd580]::item::ItemLowerer>::lower_node
  19:     0x7f79565cb71c - rustc_ast_lowering[65fbd9c66a9cd580]::lower_crate
  20:     0x7f7956fba9d7 - <rustc_interface[3e05e90922109e97]::passes::boxed_resolver::BoxedResolver>::access::<rustc_interface[3e05e90922109e97]::passes::create_global_ctxt::{closure#0}, &rustc_hir[cf3704804b10821d]::hir::Crate>
  21:     0x7f7956fb0ae3 - rustc_interface[3e05e90922109e97]::passes::create_global_ctxt
  22:     0x7f7956fd49dd - <rustc_interface[3e05e90922109e97]::queries::Queries>::global_ctxt
  23:     0x7f7956f7c962 - <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>>
  24:     0x7f7956fa533f - 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}>
  25:     0x7f7956f7d734 - rustc_interface[3e05e90922109e97]::interface::create_compiler_and_run::<core[d4fcbe885e6a87a3]::result::Result<(), rustc_errors[8ec3179ad5714546]::ErrorGuaranteed>, rustc_driver[af3c34e99bc7132d]::run_compiler::{closure#1}>
  26:     0x7f7956f7aec2 - <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>>
  27:     0x7f7956f9227f - 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>>
  28:     0x7f7956f923b9 - <<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}
  29:     0x7f79546ab3d3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h80876dac74f8f7f5
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/alloc/src/boxed.rs:1872:9
  30:     0x7f79546ab3d3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9cd29f95cc73ffbe
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/alloc/src/boxed.rs:1872:9
  31:     0x7f79546ab3d3 - std::sys::unix::thread::Thread::new::thread_start::hc9488b0bdef72094
                               at /rustc/cd282d7f75da9080fda0f1740a729516e7fbec68/library/std/src/sys/unix/thread.rs:108:17
  32:     0x7f79544835c2 - start_thread
  33:     0x7f7954508584 - __clone
  34:                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 8 previous errors

Some errors have detailed explanations: E0428, E0433, E0703.
For more information about an error, try `rustc --explain E0428`.

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