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: cannot convert ReFree to a region vid #111433

Closed
matthiaskrgr opened this issue May 10, 2023 · 9 comments
Closed

ICE: cannot convert ReFree to a region vid #111433

matthiaskrgr opened this issue May 10, 2023 · 9 comments
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. F-generic_const_exprs `#![feature(generic_const_exprs)]` 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

@matthiaskrgr
Copy link
Member

Code

./tests/ui/const-generics/late-bound-vars/simple.rs

#![feature(generic_const_exprs)]
#![allow(incomplete_features)]

const fn inner<'a>() -> usize where &'a (): Sized {
    3
}

fn test<'a>() {
    let _: [u8; inner::<'a>()];
    let _ = [0; inner::<'a>()];
}

fn main() {
    test();
}

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (2f6bc5d25 2023-05-09)
binary: rustc
commit-hash: 2f6bc5d259e7ab25ddfdd33de53b892770218918
commit-date: 2023-05-09
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

Error output

<output>
Backtrace

error: internal compiler error: compiler/rustc_borrowck/src/universal_regions.rs:882:36: cannot convert `ReFree(DefId(0:5 ~ simple[493b]::test), BrNamed(DefId(0:6 ~ simple[493b]::test::'a), 'a))` to a region vid

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/compiler/rustc_errors/src/lib.rs:1650:9
stack backtrace:
   0:     0x7fe9b4d6a3b1 - std::backtrace_rs::backtrace::libunwind::trace::h6e5b7e23399032cc
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fe9b4d6a3b1 - std::backtrace_rs::backtrace::trace_unsynchronized::h4528c06bee1e0a8b
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fe9b4d6a3b1 - std::sys_common::backtrace::_print_fmt::h8c8479101d563d31
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fe9b4d6a3b1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf3690daedd46952c
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fe9b4dca80f - core::fmt::rt::Argument::fmt::h79448537abb02c02
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/core/src/fmt/rt.rs:138:9
   5:     0x7fe9b4dca80f - core::fmt::write::hb7b70c241601eb54
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/core/src/fmt/mod.rs:1094:21
   6:     0x7fe9b4d5d611 - std::io::Write::write_fmt::h2b40bdf00a46cf42
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/io/mod.rs:1712:15
   7:     0x7fe9b4d6a1c5 - std::sys_common::backtrace::_print::h264fd8ac10e4d719
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fe9b4d6a1c5 - std::sys_common::backtrace::print::h6190a4e08057accf
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fe9b4d6ce47 - std::panicking::default_hook::{{closure}}::h1fcb6a5fbc17c145
  10:     0x7fe9b4d6cc34 - std::panicking::default_hook::h1d4472ea1534e7eb
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/panicking.rs:288:9
  11:     0x7fe9b7fd3cdb - <rustc_driver_impl[ce322c91000f3e2b]::install_ice_hook::{closure#0} as core[7de8eb2b24556be4]::ops::function::FnOnce<(&core[7de8eb2b24556be4]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  12:     0x7fe9b4d6d567 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h05757514719e9e39
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/alloc/src/boxed.rs:1999:9
  13:     0x7fe9b4d6d567 - std::panicking::rust_panic_with_hook::h26983c5985cc3d7d
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/panicking.rs:695:13
  14:     0x7fe9b84c1321 - std[bc31d8d7a4b25d9b]::panicking::begin_panic::<rustc_errors[f17d5d6c3485e527]::ExplicitBug>::{closure#0}
  15:     0x7fe9b84beea6 - std[bc31d8d7a4b25d9b]::sys_common::backtrace::__rust_end_short_backtrace::<std[bc31d8d7a4b25d9b]::panicking::begin_panic<rustc_errors[f17d5d6c3485e527]::ExplicitBug>::{closure#0}, !>
  16:     0x7fe9b84beb46 - std[bc31d8d7a4b25d9b]::panicking::begin_panic::<rustc_errors[f17d5d6c3485e527]::ExplicitBug>
  17:     0x7fe9b84b99e4 - <rustc_errors[f17d5d6c3485e527]::HandlerInner>::bug::<alloc[62a5dcc9069c15c8]::string::String>
  18:     0x7fe9b84b9716 - <rustc_errors[f17d5d6c3485e527]::Handler>::bug::<alloc[62a5dcc9069c15c8]::string::String>
  19:     0x7fe9b85521ec - rustc_middle[b96152969e862739]::util::bug::opt_span_bug_fmt::<rustc_span[feb72a2200ed999]::span_encoding::Span>::{closure#0}
  20:     0x7fe9b8551b2a - rustc_middle[b96152969e862739]::ty::context::tls::with_opt::<rustc_middle[b96152969e862739]::util::bug::opt_span_bug_fmt<rustc_span[feb72a2200ed999]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7fe9b8551afa - rustc_middle[b96152969e862739]::ty::context::tls::with_context_opt::<rustc_middle[b96152969e862739]::ty::context::tls::with_opt<rustc_middle[b96152969e862739]::util::bug::opt_span_bug_fmt<rustc_span[feb72a2200ed999]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7fe9b6207a3d - rustc_middle[b96152969e862739]::util::bug::bug_fmt
  23:     0x7fe9b6fb2da3 - <rustc_borrowck[870b2eadfe30ec99]::type_check::constraint_conversion::ConstraintConversion>::convert_all
  24:     0x7fe9b6f23c85 - <rustc_borrowck[870b2eadfe30ec99]::type_check::TypeChecker>::ascribe_user_type
  25:     0x7fe9b6f1af86 - rustc_borrowck[870b2eadfe30ec99]::nll::compute_regions
  26:     0x7fe9b6ec82bc - rustc_borrowck[870b2eadfe30ec99]::do_mir_borrowck
  27:     0x7fe9b6ec4a12 - rustc_borrowck[870b2eadfe30ec99]::mir_borrowck
  28:     0x7fe9b6ec2dc8 - rustc_query_system[180594c788319d08]::query::plumbing::try_execute_query::<rustc_query_impl[ff2244d0f49f60a1]::queries::mir_borrowck, rustc_query_impl[ff2244d0f49f60a1]::plumbing::QueryCtxt>
  29:     0x7fe9b6ec2ab0 - rustc_query_impl[ff2244d0f49f60a1]::get_query::mir_borrowck
  30:     0x7fe9b69e5180 - rustc_mir_transform[30e93fa49ed080f7]::mir_drops_elaborated_and_const_checked
  31:     0x7fe9b69e30c8 - rustc_query_system[180594c788319d08]::query::plumbing::try_execute_query::<rustc_query_impl[ff2244d0f49f60a1]::queries::mir_drops_elaborated_and_const_checked, rustc_query_impl[ff2244d0f49f60a1]::plumbing::QueryCtxt>
  32:     0x7fe9b69e2af0 - rustc_query_impl[ff2244d0f49f60a1]::get_query::mir_drops_elaborated_and_const_checked
  33:     0x7fe9b6ca6a4c - rustc_mir_transform[30e93fa49ed080f7]::mir_for_ctfe
  34:     0x7fe9b7444cd8 - rustc_query_system[180594c788319d08]::query::plumbing::try_execute_query::<rustc_query_impl[ff2244d0f49f60a1]::queries::mir_for_ctfe, rustc_query_impl[ff2244d0f49f60a1]::plumbing::QueryCtxt>
  35:     0x7fe9b744485f - rustc_query_impl[ff2244d0f49f60a1]::get_query::mir_for_ctfe
  36:     0x7fe9b6490ec0 - <rustc_const_eval[3aaa2df1d62119a5]::interpret::eval_context::InterpCx<rustc_const_eval[3aaa2df1d62119a5]::const_eval::machine::CompileTimeInterpreter>>::load_mir
  37:     0x7fe9b63a8c11 - rustc_const_eval[3aaa2df1d62119a5]::const_eval::eval_queries::eval_to_allocation_raw_provider
  38:     0x7fe9b7301355 - rustc_query_system[180594c788319d08]::query::plumbing::try_execute_query::<rustc_query_impl[ff2244d0f49f60a1]::queries::eval_to_allocation_raw, rustc_query_impl[ff2244d0f49f60a1]::plumbing::QueryCtxt>
  39:     0x7fe9b7300f8f - rustc_query_impl[ff2244d0f49f60a1]::get_query::eval_to_allocation_raw
  40:     0x7fe9b63a91fa - rustc_const_eval[3aaa2df1d62119a5]::const_eval::eval_queries::eval_to_allocation_raw_provider
  41:     0x7fe9b7301355 - rustc_query_system[180594c788319d08]::query::plumbing::try_execute_query::<rustc_query_impl[ff2244d0f49f60a1]::queries::eval_to_allocation_raw, rustc_query_impl[ff2244d0f49f60a1]::plumbing::QueryCtxt>
  42:     0x7fe9b7300f8f - rustc_query_impl[ff2244d0f49f60a1]::get_query::eval_to_allocation_raw
  43:     0x7fe9b771d353 - rustc_const_eval[3aaa2df1d62119a5]::const_eval::eval_to_valtree
  44:     0x7fe9b771d1e0 - <rustc_const_eval[3aaa2df1d62119a5]::provide::{closure#0} as core[7de8eb2b24556be4]::ops::function::FnOnce<(rustc_middle[b96152969e862739]::ty::context::TyCtxt, rustc_middle[b96152969e862739]::ty::ParamEnvAnd<rustc_middle[b96152969e862739]::mir::interpret::GlobalId>)>>::call_once
  45:     0x7fe9b7670da2 - rustc_query_system[180594c788319d08]::query::plumbing::try_execute_query::<rustc_query_impl[ff2244d0f49f60a1]::queries::eval_to_valtree, rustc_query_impl[ff2244d0f49f60a1]::plumbing::QueryCtxt>
  46:     0x7fe9b76709b5 - rustc_query_impl[ff2244d0f49f60a1]::get_query::eval_to_valtree
  47:     0x7fe9b623f880 - rustc_middle[b96152969e862739]::ty::query::query_get_at::<rustc_query_system[180594c788319d08]::query::caches::DefaultCache<rustc_middle[b96152969e862739]::ty::ParamEnvAnd<rustc_middle[b96152969e862739]::mir::interpret::GlobalId>, rustc_middle[b96152969e862739]::query::erase::Erased<[u8; 24usize]>>>
  48:     0x7fe9b623f567 - <rustc_middle[b96152969e862739]::ty::context::TyCtxt>::const_eval_global_id_for_typeck
  49:     0x7fe9b623f11c - <rustc_middle[b96152969e862739]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
  50:     0x7fe9b657df10 - <rustc_middle[b96152969e862739]::ty::consts::kind::ConstKind>::eval
  51:     0x7fe9b6500146 - <rustc_hir_typeck[8b356db618624f6b]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  52:     0x7fe9b654814a - <rustc_hir_typeck[8b356db618624f6b]::fn_ctxt::FnCtxt>::check_decl
  53:     0x7fe9b6543eb2 - <rustc_hir_typeck[8b356db618624f6b]::fn_ctxt::FnCtxt>::check_block_with_expected
  54:     0x7fe9b64fb789 - <rustc_hir_typeck[8b356db618624f6b]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  55:     0x7fe9b66384e6 - <rustc_hir_typeck[8b356db618624f6b]::fn_ctxt::FnCtxt>::check_return_expr
  56:     0x7fe9b663015e - rustc_hir_typeck[8b356db618624f6b]::check::check_fn
  57:     0x7fe9b6616fa3 - rustc_hir_typeck[8b356db618624f6b]::typeck
  58:     0x7fe9b660cad2 - rustc_query_system[180594c788319d08]::query::plumbing::try_execute_query::<rustc_query_impl[ff2244d0f49f60a1]::queries::typeck, rustc_query_impl[ff2244d0f49f60a1]::plumbing::QueryCtxt>
  59:     0x7fe9b7024d63 - rustc_query_system[180594c788319d08]::query::plumbing::try_execute_query::<rustc_query_impl[ff2244d0f49f60a1]::queries::used_trait_imports, rustc_query_impl[ff2244d0f49f60a1]::plumbing::QueryCtxt>
  60:     0x7fe9b74a1239 - rustc_hir_analysis[90d331eccd9fdd4d]::check_crate
  61:     0x7fe9b7495520 - rustc_interface[10d1c68131cce565]::passes::analysis
  62:     0x7fe9b774a407 - rustc_query_system[180594c788319d08]::query::plumbing::try_execute_query::<rustc_query_impl[ff2244d0f49f60a1]::queries::analysis, rustc_query_impl[ff2244d0f49f60a1]::plumbing::QueryCtxt>
  63:     0x7fe9b774a123 - rustc_query_impl[ff2244d0f49f60a1]::get_query::analysis
  64:     0x7fe9b71e05cf - <rustc_middle[b96152969e862739]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[ce322c91000f3e2b]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[7de8eb2b24556be4]::result::Result<(), rustc_span[feb72a2200ed999]::ErrorGuaranteed>>
  65:     0x7fe9b71df6af - <rustc_interface[10d1c68131cce565]::interface::Compiler>::enter::<rustc_driver_impl[ce322c91000f3e2b]::run_compiler::{closure#1}::{closure#2}, core[7de8eb2b24556be4]::result::Result<core[7de8eb2b24556be4]::option::Option<rustc_interface[10d1c68131cce565]::queries::Linker>, rustc_span[feb72a2200ed999]::ErrorGuaranteed>>
  66:     0x7fe9b71dcd3b - std[bc31d8d7a4b25d9b]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[10d1c68131cce565]::util::run_in_thread_pool_with_globals<rustc_interface[10d1c68131cce565]::interface::run_compiler<core[7de8eb2b24556be4]::result::Result<(), rustc_span[feb72a2200ed999]::ErrorGuaranteed>, rustc_driver_impl[ce322c91000f3e2b]::run_compiler::{closure#1}>::{closure#0}, core[7de8eb2b24556be4]::result::Result<(), rustc_span[feb72a2200ed999]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7de8eb2b24556be4]::result::Result<(), rustc_span[feb72a2200ed999]::ErrorGuaranteed>>
  67:     0x7fe9b78b5155 - <<std[bc31d8d7a4b25d9b]::thread::Builder>::spawn_unchecked_<rustc_interface[10d1c68131cce565]::util::run_in_thread_pool_with_globals<rustc_interface[10d1c68131cce565]::interface::run_compiler<core[7de8eb2b24556be4]::result::Result<(), rustc_span[feb72a2200ed999]::ErrorGuaranteed>, rustc_driver_impl[ce322c91000f3e2b]::run_compiler::{closure#1}>::{closure#0}, core[7de8eb2b24556be4]::result::Result<(), rustc_span[feb72a2200ed999]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7de8eb2b24556be4]::result::Result<(), rustc_span[feb72a2200ed999]::ErrorGuaranteed>>::{closure#1} as core[7de8eb2b24556be4]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  68:     0x7fe9b4d77a15 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hdc6a7ff0c7f1614a
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/alloc/src/boxed.rs:1985:9
  69:     0x7fe9b4d77a15 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf73467eae757427c
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/alloc/src/boxed.rs:1985:9
  70:     0x7fe9b4d77a15 - std::sys::unix::thread::Thread::new::thread_start::h747e49fa31477839
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/sys/unix/thread.rs:108:17
  71:     0x7fe9b4b14bb5 - <unknown>
  72:     0x7fe9b4b96d90 - <unknown>
  73:                0x0 - <unknown>

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 (cba14074b 2023-05-10) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_borrowck] borrow-checking `test::{constant#1}`
#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `test::{constant#1}`
#2 [mir_for_ctfe] caching mir of `test::{constant#1}` for CTFE
#3 [eval_to_allocation_raw] const-evaluating + checking `test::{constant#1}`
#4 [eval_to_allocation_raw] const-evaluating + checking `test::{constant#1}`
#5 [eval_to_valtree] evaluating type-level constant
#6 [typeck] type-checking `test`
#7 [used_trait_imports] finding used_trait_imports `test`
#8 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. labels May 10, 2023
@BoxyUwU BoxyUwU added A-const-generics Area: const generics (parameters and arguments) F-generic_const_exprs `#![feature(generic_const_exprs)]` labels May 10, 2023
@BoxyUwU
Copy link
Member

BoxyUwU commented May 10, 2023

going to close this in favor of #111434

@compiler-errors

This comment was marked as off-topic.

@matthiaskrgr

This comment was marked as off-topic.

@matthiaskrgr

This comment was marked as off-topic.

@BoxyUwU

This comment was marked as off-topic.

@matthiaskrgr

This comment was marked as off-topic.

@matthiaskrgr

This comment was marked as off-topic.

@JohnTitor
Copy link
Member

Triage: Fixed on the latest nightly, marking as E-needs-test but feel free to close if there's a regression test already.

@compiler-errors
Copy link
Member

yeah, no need for an additional test. was fixed by #115486.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. F-generic_const_exprs `#![feature(generic_const_exprs)]` 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
Development

No branches or pull requests

5 participants