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

inline_const_pat ICE: primitive read not possible for type: fn() {uwu} #114659

Closed
asquared31415 opened this issue Aug 9, 2023 · 1 comment · Fixed by #114668
Closed

inline_const_pat ICE: primitive read not possible for type: fn() {uwu} #114659

asquared31415 opened this issue Aug 9, 2023 · 1 comment · Fixed by #114668
Labels
C-bug Category: This is a bug. F-inline_const_pat #![feature(inline_const_pat)] I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features This issue requires the use of incomplete features. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@asquared31415
Copy link
Contributor

(note: this is very similar to #114658 but it does appear to be a different ICE)

Code

#![allow(incomplete_features, dead_code)]
#![feature(inline_const_pat)]

fn uwu() {}

#[allow(unconditional_panic)]
fn owo() {
    let x = [];
    // uncomment this for the code to compile
    // (and it even lets you use some unsafe tricks to get the function item)
    // x[99] = loop {};
    match x[123] {
        const { uwu } => {}
        _ => {}
    }
}

playground

Meta

rustc --version --verbose:

rustc 1.73.0-nightly (03a119b0b 2023-08-07)
binary: rustc
commit-hash: 03a119b0b0e310d22d94399b24ed030056050f13
commit-date: 2023-08-07
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5

Error output

error: internal compiler error: /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/compiler/rustc_const_eval/src/interpret/operand.rs:499:13: primitive read not possible for type: fn() {uwu}
Backtrace

error: internal compiler error: /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/compiler/rustc_const_eval/src/interpret/operand.rs:499:13: primitive read not possible for type: fn() {uwu}
  --> src/lib.rs:13:9
   |
13 |         const { uwu } => {}
   |         ^^^^^^^^^^^^^

thread 'rustc' panicked at /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/compiler/rustc_errors/src/lib.rs:979:33:
Box<dyn Any>
stack backtrace:
   0:     0x7f5644eac41c - std::backtrace_rs::backtrace::libunwind::trace::hca136959d52e6933
                               at /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f5644eac41c - std::backtrace_rs::backtrace::trace_unsynchronized::h1c6a8e094542be1c
                               at /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f5644eac41c - std::sys_common::backtrace::_print_fmt::h0da2398478023750
                               at /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f5644eac41c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5b6a573864c0f846
                               at /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f5644f1191c - core::fmt::rt::Argument::fmt::he6fd7e0d0105a739
                               at /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/library/core/src/fmt/rt.rs:138:9
   5:     0x7f5644f1191c - core::fmt::write::h94f577461195b051
                               at /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f5644e9efce - std::io::Write::write_fmt::hd1a9413609baf17e
                               at /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/library/std/src/io/mod.rs:1714:15
   7:     0x7f5644eac204 - std::sys_common::backtrace::_print::h6209835ea4995823
                               at /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f5644eac204 - std::sys_common::backtrace::print::he714f50554d615bf
                               at /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f5644eaf2fa - std::panicking::panic_hook_with_disk_dump::{{closure}}::h3bcbb7ff457b5172
                               at /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/library/std/src/panicking.rs:278:22
  10:     0x7f5644eaefe7 - std::panicking::panic_hook_with_disk_dump::he69919c08bd7c189
                               at /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/library/std/src/panicking.rs:312:9
  11:     0x7f5648089c99 - <rustc_driver_impl[a3b376697c1f9d40]::install_ice_hook::{closure#0} as core[5c8cf3808a1d57ad]::ops::function::FnOnce<(&core[5c8cf3808a1d57ad]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  12:     0x7f5644eafba0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::ha904a5fedd1a6164
                               at /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/library/alloc/src/boxed.rs:2021:9
  13:     0x7f5644eafba0 - std::panicking::rust_panic_with_hook::h2a611f1a2fc1b8fc
                               at /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/library/std/src/panicking.rs:733:13
  14:     0x7f56487c3271 - std[daf38f5e158042c3]::panicking::begin_panic::<rustc_errors[7d56c13f6856642f]::ExplicitBug>::{closure#0}
  15:     0x7f56487c1d36 - std[daf38f5e158042c3]::sys_common::backtrace::__rust_end_short_backtrace::<std[daf38f5e158042c3]::panicking::begin_panic<rustc_errors[7d56c13f6856642f]::ExplicitBug>::{closure#0}, !>
  16:     0x7f5648854fb6 - std[daf38f5e158042c3]::panicking::begin_panic::<rustc_errors[7d56c13f6856642f]::ExplicitBug>
  17:     0x7f56487e1e1e - <rustc_errors[7d56c13f6856642f]::HandlerInner>::span_bug::<rustc_span[fbb5fda749e896f2]::span_encoding::Span, alloc[221a7a11f5e0e716]::string::String>
  18:     0x7f56487e1a8f - <rustc_errors[7d56c13f6856642f]::Handler>::span_bug::<rustc_span[fbb5fda749e896f2]::span_encoding::Span, alloc[221a7a11f5e0e716]::string::String>
  19:     0x7f56487e391b - rustc_middle[4e39534ad143988e]::util::bug::opt_span_bug_fmt::<rustc_span[fbb5fda749e896f2]::span_encoding::Span>::{closure#0}
  20:     0x7f56487e394a - rustc_middle[4e39534ad143988e]::ty::context::tls::with_opt::<rustc_middle[4e39534ad143988e]::util::bug::opt_span_bug_fmt<rustc_span[fbb5fda749e896f2]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f56487e2f48 - rustc_middle[4e39534ad143988e]::ty::context::tls::with_context_opt::<rustc_middle[4e39534ad143988e]::ty::context::tls::with_opt<rustc_middle[4e39534ad143988e]::util::bug::opt_span_bug_fmt<rustc_span[fbb5fda749e896f2]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f56470dd4b4 - rustc_middle[4e39534ad143988e]::util::bug::span_bug_fmt::<rustc_span[fbb5fda749e896f2]::span_encoding::Span>
  23:     0x7f56470de579 - <rustc_mir_transform[1767db2ea534335]::const_prop_lint::ConstPropagator>::check_binary_op
  24:     0x7f56470ac7c4 - <rustc_mir_transform[1767db2ea534335]::const_prop_lint::ConstPropagator as rustc_middle[4e39534ad143988e]::mir::visit::Visitor>::visit_body
  25:     0x7f564709e9bd - <rustc_mir_transform[1767db2ea534335]::const_prop_lint::ConstProp as rustc_mir_transform[1767db2ea534335]::pass_manager::MirLint>::run_lint
  26:     0x7f56475597ad - rustc_mir_transform[1767db2ea534335]::pass_manager::run_passes_inner
  27:     0x7f56471472ce - rustc_mir_transform[1767db2ea534335]::mir_drops_elaborated_and_const_checked
  28:     0x7f5646196a4e - rustc_query_impl[e5a2310130a23b66]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e5a2310130a23b66]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[4e39534ad143988e]::query::erase::Erased<[u8; 8usize]>>
  29:     0x7f5646196a1e - <rustc_query_impl[e5a2310130a23b66]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2} as core[5c8cf3808a1d57ad]::ops::function::FnOnce<(rustc_middle[4e39534ad143988e]::ty::context::TyCtxt, rustc_span[fbb5fda749e896f2]::def_id::LocalDefId)>>::call_once
  30:     0x7f564624276d - rustc_query_system[f19bd4f68b2513a8]::query::plumbing::try_execute_query::<rustc_query_impl[e5a2310130a23b66]::DynamicConfig<rustc_query_system[f19bd4f68b2513a8]::query::caches::VecCache<rustc_span[fbb5fda749e896f2]::def_id::LocalDefId, rustc_middle[4e39534ad143988e]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[e5a2310130a23b66]::plumbing::QueryCtxt, false>
  31:     0x7f56479f1bbf - rustc_query_impl[e5a2310130a23b66]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7f5647564a9b - <rustc_session[5b68303f1d45cafc]::session::Session>::time::<(), rustc_interface[bbd54b40b3118f42]::passes::analysis::{closure#2}>
  33:     0x7f5647562b95 - rustc_interface[bbd54b40b3118f42]::passes::analysis
  34:     0x7f564759682a - rustc_query_impl[e5a2310130a23b66]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e5a2310130a23b66]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[4e39534ad143988e]::query::erase::Erased<[u8; 1usize]>>
  35:     0x7f5647596819 - <rustc_query_impl[e5a2310130a23b66]::query_impl::analysis::dynamic_query::{closure#2} as core[5c8cf3808a1d57ad]::ops::function::FnOnce<(rustc_middle[4e39534ad143988e]::ty::context::TyCtxt, ())>>::call_once
  36:     0x7f5647727968 - rustc_query_system[f19bd4f68b2513a8]::query::plumbing::try_execute_query::<rustc_query_impl[e5a2310130a23b66]::DynamicConfig<rustc_query_system[f19bd4f68b2513a8]::query::caches::SingleCache<rustc_middle[4e39534ad143988e]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[e5a2310130a23b66]::plumbing::QueryCtxt, false>
  37:     0x7f56477276f7 - rustc_query_impl[e5a2310130a23b66]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7f56476f8806 - <rustc_middle[4e39534ad143988e]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[a3b376697c1f9d40]::run_compiler::{closure#1}::{closure#2}::{closure#6}, core[5c8cf3808a1d57ad]::result::Result<(), rustc_span[fbb5fda749e896f2]::ErrorGuaranteed>>
  39:     0x7f564733dee1 - rustc_span[fbb5fda749e896f2]::set_source_map::<core[5c8cf3808a1d57ad]::result::Result<(), rustc_span[fbb5fda749e896f2]::ErrorGuaranteed>, rustc_interface[bbd54b40b3118f42]::interface::run_compiler<core[5c8cf3808a1d57ad]::result::Result<(), rustc_span[fbb5fda749e896f2]::ErrorGuaranteed>, rustc_driver_impl[a3b376697c1f9d40]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  40:     0x7f56473383b0 - std[daf38f5e158042c3]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[bbd54b40b3118f42]::util::run_in_thread_pool_with_globals<rustc_interface[bbd54b40b3118f42]::interface::run_compiler<core[5c8cf3808a1d57ad]::result::Result<(), rustc_span[fbb5fda749e896f2]::ErrorGuaranteed>, rustc_driver_impl[a3b376697c1f9d40]::run_compiler::{closure#1}>::{closure#0}, core[5c8cf3808a1d57ad]::result::Result<(), rustc_span[fbb5fda749e896f2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5c8cf3808a1d57ad]::result::Result<(), rustc_span[fbb5fda749e896f2]::ErrorGuaranteed>>
  41:     0x7f56478ff6f5 - <<std[daf38f5e158042c3]::thread::Builder>::spawn_unchecked_<rustc_interface[bbd54b40b3118f42]::util::run_in_thread_pool_with_globals<rustc_interface[bbd54b40b3118f42]::interface::run_compiler<core[5c8cf3808a1d57ad]::result::Result<(), rustc_span[fbb5fda749e896f2]::ErrorGuaranteed>, rustc_driver_impl[a3b376697c1f9d40]::run_compiler::{closure#1}>::{closure#0}, core[5c8cf3808a1d57ad]::result::Result<(), rustc_span[fbb5fda749e896f2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5c8cf3808a1d57ad]::result::Result<(), rustc_span[fbb5fda749e896f2]::ErrorGuaranteed>>::{closure#1} as core[5c8cf3808a1d57ad]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  42:     0x7f5644eba225 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he74562cf0068d98a
                               at /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/library/alloc/src/boxed.rs:2007:9
  43:     0x7f5644eba225 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h499befea8267854a
                               at /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/library/alloc/src/boxed.rs:2007:9
  44:     0x7f5644eba225 - std::sys::unix::thread::Thread::new::thread_start::h94d7dff6e38d6249
                               at /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/library/std/src/sys/unix/thread.rs:108:17
  45:     0x7f5644d80609 - start_thread
  46:     0x7f5644ca3133 - clone
  47:                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: please attach the file at `/playground/rustc-ice-2023-08-09T16:04:06.91411877Z-27.txt` to your bug report

note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

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

query stack during panic:
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `owo`
#1 [analysis] running analysis passes on this crate
end of query stack

@asquared31415 asquared31415 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 Aug 9, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 9, 2023
@asquared31415
Copy link
Contributor Author

@rustbot label +requires-nightly +F-inline_const_pat +requires-incomplete-features

@rustbot rustbot added F-inline_const_pat #![feature(inline_const_pat)] requires-incomplete-features This issue requires the use of incomplete features. requires-nightly This issue requires a nightly compiler in some way. labels Aug 9, 2023
@compiler-errors compiler-errors removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 9, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 15, 2023
…trochenkov

Deny `FnDef` in patterns

We can only see these via `const { .. }` patterns, which are unstable.

cc rust-lang#76001 (tracking issue for inline const pats)

Fixes rust-lang#114658
Fixes rust-lang#114659
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 15, 2023
…trochenkov

Deny `FnDef` in patterns

We can only see these via `const { .. }` patterns, which are unstable.

cc rust-lang#76001 (tracking issue for inline const pats)

Fixes rust-lang#114658
Fixes rust-lang#114659
@bors bors closed this as completed in 5baf2a1 Aug 15, 2023
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. F-inline_const_pat #![feature(inline_const_pat)] I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features This issue requires the use of incomplete features. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants