Skip to content

ICE: None in error reporting #117547

Closed
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

trait MyTrait<'a, 'b, T> {
    async fn foo(&'a self) -> (&impl Fn(&'a T) -> &'b T, &'BAR T);
}

original:

trait MyTrait<'a, 'b, T> {
    async fn foo(&'a self, key: &'b T) -> (&impl Fn(&'a T) -> &'b T, &'BAR T);
}

impl<'a, 'b, T, U> MyTrait<T> for U {
    async fn foo(_: T) -> (&'a U, &'b T) {}
}

Version information

rustc 1.75.0-nightly (49112241e 2023-11-03)
binary: rustc
commit-hash: 49112241e96aaca646b1aa8ef704e494f56feed4
commit-date: 2023-11-03
host: x86_64-unknown-linux-gnu
release: 1.75.0-nightly
LLVM version: 17.0.4

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0670]: `async fn` is not permitted in Rust 2015
 --> /tmp/icemaker_global_tempdir.FQ5YsOuDDS71/rustc_testrunner_tmpdir_reporting.DZieMxzSEmg2/mvce.rs:2:5
  |
2 |     async fn foo(&'a self) -> (&impl Fn(&'a T) -> &'b T, &'BAR T);
  |     ^^^^^ to use `async fn`, switch to Rust 2018 or later
  |
  = help: pass `--edition 2021` to `rustc`
  = note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0261]: use of undeclared lifetime name `'BAR`
 --> /tmp/icemaker_global_tempdir.FQ5YsOuDDS71/rustc_testrunner_tmpdir_reporting.DZieMxzSEmg2/mvce.rs:2:59
  |
2 |     async fn foo(&'a self) -> (&impl Fn(&'a T) -> &'b T, &'BAR T);
  |                                                           ^^^^ undeclared lifetime
  |
help: consider introducing lifetime `'BAR` here
  |
