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

[ICE] [Nightly] Compiler panicks on anonymous lifetime in impl Trait #101660

Closed
paul-soporan opened this issue Sep 10, 2022 · 1 comment · Fixed by #103382
Closed

[ICE] [Nightly] Compiler panicks on anonymous lifetime in impl Trait #101660

paul-soporan opened this issue Sep 10, 2022 · 1 comment · Fixed by #103382
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

@paul-soporan
Copy link

Code

#![feature(anonymous_lifetime_in_impl_trait)]

trait Foo<T> {
    fn bar(self, baz: T);
}

fn qux(foo: impl Foo<&str>) {
    |baz: &str| foo.bar(baz);
}

This is the most minimal example I could come up with. It works if I get rid of the : &str in baz: &str.

Meta

rustc --version --verbose:

rustc 1.65.0-nightly (1d37ed661 2022-09-09)
binary: rustc
commit-hash: 1d37ed661a6922e7a167609b8cd7eb31e972b19b
commit-date: 2022-09-09
host: x86_64-unknown-linux-gnu
release: 1.65.0-nightly
LLVM version: 15.0.0

Error output

(The full output is in the backtrace section)

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_borrowck/src/diagnostics/region_errors.rs:631:47

[...]

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

error: internal compiler error: `InferCtxt` incorrectly tainted by errors
  |
  = note: delayed at compiler/rustc_infer/src/infer/mod.rs:1264:27
Backtrace

