Skip to content

ICE: unreachable, drop-tracking-mir, edition=2021, generators #110929

Description

@matthiaskrgr

Code

rustc treereduce.out -Zdrop-tracking-mir=yes --edition=2021

#![feature(generators)]

fn reborrow_mutable_ref_2(x: &mut i32) {
    let mut b = || {
        let mut b = || {
        let a = &mut *x;
        yield();
        
    };
        yield();
        let mut b = || {
        let a = &mut *x;
        yield();
        
    };
    };
}

fn main() { }

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (1c42cb4ef 2023-04-26)
binary: rustc
commit-hash: 1c42cb4ef0544fbfaa500216e53382d6b079c001
commit-date: 2023-04-26
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

Error output

<output>
Backtrace

thread 'rustc' panicked at 'internal error: entered unreachable code', compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs:1362:89
stack backtrace:
   0:     0x7f7797f68e73 - std::backtrace_rs::backtrace::libunwind::trace::h0c8179e89cc9893e
                               at /rustc/1c42cb4ef0544fbfaa500216e53382d6b079c001/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f7797f68e73 - std::backtrace_rs::backtrace::trace_unsynchronized::hfadffaff9fceb6ba
                               at /rustc/1c42cb4ef0544fbfaa500216e53382d6b079c001/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f7797f68e73 - std::sys_common::backtrace::_print_fmt::ha49f609af156c4cb
                               at /rustc/1c42cb4ef0544fbfaa500216e53382d6b079c001/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f7797f68e73 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0ad104dc9ebb0bab
                               at /rustc/1c42cb4ef0544fbfaa500216e53382d6b079c001/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f7797fc9c8f - core::fmt::write::h076b507083203424
                               at /rustc/1c42cb4ef0544fbfaa500216e53382d6b079c001/library/core/src/fmt/mod.rs:1247:17
   5:     0x7f7797f5bea1 - std::io::Write::write_fmt::ha4c326e8c8c981e1
                               at /rustc/1c42cb4ef0544fbfaa500216e53382d6b079c001/library/std/src/io/mod.rs:1712:15
   6:     0x7f7797f68c85 - std::sys_common::backtrace::_print::hbc9e8503f2c8583b
                               at /rustc/1c42cb4ef0544fbfaa500216e53382d6b079c001/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f7797f68c85 - std::sys_common::backtrace::print::he24fec1d9c5516a7
                               at /rustc/1c42cb4ef0544fbfaa500216e53382d6b079c001/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f7797f6b847 - std::panicking::default_hook::{{closure}}::hf29caaf6379226a6
   9:     0x7f7797f6b635 - std::panicking::default_hook::h0765c9476c979227
                               at /rustc/1c42cb4ef0544fbfaa500216e53382d6b079c001/library/std/src/panicking.rs:288:9
  10:     0x7f779b1bf8c5 - <rustc_driver_impl[b4ece89b41fa04d8]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[a53159a38bb5d97c]::ops::function::FnOnce<(&core[a53159a38bb5d97c]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f7797f6bf85 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h7a83df3f1b1b39ec
                               at /rustc/1c42cb4ef0544fbfaa500216e53382d6b079c001/library/alloc/src/boxed.rs:1976:9
  12:     0x7f7797f6bf85 - std::panicking::rust_panic_with_hook::h060701a46b500fdf
                               at /rustc/1c42cb4ef0544fbfaa500216e53382d6b079c001/library/std/src/panicking.rs:695:13
  13:     0x7f7797f6bcb2 - std::panicking::begin_panic_handler::{{closure}}::hcfb53c4ced379f9a
                               at /rustc/1c42cb4ef0544fbfaa500216e53382d6b079c001/library/std/src/panicking.rs:580:13
  14:     0x7f7797f692b6 - std::sys_common::backtrace::__rust_end_short_backtrace::h2100286b873f9af0
                               at /rustc/1c42cb4ef0544fbfaa500216e53382d6b079c001/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7f7797f6ba52 - rust_begin_unwind
                               at /rustc/1c42cb4ef0544fbfaa500216e53382d6b079c001/library/std/src/panicking.rs:578:5
  16:     0x7f7797fc5f23 - core::panicking::panic_fmt::hcbb1fb2c2e65f651
                               at /rustc/1c42cb4ef0544fbfaa500216e53382d6b079c001/library/core/src/panicking.rs:67:14
  17:     0x7f7797fc5fbd - core::panicking::panic::h0f1d76ac12c2f1dc
                               at /rustc/1c42cb4ef0544fbfaa500216e53382d6b079c001/library/core/src/panicking.rs:117:5
  18:     0x7f779ae5e80b - <rustc_borrowck[520930393c60c739]::MirBorrowckCtxt>::suggest_using_closure_argument_instead_of_capture
  19:     0x7f779ae5d7fe - <rustc_borrowck[520930393c60c739]::MirBorrowckCtxt>::report_conflicting_borrow
  20:     0x7f7799a5eff2 - <rustc_borrowck[520930393c60c739]::MirBorrowckCtxt>::access_place
  21:     0x7f7799a4aee0 - <rustc_borrowck[520930393c60c739]::MirBorrowckCtxt as rustc_mir_dataflow[7f1b12990ef12932]::framework::visitor::ResultsVisitor>::visit_statement_before_primary_effect
  22:     0x7f7799ba9fd9 - rustc_mir_dataflow[7f1b12990ef12932]::framework::visitor::visit_results::<rustc_borrowck[520930393c60c739]::dataflow::BorrowckAnalyses<rustc_index[92c206144acc6936]::bit_set::BitSet<rustc_borrowck[520930393c60c739]::dataflow::BorrowIndex>, rustc_index[92c206144acc6936]::bit_set::ChunkedBitSet<rustc_mir_dataflow[7f1b12990ef12932]::move_paths::MovePathIndex>, rustc_index[92c206144acc6936]::bit_set::ChunkedBitSet<rustc_mir_dataflow[7f1b12990ef12932]::move_paths::InitIndex>>, rustc_borrowck[520930393c60c739]::dataflow::BorrowckAnalyses<rustc_mir_dataflow[7f1b12990ef12932]::framework::engine::Results<rustc_borrowck[520930393c60c739]::dataflow::Borrows>, rustc_mir_dataflow[7f1b12990ef12932]::framework::engine::Results<rustc_mir_dataflow[7f1b12990ef12932]::impls::MaybeUninitializedPlaces>, rustc_mir_dataflow[7f1b12990ef12932]::framework::engine::Results<rustc_mir_dataflow[7f1b12990ef12932]::impls::EverInitializedPlaces>>, core[a53159a38bb5d97c]::iter::adapters::map::Map<rustc_middle[74d31bc1c7288efd]::mir::traversal::ReversePostorderIter, rustc_borrowck[520930393c60c739]::do_mir_borrowck::{closure#2}>, rustc_borrowck[520930393c60c739]::MirBorrowckCtxt>
  23:     0x7f7799b7509b - rustc_borrowck[520930393c60c739]::do_mir_borrowck
  24:     0x7f7799b6ed55 - rustc_borrowck[520930393c60c739]::mir_borrowck
  25:     0x7f7799b6d174 - rustc_query_system[38efe1ae13b76606]::query::plumbing::try_execute_query::<rustc_query_impl[d894186be28c7657]::queries::mir_borrowck, rustc_query_impl[d894186be28c7657]::plumbing::QueryCtxt>
  26:     0x7f7799b6ce43 - <rustc_query_impl[d894186be28c7657]::Queries as rustc_middle[74d31bc1c7288efd]::ty::query::QueryEngine>::mir_borrowck
  27:     0x7f7799c5ea69 - <rustc_borrowck[520930393c60c739]::type_check::TypeChecker>::prove_closure_bounds
  28:     0x7f7799c3e2ec - <rustc_borrowck[520930393c60c739]::type_check::TypeChecker>::typeck_mir
  29:     0x7f7799bc374c - rustc_borrowck[520930393c60c739]::type_check::type_check
  30:     0x7f7799bbb05a - rustc_borrowck[520930393c60c739]::nll::compute_regions
  31:     0x7f7799b71fc3 - rustc_borrowck[520930393c60c739]::do_mir_borrowck
  32:     0x7f7799b6ed55 - rustc_borrowck[520930393c60c739]::mir_borrowck
  33:     0x7f7799b6d174 - rustc_query_system[38efe1ae13b76606]::query::plumbing::try_execute_query::<rustc_query_impl[d894186be28c7657]::queries::mir_borrowck, rustc_query_impl[d894186be28c7657]::plumbing::QueryCtxt>
  34:     0x7f779a692820 - rustc_data_structures[ecde4e0aacf74356]::sync::par_for_each_in::<&[rustc_span[5acbb0d3e38bbf81]::def_id::LocalDefId], <rustc_middle[74d31bc1c7288efd]::hir::map::Map>::par_body_owners<rustc_interface[69aa8c17999313ff]::passes::analysis::{closure#1}::{closure#0}>::{closure#0}>
  35:     0x7f779a69243e - <rustc_session[86cf650fda0448f5]::session::Session>::time::<(), rustc_interface[69aa8c17999313ff]::passes::analysis::{closure#1}>
  36:     0x7f779a69203f - rustc_interface[69aa8c17999313ff]::passes::analysis
  37:     0x7f779a93e3a2 - rustc_query_system[38efe1ae13b76606]::query::plumbing::try_execute_query::<rustc_query_impl[d894186be28c7657]::queries::analysis, rustc_query_impl[d894186be28c7657]::plumbing::QueryCtxt>
  38:     0x7f779a93e0b0 - <rustc_query_impl[d894186be28c7657]::Queries as rustc_middle[74d31bc1c7288efd]::ty::query::QueryEngine>::analysis
  39:     0x7f779a3ba90a - <rustc_middle[74d31bc1c7288efd]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[b4ece89b41fa04d8]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[a53159a38bb5d97c]::result::Result<(), rustc_span[5acbb0d3e38bbf81]::ErrorGuaranteed>>
  40:     0x7f779a3b9b48 - <rustc_interface[69aa8c17999313ff]::interface::Compiler>::enter::<rustc_driver_impl[b4ece89b41fa04d8]::run_compiler::{closure#1}::{closure#2}, core[a53159a38bb5d97c]::result::Result<core[a53159a38bb5d97c]::option::Option<rustc_interface[69aa8c17999313ff]::queries::Linker>, rustc_span[5acbb0d3e38bbf81]::ErrorGuaranteed>>
  41:     0x7f779a3b7b6f - rustc_span[5acbb0d3e38bbf81]::set_source_map::<core[a53159a38bb5d97c]::result::Result<(), rustc_span[5acbb0d3e38bbf81]::ErrorGuaranteed>, rustc_interface[69aa8c17999313ff]::interface::run_compiler<core[a53159a38bb5d97c]::result::Result<(), rustc_span[5acbb0d3e38bbf81]::ErrorGuaranteed>, rustc_driver_impl[b4ece89b41fa04d8]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  42:     0x7f779a3b7200 - std[b0e36382822581c2]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[69aa8c17999313ff]::util::run_in_thread_pool_with_globals<rustc_interface[69aa8c17999313ff]::interface::run_compiler<core[a53159a38bb5d97c]::result::Result<(), rustc_span[5acbb0d3e38bbf81]::ErrorGuaranteed>, rustc_driver_impl[b4ece89b41fa04d8]::run_compiler::{closure#1}>::{closure#0}, core[a53159a38bb5d97c]::result::Result<(), rustc_span[5acbb0d3e38bbf81]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[a53159a38bb5d97c]::result::Result<(), rustc_span[5acbb0d3e38bbf81]::ErrorGuaranteed>>
  43:     0x7f779a3b6b21 - <<std[b0e36382822581c2]::thread::Builder>::spawn_unchecked_<rustc_interface[69aa8c17999313ff]::util::run_in_thread_pool_with_globals<rustc_interface[69aa8c17999313ff]::interface::run_compiler<core[a53159a38bb5d97c]::result::Result<(), rustc_span[5acbb0d3e38bbf81]::ErrorGuaranteed>, rustc_driver_impl[b4ece89b41fa04d8]::run_compiler::{closure#1}>::{closure#0}, core[a53159a38bb5d97c]::result::Result<(), rustc_span[5acbb0d3e38bbf81]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[a53159a38bb5d97c]::result::Result<(), rustc_span[5acbb0d3e38bbf81]::ErrorGuaranteed>>::{closure#1} as core[a53159a38bb5d97c]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  44:     0x7f7797f76365 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2b4cb02d9a218e1d
                               at /rustc/1c42cb4ef0544fbfaa500216e53382d6b079c001/library/alloc/src/boxed.rs:1962:9
  45:     0x7f7797f76365 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hbd8144eacfab6e10
                               at /rustc/1c42cb4ef0544fbfaa500216e53382d6b079c001/library/alloc/src/boxed.rs:1962:9
  46:     0x7f7797f76365 - std::sys::unix::thread::Thread::new::thread_start::h95499a4b2fca6f4a
                               at /rustc/1c42cb4ef0544fbfaa500216e53382d6b079c001/library/std/src/sys/unix/thread.rs:108:17
  47:     0x7f7797cd8bb5 - <unknown>
  48:     0x7f7797d5ad90 - <unknown>
  49:                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.71.0-nightly (1c42cb4ef 2023-04-26) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z drop-tracking-mir=yes

query stack during panic:
#0 [mir_borrowck] borrow-checking `reborrow_mutable_ref_2::{closure#0}`
#1 [mir_borrowck] borrow-checking `reborrow_mutable_ref_2`
#2 [analysis] running analysis passes on this crate
end of query stack
warning: 5 warnings emitted

Activity

  1. added
    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.
    C-bugCategory: This is a bug.
    F-coroutines`#![feature(coroutines)]`
    requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.
    on Apr 28, 2023
  2. matthiaskrgr commented on Apr 28, 2023

    @matthiaskrgr
    MemberAuthor

    searched toolchains nightly-2023-04-20 through nightly-2023-04-28
    Regression in nightly-2023-04-21
    searched toolchains 39c6804 through 8bdcc62
    Regression in b9fd498
    #110061 🤔 cc @WaffleLapkin

  3. WaffleLapkin commented on Apr 28, 2023

    @WaffleLapkin
    Member

    Well, it is not unreachable it turns out huh

  4. self-assigned this
    on Apr 28, 2023
  5. WaffleLapkin commented on Apr 28, 2023

    @WaffleLapkin
    Member

    I believe this is a MRE:

    #![feature(generators)]
    
    fn main() {
        let x = &mut ();
        || {
            let _c = || yield *&mut *x;
            || _ = &mut *x;
        };
    }
  6. added 2 commits that reference this issue on Apr 28, 2023
    dd0dc9b
    235d088
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-coroutinesArea: CoroutinesC-bugCategory: This is a bug.F-coroutines`#![feature(coroutines)]`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.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions