Skip to content

GCE ICE with nested impl trait ? #118403

Closed
@bend-n

Description

@bend-n

Code

#![feature(generic_const_exprs)]
pub struct X<const N: usize> {}
impl<const Z: usize> X<Z> {
    pub fn y<'a, U: 'a>(&'a self) -> impl Iterator<Item = impl Iterator<Item = [u8; Z]> + '_> {
        (0..1).map(move |_| (0..1).map(move |_| loop {}))
    }
}

Meta

rustc --version --verbose:

rustc 1.76.0-nightly (6cf088810 2023-11-26)
binary: rustc
commit-hash: 6cf088810f66fff15d05bf7135c5f5888b7c93b4
commit-date: 2023-11-26
host: x86_64-unknown-linux-gnu
release: 1.76.0-nightly
LLVM version: 17.0.5

Error output

error: internal compiler error: compiler/rustc_borrowck/src/universal_regions.rs:823:36: cannot convert `ReEarlyParam(DefId(0:15 ~ fimg[56fb]::{impl#0}::y::{opaque#0}::'_), 3, '_)` to a region vid
Backtrace

thread 'rustc' panicked at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/compiler/rustc_errors/src/lib.rs:1659:9:
Box<dyn Any>
stack backtrace:
   0:     0x7fe84a173ae1 - std::backtrace_rs::backtrace::libunwind::trace::h971466d927277fa3
                               at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7fe84a173ae1 - std::backtrace_rs::backtrace::trace_unsynchronized::hd7767fb2a34ebeb7
                               at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fe84a173ae1 - std::backtrace::Backtrace::create::hb892135481a1b688
                               at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/std/src/backtrace.rs:332:13
   3:     0x7fe84a173a30 - std::backtrace::Backtrace::force_capture::hcc0ff36807264feb
                               at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/std/src/backtrace.rs:313:9
   4:     0x7fe84cef95bc - std[92f7436d37f6400b]::panicking::update_hook::<alloc[2cf79f262efb1c9d]::boxed::Box<rustc_driver_impl[ac0d00980e4e62ab]::install_ice_hook::{closure#0}>>::{closure#0}
   5:     0x7fe84a18ebe8 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h7be51e3dc94f2e68
                               at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/alloc/src/boxed.rs:2021:9
   6:     0x7fe84a18ebe8 - std::panicking::rust_panic_with_hook::hdda4d389ef743292
                               at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/std/src/panicking.rs:783:13
   7:     0x7fe84d339644 - std[92f7436d37f6400b]::panicking::begin_panic::<rustc_errors[211aa307c3319be2]::ExplicitBug>::{closure#0}
   8:     0x7fe84d3339a6 - std[92f7436d37f6400b]::sys_common::backtrace::__rust_end_short_backtrace::<std[92f7436d37f6400b]::panicking::begin_panic<rustc_errors[211aa307c3319be2]::ExplicitBug>::{closure#0}, !>
   9:     0x7fe84d32e806 - std[92f7436d37f6400b]::panicking::begin_panic::<rustc_errors[211aa307c3319be2]::ExplicitBug>
  10:     0x7fe84d316d94 - <rustc_errors[211aa307c3319be2]::HandlerInner>::bug::<alloc[2cf79f262efb1c9d]::string::String>
  11:     0x7fe84d316a9a - <rustc_errors[211aa307c3319be2]::Handler>::bug::<alloc[2cf79f262efb1c9d]::string::String>
  12:     0x7fe84d3b462d - rustc_middle[1557ee54da0b70b7]::util::bug::opt_span_bug_fmt::<rustc_span[9b7676b76ade8fc9]::span_encoding::Span>::{closure#0}
  13:     0x7fe84d39b66a - rustc_middle[1557ee54da0b70b7]::ty::context::tls::with_opt::<rustc_middle[1557ee54da0b70b7]::util::bug::opt_span_bug_fmt<rustc_span[9b7676b76ade8fc9]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7fe84d39b508 - rustc_middle[1557ee54da0b70b7]::ty::context::tls::with_context_opt::<rustc_middle[1557ee54da0b70b7]::ty::context::tls::with_opt<rustc_middle[1557ee54da0b70b7]::util::bug::opt_span_bug_fmt<rustc_span[9b7676b76ade8fc9]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7fe84b373ce0 - rustc_middle[1557ee54da0b70b7]::util::bug::bug_fmt
  16:     0x7fe84b6f2ecd - rustc_borrowck[7a3380052636860a]::type_check::type_check
  17:     0x7fe84b6c72a2 - rustc_borrowck[7a3380052636860a]::nll::compute_regions
  18:     0x7fe84efb840b - rustc_borrowck[7a3380052636860a]::do_mir_borrowck
  19:     0x7fe84efa8a4a - rustc_borrowck[7a3380052636860a]::mir_borrowck
  20:     0x7fe84efa84ef - rustc_query_impl[5c4dc8ec47f4c245]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5c4dc8ec47f4c245]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1557ee54da0b70b7]::query::erase::Erased<[u8; 8usize]>>
  21:     0x7fe84e78b484 - rustc_query_system[2959241e02d82320]::query::plumbing::try_execute_query::<rustc_query_impl[5c4dc8ec47f4c245]::DynamicConfig<rustc_query_system[2959241e02d82320]::query::caches::VecCache<rustc_span[9b7676b76ade8fc9]::def_id::LocalDefId, rustc_middle[1557ee54da0b70b7]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[5c4dc8ec47f4c245]::plumbing::QueryCtxt, true>
  22:     0x7fe84ed098b5 - rustc_query_impl[5c4dc8ec47f4c245]::query_impl::mir_borrowck::get_query_incr::__rust_end_short_backtrace
  23:     0x7fe84ed09e03 - rustc_interface[b8b215ac97ffc74d]::passes::analysis
  24:     0x7fe84ed098f7 - rustc_query_impl[5c4dc8ec47f4c245]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5c4dc8ec47f4c245]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1557ee54da0b70b7]::query::erase::Erased<[u8; 1usize]>>
  25:     0x7fe84f07198b - rustc_query_system[2959241e02d82320]::query::plumbing::try_execute_query::<rustc_query_impl[5c4dc8ec47f4c245]::DynamicConfig<rustc_query_system[2959241e02d82320]::query::caches::SingleCache<rustc_middle[1557ee54da0b70b7]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[5c4dc8ec47f4c245]::plumbing::QueryCtxt, true>
  26:     0x7fe84f071634 - rustc_query_impl[5c4dc8ec47f4c245]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  27:     0x7fe84f13b247 - rustc_interface[b8b215ac97ffc74d]::interface::run_compiler::<core[5c51d25db8a09f66]::result::Result<(), rustc_span[9b7676b76ade8fc9]::ErrorGuaranteed>, rustc_driver_impl[ac0d00980e4e62ab]::run_compiler::{closure#0}>::{closure#0}
  28:     0x7fe84f0ceb14 - std[92f7436d37f6400b]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b8b215ac97ffc74d]::util::run_in_thread_with_globals<rustc_interface[b8b215ac97ffc74d]::util::run_in_thread_pool_with_globals<rustc_interface[b8b215ac97ffc74d]::interface::run_compiler<core[5c51d25db8a09f66]::result::Result<(), rustc_span[9b7676b76ade8fc9]::ErrorGuaranteed>, rustc_driver_impl[ac0d00980e4e62ab]::run_compiler::{closure#0}>::{closure#0}, core[5c51d25db8a09f66]::result::Result<(), rustc_span[9b7676b76ade8fc9]::ErrorGuaranteed>>::{closure#0}, core[5c51d25db8a09f66]::result::Result<(), rustc_span[9b7676b76ade8fc9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5c51d25db8a09f66]::result::Result<(), rustc_span[9b7676b76ade8fc9]::ErrorGuaranteed>>
  29:     0x7fe84f0ce93d - <<std[92f7436d37f6400b]::thread::Builder>::spawn_unchecked_<rustc_interface[b8b215ac97ffc74d]::util::run_in_thread_with_globals<rustc_interface[b8b215ac97ffc74d]::util::run_in_thread_pool_with_globals<rustc_interface[b8b215ac97ffc74d]::interface::run_compiler<core[5c51d25db8a09f66]::result::Result<(), rustc_span[9b7676b76ade8fc9]::ErrorGuaranteed>, rustc_driver_impl[ac0d00980e4e62ab]::run_compiler::{closure#0}>::{closure#0}, core[5c51d25db8a09f66]::result::Result<(), rustc_span[9b7676b76ade8fc9]::ErrorGuaranteed>>::{closure#0}, core[5c51d25db8a09f66]::result::Result<(), rustc_span[9b7676b76ade8fc9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5c51d25db8a09f66]::result::Result<(), rustc_span[9b7676b76ade8fc9]::ErrorGuaranteed>>::{closure#1} as core[5c51d25db8a09f66]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  30:     0x7fe84a198a85 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb8a1936cb2bbfa85
                               at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/alloc/src/boxed.rs:2007:9
  31:     0x7fe84a198a85 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9073c4fb64c8bde9
                               at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/alloc/src/boxed.rs:2007:9
  32:     0x7fe84a198a85 - std::sys::unix::thread::Thread::new::thread_start::hd722b95607df8f1b
                               at /rustc/6cf088810f66fff15d05bf7135c5f5888b7c93b4/library/std/src/sys/unix/thread.rs:108:17
  33:     0x7fe849f899eb - <unknown>
  34:     0x7fe84a00d7cc - <unknown>
  35:                0x0 - <unknown>


rustc version: 1.76.0-nightly (6cf088810 2023-11-26)
platform: x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_borrowck] borrow-checking `<impl at src/lib.rs:3:1: 3:26>::y::{constant#0}`
#1 [analysis] running analysis passes on this crate
end of query stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-generic_const_exprs`#![feature(generic_const_exprs)]`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