➜  rustc-bug git:(master) ✗ cargo build
   Compiling rustc-bug v0.1.0 (/mnt/projects/git/rustc-bug)
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_borrowck/src/diagnostics/region_errors.rs:631:47
stack backtrace:
   0:     0x7f1cc8e58eb0 - std::backtrace_rs::backtrace::libunwind::trace::h134b013ea56868ec
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7f1cc8e58eb0 - std::backtrace_rs::backtrace::trace_unsynchronized::h85519da7927ab55d
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f1cc8e58eb0 - std::sys_common::backtrace::_print_fmt::hd53e324e4c5c4797
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f1cc8e58eb0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he7ebdae3b4539151
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f1cc8eb3efe - core::fmt::write::h533f83a763826dcd
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/core/src/fmt/mod.rs:1202:17
   5:     0x7f1cc8e49795 - std::io::Write::write_fmt::hdf475e0edabf6618
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/io/mod.rs:1679:15
   6:     0x7f1cc8e5bb63 - std::sys_common::backtrace::_print::h18929d2d3a122c2e
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f1cc8e5bb63 - std::sys_common::backtrace::print::heeac666312b0f106
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f1cc8e5bb63 - std::panicking::default_hook::{{closure}}::h691c919edee7ee4f
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/panicking.rs:295:22
   9:     0x7f1cc8e5b84f - std::panicking::default_hook::h4d42a88885d5436b
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/panicking.rs:314:9
  10:     0x7f1ccb6cc8c1 - <rustc_driver[d98f0e6bb6d3ec36]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[7554d75f727e5dc5]::ops::function::FnOnce<(&core[7554d75f727e5dc5]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f1cc8e5c39d - std::panicking::rust_panic_with_hook::h047e9ae9d3b70dff
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/panicking.rs:702:17
  12:     0x7f1cc8e5c1b1 - std::panicking::begin_panic_handler::{{closure}}::hfe5deddff7ce3f84
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/panicking.rs:586:13
  13:     0x7f1cc8e5935c - std::sys_common::backtrace::__rust_end_short_backtrace::h2534c34f27aaf3c3
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7f1cc8e5bf12 - rust_begin_unwind
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/panicking.rs:584:5
  15:     0x7f1cc8eb0ad3 - core::panicking::panic_fmt::h7c2848f37f3b2512
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/core/src/panicking.rs:142:14
  16:     0x7f1cc8eb091d - core::panicking::panic::ha5d9951777c83f58
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/core/src/panicking.rs:48:5
  17:     0x7f1cca60a6a1 - rustc_borrowck[f527ff9aa6c9edc3]::do_mir_borrowck
  18:     0x7f1ccb0cef76 - rustc_borrowck[f527ff9aa6c9edc3]::mir_borrowck
  19:     0x7f1ccb0ce6f1 - <rustc_borrowck[f527ff9aa6c9edc3]::provide::{closure#0} as core[7554d75f727e5dc5]::ops::function::FnOnce<(rustc_middle[5ec0a2377659145d]::ty::context::TyCtxt, rustc_span[3ca79a2f950a640c]::def_id::LocalDefId)>>::call_once
  20:     0x7f1ccac09b6d - <rustc_query_system[bca4d9faa69393e7]::dep_graph::graph::DepGraph<rustc_middle[5ec0a2377659145d]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[5ec0a2377659145d]::ty::context::TyCtxt, rustc_span[3ca79a2f950a640c]::def_id::LocalDefId, &rustc_middle[5ec0a2377659145d]::mir::query::BorrowCheckResult>
  21:     0x7f1ccac08d94 - rustc_query_system[bca4d9faa69393e7]::query::plumbing::try_execute_query::<rustc_query_impl[856212b54321fa84]::plumbing::QueryCtxt, rustc_query_system[bca4d9faa69393e7]::query::caches::DefaultCache<rustc_span[3ca79a2f950a640c]::def_id::LocalDefId, &rustc_middle[5ec0a2377659145d]::mir::query::BorrowCheckResult>>
  22:     0x7f1ccb606cc5 - <rustc_query_impl[856212b54321fa84]::Queries as rustc_middle[5ec0a2377659145d]::ty::query::QueryEngine>::mir_borrowck
  23:     0x7f1cca6f2211 - <rustc_borrowck[f527ff9aa6c9edc3]::type_check::TypeChecker>::prove_closure_bounds
  24:     0x7f1cca6d4bc3 - <rustc_borrowck[f527ff9aa6c9edc3]::type_check::TypeChecker>::typeck_mir
  25:     0x7f1cca6583a8 - rustc_borrowck[f527ff9aa6c9edc3]::nll::compute_regions
  26:     0x7f1cca600f5a - rustc_borrowck[f527ff9aa6c9edc3]::do_mir_borrowck
  27:     0x7f1ccb0cef76 - rustc_borrowck[f527ff9aa6c9edc3]::mir_borrowck
  28:     0x7f1ccb0ce6f1 - <rustc_borrowck[f527ff9aa6c9edc3]::provide::{closure#0} as core[7554d75f727e5dc5]::ops::function::FnOnce<(rustc_middle[5ec0a2377659145d]::ty::context::TyCtxt, rustc_span[3ca79a2f950a640c]::def_id::LocalDefId)>>::call_once
  29:     0x7f1ccac09b6d - <rustc_query_system[bca4d9faa69393e7]::dep_graph::graph::DepGraph<rustc_middle[5ec0a2377659145d]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[5ec0a2377659145d]::ty::context::TyCtxt, rustc_span[3ca79a2f950a640c]::def_id::LocalDefId, &rustc_middle[5ec0a2377659145d]::mir::query::BorrowCheckResult>
  30:     0x7f1ccac08d94 - rustc_query_system[bca4d9faa69393e7]::query::plumbing::try_execute_query::<rustc_query_impl[856212b54321fa84]::plumbing::QueryCtxt, rustc_query_system[bca4d9faa69393e7]::query::caches::DefaultCache<rustc_span[3ca79a2f950a640c]::def_id::LocalDefId, &rustc_middle[5ec0a2377659145d]::mir::query::BorrowCheckResult>>
  31:     0x7f1ccb606cc5 - <rustc_query_impl[856212b54321fa84]::Queries as rustc_middle[5ec0a2377659145d]::ty::query::QueryEngine>::mir_borrowck
  32:     0x7f1ccaa186e3 - rustc_data_structures[a88d71faf1e0b01c]::sync::par_for_each_in::<&[rustc_span[3ca79a2f950a640c]::def_id::LocalDefId], <rustc_middle[5ec0a2377659145d]::hir::map::Map>::par_body_owners<rustc_interface[b8431be2dc9777a]::passes::analysis::{closure#2}::{closure#0}>::{closure#0}>
  33:     0x7f1ccaa18443 - <rustc_session[79f725fc979de867]::session::Session>::time::<(), rustc_interface[b8431be2dc9777a]::passes::analysis::{closure#2}>
  34:     0x7f1ccaa15a45 - rustc_interface[b8431be2dc9777a]::passes::analysis
  35:     0x7f1ccb4a8472 - <rustc_query_system[bca4d9faa69393e7]::dep_graph::graph::DepGraph<rustc_middle[5ec0a2377659145d]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[5ec0a2377659145d]::ty::context::TyCtxt, (), core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>
  36:     0x7f1ccb4a7b3a - rustc_query_system[bca4d9faa69393e7]::query::plumbing::try_execute_query::<rustc_query_impl[856212b54321fa84]::plumbing::QueryCtxt, rustc_query_system[bca4d9faa69393e7]::query::caches::DefaultCache<(), core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>>
  37:     0x7f1ccb4a75fc - rustc_query_system[bca4d9faa69393e7]::query::plumbing::get_query::<rustc_query_impl[856212b54321fa84]::queries::analysis, rustc_query_impl[856212b54321fa84]::plumbing::QueryCtxt>
  38:     0x7f1cca4992b7 - <rustc_interface[b8431be2dc9777a]::passes::QueryContext>::enter::<rustc_driver[d98f0e6bb6d3ec36]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>
  39:     0x7f1cca48ccec - rustc_interface[b8431be2dc9777a]::interface::create_compiler_and_run::<core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>, rustc_driver[d98f0e6bb6d3ec36]::run_compiler::{closure#1}>
  40:     0x7f1cca48b631 - <scoped_tls[a530c759821a22c4]::ScopedKey<rustc_span[3ca79a2f950a640c]::SessionGlobals>>::set::<rustc_interface[b8431be2dc9777a]::interface::run_compiler<core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>, rustc_driver[d98f0e6bb6d3ec36]::run_compiler::{closure#1}>::{closure#0}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>
  41:     0x7f1cca48b31f - std[d1a185ff54d98716]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b8431be2dc9777a]::util::run_in_thread_pool_with_globals<rustc_interface[b8431be2dc9777a]::interface::run_compiler<core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>, rustc_driver[d98f0e6bb6d3ec36]::run_compiler::{closure#1}>::{closure#0}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>::{closure#0}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>
  42:     0x7f1ccb5355c0 - <<std[d1a185ff54d98716]::thread::Builder>::spawn_unchecked_<rustc_interface[b8431be2dc9777a]::util::run_in_thread_pool_with_globals<rustc_interface[b8431be2dc9777a]::interface::run_compiler<core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>, rustc_driver[d98f0e6bb6d3ec36]::run_compiler::{closure#1}>::{closure#0}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>::{closure#0}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>::{closure#1} as core[7554d75f727e5dc5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  43:     0x7f1cc8e66173 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hddcbc9655423aa50
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/alloc/src/boxed.rs:1940:9
  44:     0x7f1cc8e66173 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h074e83f188f31ba5
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/alloc/src/boxed.rs:1940:9
  45:     0x7f1cc8e66173 - std::sys::unix::thread::Thread::new::thread_start::h7d9ec4c6a6f5322e
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/sys/unix/thread.rs:108:17
  46:     0x7f1cc8b9d54d - <unknown>
  47:     0x7f1cc8c22874 - clone
  48:                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.65.0-nightly (1d37ed661 2022-09-09) running on x86_64-unknown-linux-gnu

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

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

query stack during panic:
#0 [mir_borrowck] borrow-checking `qux::{closure#0}`
#1 [mir_borrowck] borrow-checking `qux`
#2 [analysis] running analysis passes on this crate
end of query stack
error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: `InferCtxt` incorrectly tainted by errors
  |
  = note: delayed at compiler/rustc_infer/src/infer/mod.rs:1264:27

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1494:13
stack backtrace:
   0:     0x7f1cc8e58eb0 - std::backtrace_rs::backtrace::libunwind::trace::h134b013ea56868ec
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7f1cc8e58eb0 - std::backtrace_rs::backtrace::trace_unsynchronized::h85519da7927ab55d
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f1cc8e58eb0 - std::sys_common::backtrace::_print_fmt::hd53e324e4c5c4797
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f1cc8e58eb0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he7ebdae3b4539151
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f1cc8eb3efe - core::fmt::write::h533f83a763826dcd
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/core/src/fmt/mod.rs:1202:17
   5:     0x7f1cc8e49795 - std::io::Write::write_fmt::hdf475e0edabf6618
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/io/mod.rs:1679:15
   6:     0x7f1cc8e5bb63 - std::sys_common::backtrace::_print::h18929d2d3a122c2e
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f1cc8e5bb63 - std::sys_common::backtrace::print::heeac666312b0f106
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f1cc8e5bb63 - std::panicking::default_hook::{{closure}}::h691c919edee7ee4f
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/panicking.rs:295:22
   9:     0x7f1cc8e5b84f - std::panicking::default_hook::h4d42a88885d5436b
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/panicking.rs:314:9
  10:     0x7f1ccb6cc8c1 - <rustc_driver[d98f0e6bb6d3ec36]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[7554d75f727e5dc5]::ops::function::FnOnce<(&core[7554d75f727e5dc5]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f1cc8e5c39d - std::panicking::rust_panic_with_hook::h047e9ae9d3b70dff
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/panicking.rs:702:17
  12:     0x7f1ccc822d61 - std[d1a185ff54d98716]::panicking::begin_panic::<rustc_errors[623939cad04cb150]::ExplicitBug>::{closure#0}
  13:     0x7f1ccc8228a6 - std[d1a185ff54d98716]::sys_common::backtrace::__rust_end_short_backtrace::<std[d1a185ff54d98716]::panicking::begin_panic<rustc_errors[623939cad04cb150]::ExplicitBug>::{closure#0}, !>
  14:     0x7f1ccc822866 - std[d1a185ff54d98716]::panicking::begin_panic::<rustc_errors[623939cad04cb150]::ExplicitBug>
  15:     0x7f1ccc825676 - std[d1a185ff54d98716]::panic::panic_any::<rustc_errors[623939cad04cb150]::ExplicitBug>
  16:     0x7f1ccb22f7d8 - <rustc_errors[623939cad04cb150]::HandlerInner as core[7554d75f727e5dc5]::ops::drop::Drop>::drop
  17:     0x7f1cca4d4ea8 - core[7554d75f727e5dc5]::ptr::drop_in_place::<rustc_session[79f725fc979de867]::parse::ParseSess>
  18:     0x7f1cca492908 - <alloc[b78997af7b72d6fd]::rc::Rc<rustc_session[79f725fc979de867]::session::Session> as core[7554d75f727e5dc5]::ops::drop::Drop>::drop
  19:     0x7f1cca48f8cd - core[7554d75f727e5dc5]::ptr::drop_in_place::<rustc_interface[b8431be2dc9777a]::interface::Compiler>
  20:     0x7f1cca48db41 - rustc_interface[b8431be2dc9777a]::interface::create_compiler_and_run::<core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>, rustc_driver[d98f0e6bb6d3ec36]::run_compiler::{closure#1}>
  21:     0x7f1cca48b631 - <scoped_tls[a530c759821a22c4]::ScopedKey<rustc_span[3ca79a2f950a640c]::SessionGlobals>>::set::<rustc_interface[b8431be2dc9777a]::interface::run_compiler<core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>, rustc_driver[d98f0e6bb6d3ec36]::run_compiler::{closure#1}>::{closure#0}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>
  22:     0x7f1cca48b31f - std[d1a185ff54d98716]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b8431be2dc9777a]::util::run_in_thread_pool_with_globals<rustc_interface[b8431be2dc9777a]::interface::run_compiler<core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>, rustc_driver[d98f0e6bb6d3ec36]::run_compiler::{closure#1}>::{closure#0}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>::{closure#0}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>
  23:     0x7f1ccb5355c0 - <<std[d1a185ff54d98716]::thread::Builder>::spawn_unchecked_<rustc_interface[b8431be2dc9777a]::util::run_in_thread_pool_with_globals<rustc_interface[b8431be2dc9777a]::interface::run_compiler<core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>, rustc_driver[d98f0e6bb6d3ec36]::run_compiler::{closure#1}>::{closure#0}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>::{closure#0}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>::{closure#1} as core[7554d75f727e5dc5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  24:     0x7f1cc8e66173 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hddcbc9655423aa50
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/alloc/src/boxed.rs:1940:9
  25:     0x7f1cc8e66173 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h074e83f188f31ba5
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/alloc/src/boxed.rs:1940:9
  26:     0x7f1cc8e66173 - std::sys::unix::thread::Thread::new::thread_start::h7d9ec4c6a6f5322e
                               at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/sys/unix/thread.rs:108:17
  27:     0x7f1cc8b9d54d - <unknown>
  28:     0x7f1cc8c22874 - clone
  29:                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 (1d37ed661 2022-09-09) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -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
thread panicked while panicking. aborting.
error: could not compile `rustc-bug`

Caused by:
  process didn't exit successfully: `rustc --crate-name rustc_bug --edition=2021 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=e3283b22fa7dac88 -C extra-filename=-e3283b22fa7dac88 --out-dir /mnt/projects/git/rustc-bug/target/debug/deps -C incremental=/mnt/projects/git/rustc-bug/target/debug/incremental -L dependency=/mnt/projects/git/rustc-bug/target/debug/deps` (signal: 6, SIGABRT: process abort signal)

@paul-soporan paul-soporan 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 Sep 10, 2022
@paul-soporan
Copy link
Author

Looks like the following crashes too, so the closure isn't actually required:

#![feature(anonymous_lifetime_in_impl_trait)]

trait Foo<T> {
    fn bar(self, baz: T);
}

fn qux(foo: impl Foo<&str>, baz: &str) {
    foo.bar(baz);
}

@paul-soporan paul-soporan changed the title [ICE] [Nightly] Compiler crashes when on anonymous lifetime in impl Trait [ICE] [Nightly] Compiler crashes on anonymous lifetime in impl Trait Sep 10, 2022
@paul-soporan paul-soporan changed the title [ICE] [Nightly] Compiler crashes on anonymous lifetime in impl Trait [ICE] [Nightly] Compiler panicks on anonymous lifetime in impl Trait Sep 10, 2022
matthiaskrgr added a commit to matthiaskrgr/glacier that referenced this issue Sep 11, 2022
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Sep 11, 2022
JohnTitor pushed a commit to JohnTitor/rust that referenced this issue Oct 24, 2022
…n-ice, r=cjgillot

Don't ICE when reporting borrowck errors involving regions from `anonymous_lifetime_in_impl_trait`

The issue here is that when we have:

```
trait Trait<'a> { .. }

fn foo(arg: impl Trait) { .. }
```

The anonymous lifetime `'_` that we generate for `arg: impl Trait` doesn't end up in the argument type (which is a param) but in a where-clause of the function, in a predicate whose self type is that param ty.

Fixes rust-lang#101660

r? `@cjgillot`
@bors bors closed this as completed in 6383540 Oct 25, 2022
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
2 participants