Skip to content

ICE: still mutable #121504

Closed
Closed

Description

auto-reduced (treereduce-rust):

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

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

fn main() {}

original:

//@ check-pass
//@ edition: 2021

use std::fmt::Debug;

trait MyTrait<'a, 'b, T> {
    #[allow(async_fn_in_trait)]
    async fn foo(&'a self, key: &'b T) -> (&'a Self, &'b T) where T: Debug + Sized;
}

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

fn main() {}

Version information

rustc 1.78.0-nightly (6dadb6eb2 2024-02-23)
binary: rustc
commit-hash: 6dadb6eb23e7719da4e372d3e13d50282323d022
commit-date: 2024-02-23
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc --edition=2021

Program output

thread 'rustc' panicked at compiler/rustc_middle/src/ty/context.rs:1081:49:
still mutable
stack backtrace:
   0:     0x7f7510649af6 - std::backtrace_rs::backtrace::libunwind::trace::ha65d3ff76184bc87
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f7510649af6 - std::backtrace_rs::backtrace::trace_unsynchronized::hf7ea96d3ce514b82
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f7510649af6 - std::sys_common::backtrace::_print_fmt::hfd298e4a770e9899
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f7510649af6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2323338a86fc81c9
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f751069aa7c - core::fmt::rt::Argument::fmt::h157eaeeeb24bb72e
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/core/src/fmt/rt.rs:142:9
   5:     0x7f751069aa7c - core::fmt::write::heaac4748a4770443
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f751063e4bf - std::io::Write::write_fmt::h9259032badca1042
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/std/src/io/mod.rs:1846:15
   7:     0x7f75106498a4 - std::sys_common::backtrace::_print::hc92d5e2a4404e26e
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f75106498a4 - std::sys_common::backtrace::print::ha2a94ce768edf33a
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f751064c5eb - std::panicking::default_hook::{{closure}}::h76871112b9e556f7
  10:     0x7f751064c339 - std::panicking::default_hook::hf74de90c4b5df7a9
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/std/src/panicking.rs:292:9
  11:     0x7f750d273c9c - std[dd5750cd74b4d211]::panicking::update_hook::<alloc[3a2d298fa1f4f8a8]::boxed::Box<rustc_driver_impl[c7e2e991238ea07f]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f751064cd50 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hb795ef914b920bc4
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/alloc/src/boxed.rs:2030:9
  13:     0x7f751064cd50 - std::panicking::rust_panic_with_hook::h098a2e3444b7237d
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/std/src/panicking.rs:786:13
  14:     0x7f751064ca92 - std::panicking::begin_panic_handler::{{closure}}::h5f48db142282f4a3
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/std/src/panicking.rs:660:13
  15:     0x7f7510649fd6 - std::sys_common::backtrace::__rust_end_short_backtrace::h796b10403fb4a449
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f751064c7c4 - rust_begin_unwind
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/std/src/panicking.rs:648:5
  17:     0x7f7510696f95 - core::panicking::panic_fmt::ha9656bb7a57ce9d1
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/core/src/panicking.rs:72:14
  18:     0x7f7510697161 - core::panicking::panic_display::hb31811a514c0b471
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/core/src/panicking.rs:196:5
  19:     0x7f7510696d4b - core::panicking::panic_str::h5160a5f49cb541c1
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/core/src/panicking.rs:171:5
  20:     0x7f7510696d4b - core::option::expect_failed::h66de889988625824
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/core/src/option.rs:1994:5
  21:     0x7f750bbc0f6e - <rustc_middle[e10bafab6a476256]::ty::context::TyCtxt>::create_def
  22:     0x7f750ed83f5d - <rustc_middle[e10bafab6a476256]::query::plumbing::TyCtxtAt>::create_def
  23:     0x7f750de024b3 - rustc_ty_utils[89e9476db130c1ea]::assoc::associated_type_for_impl_trait_in_impl
  24:     0x7f750ee88367 - rustc_ty_utils[89e9476db130c1ea]::assoc::associated_types_for_impl_traits_in_associated_fn
  25:     0x7f750ee87ff4 - rustc_query_impl[57e36b29e5bd967b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[57e36b29e5bd967b]::query_impl::associated_types_for_impl_traits_in_associated_fn::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e10bafab6a476256]::query::erase::Erased<[u8; 16usize]>>
  26:     0x7f750ee87fc9 - <rustc_query_impl[57e36b29e5bd967b]::query_impl::associated_types_for_impl_traits_in_associated_fn::dynamic_query::{closure#2} as core[169382930dc0d056]::ops::function::FnOnce<(rustc_middle[e10bafab6a476256]::ty::context::TyCtxt, rustc_span[ba27dc81bf59733]::def_id::DefId)>>::call_once
  27:     0x7f750e95e480 - rustc_query_system[2e43c3a675bb3873]::query::plumbing::try_execute_query::<rustc_query_impl[57e36b29e5bd967b]::DynamicConfig<rustc_query_system[2e43c3a675bb3873]::query::caches::DefIdCache<rustc_middle[e10bafab6a476256]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[57e36b29e5bd967b]::plumbing::QueryCtxt, false>
  28:     0x7f750ee87f21 - rustc_query_impl[57e36b29e5bd967b]::query_impl::associated_types_for_impl_traits_in_associated_fn::get_query_non_incr::__rust_end_short_backtrace
  29:     0x7f750ee87d1a - rustc_middle[e10bafab6a476256]::query::plumbing::query_get_at::<rustc_query_system[2e43c3a675bb3873]::query::caches::DefIdCache<rustc_middle[e10bafab6a476256]::query::erase::Erased<[u8; 16usize]>>>
  30:     0x7f750ee8753b - rustc_arena[ebbf555319a4d9fc]::outline::<<rustc_arena[ebbf555319a4d9fc]::DroplessArena>::alloc_from_iter<rustc_span[ba27dc81bf59733]::def_id::DefId, core[169382930dc0d056]::iter::adapters::chain::Chain<core[169382930dc0d056]::iter::adapters::map::Map<core[169382930dc0d056]::slice::iter::Iter<rustc_hir[9f3737e52b7f217]::hir::ImplItemRef>, rustc_ty_utils[89e9476db130c1ea]::assoc::associated_item_def_ids::{closure#3}>, core[169382930dc0d056]::iter::adapters::flatten::FlatMap<core[169382930dc0d056]::option::Iter<rustc_hir[9f3737e52b7f217]::hir::TraitRef>, core[169382930dc0d056]::iter::adapters::copied::Copied<core[169382930dc0d056]::iter::adapters::flatten::FlatMap<core[169382930dc0d056]::iter::adapters::filter::Filter<core[169382930dc0d056]::slice::iter::Iter<rustc_hir[9f3737e52b7f217]::hir::ImplItemRef>, rustc_ty_utils[89e9476db130c1ea]::assoc::associated_item_def_ids::{closure#4}::{closure#0}>, &[rustc_span[ba27dc81bf59733]::def_id::DefId], rustc_ty_utils[89e9476db130c1ea]::assoc::associated_item_def_ids::{closure#4}::{closure#1}>>, rustc_ty_utils[89e9476db130c1ea]::assoc::associated_item_def_ids::{closure#4}>>>::{closure#0}, &mut [rustc_span[ba27dc81bf59733]::def_id::DefId]>
  31:     0x7f750e72858c - rustc_ty_utils[89e9476db130c1ea]::assoc::associated_item_def_ids
  32:     0x7f750e95e001 - rustc_query_impl[57e36b29e5bd967b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[57e36b29e5bd967b]::query_impl::associated_item_def_ids::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e10bafab6a476256]::query::erase::Erased<[u8; 16usize]>>
  33:     0x7f750e95dfd5 - <rustc_query_impl[57e36b29e5bd967b]::query_impl::associated_item_def_ids::dynamic_query::{closure#2} as core[169382930dc0d056]::ops::function::FnOnce<(rustc_middle[e10bafab6a476256]::ty::context::TyCtxt, rustc_span[ba27dc81bf59733]::def_id::DefId)>>::call_once
  34:     0x7f750e95e480 - rustc_query_system[2e43c3a675bb3873]::query::plumbing::try_execute_query::<rustc_query_impl[57e36b29e5bd967b]::DynamicConfig<rustc_query_system[2e43c3a675bb3873]::query::caches::DefIdCache<rustc_middle[e10bafab6a476256]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[57e36b29e5bd967b]::plumbing::QueryCtxt, false>
  35:     0x7f750e95dded - rustc_query_impl[57e36b29e5bd967b]::query_impl::associated_item_def_ids::get_query_non_incr::__rust_end_short_backtrace
  36:     0x7f750f630f46 - rustc_passes[c03e7a54580598e2]::dead::live_symbols_and_ignored_derived_traits
  37:     0x7f750f62f254 - rustc_query_impl[57e36b29e5bd967b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[57e36b29e5bd967b]::query_impl::live_symbols_and_ignored_derived_traits::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e10bafab6a476256]::query::erase::Erased<[u8; 8usize]>>
  38:     0x7f750f38af4e - rustc_query_system[2e43c3a675bb3873]::query::plumbing::try_execute_query::<rustc_query_impl[57e36b29e5bd967b]::DynamicConfig<rustc_query_system[2e43c3a675bb3873]::query::caches::SingleCache<rustc_middle[e10bafab6a476256]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[57e36b29e5bd967b]::plumbing::QueryCtxt, false>
  39:     0x7f750f0bd642 - rustc_query_impl[57e36b29e5bd967b]::query_impl::live_symbols_and_ignored_derived_traits::get_query_non_incr::__rust_end_short_backtrace
  40:     0x7f750f0bd7e3 - rustc_passes[c03e7a54580598e2]::dead::check_mod_deathness
  41:     0x7f750f0bd667 - rustc_query_impl[57e36b29e5bd967b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[57e36b29e5bd967b]::query_impl::check_mod_deathness::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e10bafab6a476256]::query::erase::Erased<[u8; 0usize]>>
  42:     0x7f750f21036d - rustc_query_system[2e43c3a675bb3873]::query::plumbing::try_execute_query::<rustc_query_impl[57e36b29e5bd967b]::DynamicConfig<rustc_query_system[2e43c3a675bb3873]::query::caches::DefaultCache<rustc_span[ba27dc81bf59733]::def_id::LocalModDefId, rustc_middle[e10bafab6a476256]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[57e36b29e5bd967b]::plumbing::QueryCtxt, false>
  43:     0x7f750f20bfff - rustc_query_impl[57e36b29e5bd967b]::query_impl::check_mod_deathness::get_query_non_incr::__rust_end_short_backtrace
  44:     0x7f750f2080cb - rustc_interface[4e9aee6b98c8cda]::passes::analysis
  45:     0x7f750f206e19 - rustc_query_impl[57e36b29e5bd967b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[57e36b29e5bd967b]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e10bafab6a476256]::query::erase::Erased<[u8; 1usize]>>
  46:     0x7f750f3210a5 - rustc_query_system[2e43c3a675bb3873]::query::plumbing::try_execute_query::<rustc_query_impl[57e36b29e5bd967b]::DynamicConfig<rustc_query_system[2e43c3a675bb3873]::query::caches::SingleCache<rustc_middle[e10bafab6a476256]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[57e36b29e5bd967b]::plumbing::QueryCtxt, false>
  47:     0x7f750f320e09 - rustc_query_impl[57e36b29e5bd967b]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  48:     0x7f750f3302d6 - rustc_interface[4e9aee6b98c8cda]::interface::run_compiler::<core[169382930dc0d056]::result::Result<(), rustc_span[ba27dc81bf59733]::ErrorGuaranteed>, rustc_driver_impl[c7e2e991238ea07f]::run_compiler::{closure#0}>::{closure#0}
  49:     0x7f750f5c09cd - std[dd5750cd74b4d211]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[4e9aee6b98c8cda]::util::run_in_thread_with_globals<rustc_interface[4e9aee6b98c8cda]::util::run_in_thread_pool_with_globals<rustc_interface[4e9aee6b98c8cda]::interface::run_compiler<core[169382930dc0d056]::result::Result<(), rustc_span[ba27dc81bf59733]::ErrorGuaranteed>, rustc_driver_impl[c7e2e991238ea07f]::run_compiler::{closure#0}>::{closure#0}, core[169382930dc0d056]::result::Result<(), rustc_span[ba27dc81bf59733]::ErrorGuaranteed>>::{closure#0}, core[169382930dc0d056]::result::Result<(), rustc_span[ba27dc81bf59733]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[169382930dc0d056]::result::Result<(), rustc_span[ba27dc81bf59733]::ErrorGuaranteed>>
  50:     0x7f750f5c07fa - <<std[dd5750cd74b4d211]::thread::Builder>::spawn_unchecked_<rustc_interface[4e9aee6b98c8cda]::util::run_in_thread_with_globals<rustc_interface[4e9aee6b98c8cda]::util::run_in_thread_pool_with_globals<rustc_interface[4e9aee6b98c8cda]::interface::run_compiler<core[169382930dc0d056]::result::Result<(), rustc_span[ba27dc81bf59733]::ErrorGuaranteed>, rustc_driver_impl[c7e2e991238ea07f]::run_compiler::{closure#0}>::{closure#0}, core[169382930dc0d056]::result::Result<(), rustc_span[ba27dc81bf59733]::ErrorGuaranteed>>::{closure#0}, core[169382930dc0d056]::result::Result<(), rustc_span[ba27dc81bf59733]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[169382930dc0d056]::result::Result<(), rustc_span[ba27dc81bf59733]::ErrorGuaranteed>>::{closure#1} as core[169382930dc0d056]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  51:     0x7f7510656725 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h805908c663ab5fb8
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/alloc/src/boxed.rs:2016:9
  52:     0x7f7510656725 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h42041a05506d3149
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/alloc/src/boxed.rs:2016:9
  53:     0x7f7510656725 - std::sys::pal::unix::thread::Thread::new::thread_start::h93419657116bfcaf
                               at /rustc/6dadb6eb23e7719da4e372d3e13d50282323d022/library/std/src/sys/pal/unix/thread.rs:108:17
  54:     0x7f750a2aa9eb - <unknown>
  55:     0x7f750a32e7cc - <unknown>
  56:                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.78.0-nightly (6dadb6eb2 2024-02-23) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z dump-mir-dir=dir

query stack during panic:
#0 [associated_types_for_impl_traits_in_associated_fn] creating associated items for impl trait in trait returned by `<impl at /tmp/icemaker_global_tempdir.CuM0Qo7qmTkw/rustc_testrunner_tmpdir_reporting.97qZh51fHmla/mvce.rs:5:1: 5:59>::foo`
#1 [associated_item_def_ids] collecting associated items or fields of `<impl at /tmp/icemaker_global_tempdir.CuM0Qo7qmTkw/rustc_testrunner_tmpdir_reporting.97qZh51fHmla/mvce.rs:5:1: 5:59>`
#2 [live_symbols_and_ignored_derived_traits] finding live symbols in crate
#3 [check_mod_deathness] checking deathness of variables in top-level module
#4 [analysis] running analysis passes on this crate
end of query stack
error[E0433]: failed to resolve: use of undeclared crate or module `issue_42007_s`
 --> /tmp/icemaker_global_tempdir.CuM0Qo7qmTkw/rustc_testrunner_tmpdir_reporting.97qZh51fHmla/mvce.rs:5:43
  |
5 | impl<'a, 'b, T, U> MyTrait<'a, 'b, T> for issue_42007_s::E {
  |                                           ^^^^^^^^^^^^^ use of undeclared crate or module `issue_42007_s`

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0433`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

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