2 |     async fn foo<'BAR>(&'a self) -> (&impl Fn(&'a T) -> &'b T, &'BAR T);
  |                 ++++++
help: consider introducing lifetime `'BAR` here
  |
1 | trait MyTrait<'BAR, 'a, 'b, T> {
  |               +++++

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.FQ5YsOuDDS71/rustc_testrunner_tmpdir_reporting.DZieMxzSEmg2/mvce.rs:3:2
  |
3 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.FQ5YsOuDDS71/rustc_testrunner_tmpdir_reporting.DZieMxzSEmg2/mvce.rs`

thread 'rustc' panicked at compiler/rustc_infer/src/infer/error_reporting/mod.rs:2448:78:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x7fb864b69cfc - std::backtrace_rs::backtrace::libunwind::trace::hd492889fd5a4d439
                               at /rustc/49112241e96aaca646b1aa8ef704e494f56feed4/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7fb864b69cfc - std::backtrace_rs::backtrace::trace_unsynchronized::h757636629e4693f2
                               at /rustc/49112241e96aaca646b1aa8ef704e494f56feed4/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fb864b69cfc - std::sys_common::backtrace::_print_fmt::hb74a838afa8dbae4
                               at /rustc/49112241e96aaca646b1aa8ef704e494f56feed4/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fb864b69cfc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h198243d003d81063
                               at /rustc/49112241e96aaca646b1aa8ef704e494f56feed4/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fb864bcbef0 - core::fmt::rt::Argument::fmt::h338d365e9c8df646
                               at /rustc/49112241e96aaca646b1aa8ef704e494f56feed4/library/core/src/fmt/rt.rs:142:9
   5:     0x7fb864bcbef0 - core::fmt::write::h597bb166f72974b4
                               at /rustc/49112241e96aaca646b1aa8ef704e494f56feed4/library/core/src/fmt/mod.rs:1117:17
   6:     0x7fb864b5db8f - std::io::Write::write_fmt::h259c3ecc39591f0d
                               at /rustc/49112241e96aaca646b1aa8ef704e494f56feed4/library/std/src/io/mod.rs:1763:15
   7:     0x7fb864b69ae4 - std::sys_common::backtrace::_print::hf177a9edc0c0e2ea
                               at /rustc/49112241e96aaca646b1aa8ef704e494f56feed4/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fb864b69ae4 - std::sys_common::backtrace::print::h590d2c7d9840dd3e
                               at /rustc/49112241e96aaca646b1aa8ef704e494f56feed4/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fb864b6c777 - std::panicking::default_hook::{{closure}}::h58d7e942bc65adf8
  10:     0x7fb864b6c4df - std::panicking::default_hook::h3738c0c41b965140
                               at /rustc/49112241e96aaca646b1aa8ef704e494f56feed4/library/std/src/panicking.rs:292:9
  11:     0x7fb8676ebca0 - std[bdbe1c24eb5bef4d]::panicking::update_hook::<alloc[f5baa84657c240c4]::boxed::Box<rustc_driver_impl[cb7664d07b6e8fd9]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7fb864b6ceb8 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h7ad97b6f5ddb8d26
                               at /rustc/49112241e96aaca646b1aa8ef704e494f56feed4/library/alloc/src/boxed.rs:2021:9
  13:     0x7fb864b6ceb8 - std::panicking::rust_panic_with_hook::h63d6d198afae0eeb
                               at /rustc/49112241e96aaca646b1aa8ef704e494f56feed4/library/std/src/panicking.rs:783:13
  14:     0x7fb864b6cbd9 - std::panicking::begin_panic_handler::{{closure}}::hce29ce71bc3d4030
                               at /rustc/49112241e96aaca646b1aa8ef704e494f56feed4/library/std/src/panicking.rs:649:13
  15:     0x7fb864b6a1c6 - std::sys_common::backtrace::__rust_end_short_backtrace::h1b3ea6f3d311b364
                               at /rustc/49112241e96aaca646b1aa8ef704e494f56feed4/library/std/src/sys_common/backtrace.rs:170:18
  16:     0x7fb864b6c972 - rust_begin_unwind
                               at /rustc/49112241e96aaca646b1aa8ef704e494f56feed4/library/std/src/panicking.rs:645:5
  17:     0x7fb864bc8615 - core::panicking::panic_fmt::hdd648e5e5435ab84
                               at /rustc/49112241e96aaca646b1aa8ef704e494f56feed4/library/core/src/panicking.rs:72:14
  18:     0x7fb864bc86b3 - core::panicking::panic::hcdcc8315100e7158
                               at /rustc/49112241e96aaca646b1aa8ef704e494f56feed4/library/core/src/panicking.rs:127:5
  19:     0x7fb8679681a4 - <rustc_infer[198f916d7ac38ac2]::infer::error_reporting::TypeErrCtxt>::construct_generic_bound_failure
  20:     0x7fb8679671ab - <rustc_infer[198f916d7ac38ac2]::infer::error_reporting::TypeErrCtxt>::report_generic_bound_failure
  21:     0x7fb86795c067 - <rustc_infer[198f916d7ac38ac2]::infer::error_reporting::TypeErrCtxt>::report_region_errors
  22:     0x7fb868b5c5bb - <rustc_trait_selection[e2f472d9188c6f38]::traits::engine::ObligationCtxt>::resolve_regions_and_report_errors
  23:     0x7fb86918dd70 - rustc_hir_analysis[352b3b36aad1a863]::check::wfcheck::check_associated_item
  24:     0x7fb868e37f8a - rustc_hir_analysis[352b3b36aad1a863]::check::wfcheck::check_well_formed
  25:     0x7fb868e360f9 - rustc_query_impl[13039cd447321fbd]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[13039cd447321fbd]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[57661686e6a78b08]::query::erase::Erased<[u8; 1usize]>>
  26:     0x7fb868e35c55 - rustc_query_system[e68442180a9627e2]::query::plumbing::try_execute_query::<rustc_query_impl[13039cd447321fbd]::DynamicConfig<rustc_query_system[e68442180a9627e2]::query::caches::VecCache<rustc_hir[86b9dce36696af7e]::hir_id::OwnerId, rustc_middle[57661686e6a78b08]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[13039cd447321fbd]::plumbing::QueryCtxt, false>
  27:     0x7fb868e35a17 - rustc_query_impl[13039cd447321fbd]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7fb868e35495 - rustc_hir_analysis[352b3b36aad1a863]::check::wfcheck::check_mod_type_wf
  29:     0x7fb868e35249 - rustc_query_impl[13039cd447321fbd]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[13039cd447321fbd]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[57661686e6a78b08]::query::erase::Erased<[u8; 1usize]>>
  30:     0x7fb8695051b4 - rustc_query_system[e68442180a9627e2]::query::plumbing::try_execute_query::<rustc_query_impl[13039cd447321fbd]::DynamicConfig<rustc_query_system[e68442180a9627e2]::query::caches::DefaultCache<rustc_span[d683e052c20c0040]::def_id::LocalModDefId, rustc_middle[57661686e6a78b08]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[13039cd447321fbd]::plumbing::QueryCtxt, false>
  31:     0x7fb869504f97 - rustc_query_impl[13039cd447321fbd]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7fb868c9700f - rustc_hir_analysis[352b3b36aad1a863]::check_crate
  33:     0x7fb868d7aa16 - rustc_interface[fa344a46c542b87]::passes::analysis
  34:     0x7fb868d7a435 - rustc_query_impl[13039cd447321fbd]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[13039cd447321fbd]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[57661686e6a78b08]::query::erase::Erased<[u8; 1usize]>>
  35:     0x7fb8692d3066 - rustc_query_system[e68442180a9627e2]::query::plumbing::try_execute_query::<rustc_query_impl[13039cd447321fbd]::DynamicConfig<rustc_query_system[e68442180a9627e2]::query::caches::SingleCache<rustc_middle[57661686e6a78b08]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[13039cd447321fbd]::plumbing::QueryCtxt, false>
  36:     0x7fb8692d2e95 - rustc_query_impl[13039cd447321fbd]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  37:     0x7fb8693d9b06 - rustc_interface[fa344a46c542b87]::interface::run_compiler::<core[f39681968201ba0]::result::Result<(), rustc_span[d683e052c20c0040]::ErrorGuaranteed>, rustc_driver_impl[cb7664d07b6e8fd9]::run_compiler::{closure#1}>::{closure#0}
  38:     0x7fb86973422d - std[bdbe1c24eb5bef4d]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[fa344a46c542b87]::util::run_in_thread_with_globals<rustc_interface[fa344a46c542b87]::interface::run_compiler<core[f39681968201ba0]::result::Result<(), rustc_span[d683e052c20c0040]::ErrorGuaranteed>, rustc_driver_impl[cb7664d07b6e8fd9]::run_compiler::{closure#1}>::{closure#0}, core[f39681968201ba0]::result::Result<(), rustc_span[d683e052c20c0040]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f39681968201ba0]::result::Result<(), rustc_span[d683e052c20c0040]::ErrorGuaranteed>>
  39:     0x7fb869734085 - <<std[bdbe1c24eb5bef4d]::thread::Builder>::spawn_unchecked_<rustc_interface[fa344a46c542b87]::util::run_in_thread_with_globals<rustc_interface[fa344a46c542b87]::interface::run_compiler<core[f39681968201ba0]::result::Result<(), rustc_span[d683e052c20c0040]::ErrorGuaranteed>, rustc_driver_impl[cb7664d07b6e8fd9]::run_compiler::{closure#1}>::{closure#0}, core[f39681968201ba0]::result::Result<(), rustc_span[d683e052c20c0040]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f39681968201ba0]::result::Result<(), rustc_span[d683e052c20c0040]::ErrorGuaranteed>>::{closure#1} as core[f39681968201ba0]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  40:     0x7fb864b77c25 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he245d6aecd758288
                               at /rustc/49112241e96aaca646b1aa8ef704e494f56feed4/library/alloc/src/boxed.rs:2007:9
  41:     0x7fb864b77c25 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1e98d135d523a8b5
                               at /rustc/49112241e96aaca646b1aa8ef704e494f56feed4/library/alloc/src/boxed.rs:2007:9
  42:     0x7fb864b77c25 - std::sys::unix::thread::Thread::new::thread_start::h00e820ebc9a84260
                               at /rustc/49112241e96aaca646b1aa8ef704e494f56feed4/library/std/src/sys/unix/thread.rs:108:17
  43:     0x7fb8649419eb - <unknown>
  44:     0x7fb8649c57cc - <unknown>
  45:                0x0 - <unknown>

error: 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.75.0-nightly (49112241e 2023-11-03) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_well_formed] checking that `MyTrait::foo` is well-formed
#1 [check_mod_type_wf] checking that types are well-formed in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0261, E0601, E0670.
For more information about an error, try `rustc --explain E0261`.

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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions