Open
Description
auto-reduced (treereduce-rust):
#![feature(generic_const_exprs)]
struct Outer<const A: i64, const B: usize>();
impl<const A: usize, const B: usize> Outer<A, B>
where
[(); A + (B * 2)]:,
{
fn o() -> Union {}
}
fn main() {
Outer::<1, 1>::o();
}
original:
#![allow(named_arguments_used_positionally)]
#![feature(generic_const_exprs)]
struct Inner<const N: usize, const M: usize>;
impl<const N: usize, const M: usize> Inner<N, M> where [(); N + M]: {
fn i() -> Self {
Self
}
}
struct Outer<const A: i64, const B: usize>(Inner<A, { B * 2 }>) where [(); A + (B * 2)]:;
impl<const A: usize, const B: usize> Outer<A, B> where [(); A + (B * 2)]: {
fn o() -> Union {
Self(Inner::i())
}
}
fn main() {
Outer::<1, 1>::o();
}
Version information
rustc 1.80.0-nightly (32a3ed229 2024-05-30)
binary: rustc
commit-hash: 32a3ed229caaaa6476ee1b0e644dd53579454536
commit-date: 2024-05-30
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.6
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error[E0412]: cannot find type `Union` in this scope
--> /tmp/icemaker_global_tempdir.6SQ2ETTazrR8/rustc_testrunner_tmpdir_reporting.g7J1FD4KySEA/mvce.rs:8:15
|
8 | fn o() -> Union {}
| ^^^^^ not found in this scope
|
help: consider importing one of these items
|
3 + use std::collections::btree_set::Union;
|
3 + use std::collections::hash_set::Union;
|
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
--> /tmp/icemaker_global_tempdir.6SQ2ETTazrR8/rustc_testrunner_tmpdir_reporting.g7J1FD4KySEA/mvce.rs:1:12
|
1 | #![feature(generic_const_exprs)]
| ^^^^^^^^^^^^^^^^^^^
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
= note: `#[warn(incomplete_features)]` on by default
error: the constant `A` is not of type `i64`
--> /tmp/icemaker_global_tempdir.6SQ2ETTazrR8/rustc_testrunner_tmpdir_reporting.g7J1FD4KySEA/mvce.rs:4:38
|
4 | impl<const A: usize, const B: usize> Outer<A, B>
| ^^^^^^^^^^^ expected `i64`, found `usize`
|
note: required by a bound in `Outer`
--> /tmp/icemaker_global_tempdir.6SQ2ETTazrR8/rustc_testrunner_tmpdir_reporting.g7J1FD4KySEA/mvce.rs:3:14
|
3 | struct Outer<const A: i64, const B: usize>();
| ^^^^^^^^^^^^ required by this bound in `Outer`
error: internal compiler error: compiler/rustc_const_eval/src/interpret/operator.rs:169:13: invalid asymmetric binary op AddWithOverflow: 0x0000000000000001 (i64), 0x0000000000000002 (usize)
--> /tmp/icemaker_global_tempdir.6SQ2ETTazrR8/rustc_testrunner_tmpdir_reporting.g7J1FD4KySEA/mvce.rs:6:10
|
6 | [(); A + (B * 2)]:,
| ^^^^^^^^^^^
thread 'rustc' panicked at compiler/rustc_const_eval/src/interpret/operator.rs:169:13:
Box<dyn Any>
stack backtrace:
0: 0x7df110d12cc5 - std::backtrace_rs::backtrace::libunwind::trace::h678682a49ad9b996
at /rustc/32a3ed229caaaa6476ee1b0e644dd53579454536/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
1: 0x7df110d12cc5 - std::backtrace_rs::backtrace::trace_unsynchronized::hee6fa95bb2553111
at /rustc/32a3ed229caaaa6476ee1b0e644dd53579454536/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7df110d12cc5 - std::sys_common::backtrace::_print_fmt::h95e0b5b079a7d050
at /rustc/32a3ed229caaaa6476ee1b0e644dd53579454536/library/std/src/sys_common/backtrace.rs:68:5
3: 0x7df110d12cc5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5ef0519e3348f4b3
at /rustc/32a3ed229caaaa6476ee1b0e644dd53579454536/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7df110d636bb - core::fmt::rt::Argument::fmt::h351d794db9ebf8d4
at /rustc/32a3ed229caaaa6476ee1b0e644dd53579454536/library/core/src/fmt/rt.rs:165:63
5: 0x7df110d636bb - core::fmt::write::hf6a10f4e291514d0
at /rustc/32a3ed229caaaa6476ee1b0e644dd53579454536/library/core/src/fmt/mod.rs:1168:21
6: 0x7df110d0799f - std::io::Write::write_fmt::h3774e539b39c6176
at /rustc/32a3ed229caaaa6476ee1b0e644dd53579454536/library/std/src/io/mod.rs:1835:15
7: 0x7df110d12a9e - std::sys_common::backtrace::_print::h0766b9d4e4e1a2a5
at /rustc/32a3ed229caaaa6476ee1b0e644dd53579454536/library/std/src/sys_common/backtrace.rs:47:5
8: 0x7df110d12a9e - std::sys_common::backtrace::print::hf85a15b68fc127ec
at /rustc/32a3ed229caaaa6476ee1b0e644dd53579454536/library/std/src/sys_common/backtrace.rs:34:9
9: 0x7df110d154d9 - std::panicking::default_hook::{{closure}}::hba9aa02e8bae00f0
10: 0x7df110d1527a - std::panicking::default_hook::h1795c37d9b50a345
at /rustc/32a3ed229caaaa6476ee1b0e644dd53579454536/library/std/src/panicking.rs:298:9
11: 0x7df10d540d00 - std[fbc7945dfe4e847c]::panicking::update_hook::<alloc[648a2435367f9e21]::boxed::Box<rustc_driver_impl[4c120566f3914dcc]::install_ice_hook::{closure#0}>>::{closure#0}
12: 0x7df110d15c0b - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hb26c638276518655
at /rustc/32a3ed229caaaa6476ee1b0e644dd53579454536/library/alloc/src/boxed.rs:2077:9
13: 0x7df110d15c0b - std::panicking::rust_panic_with_hook::h9450536fa6827029
at /rustc/32a3ed229caaaa6476ee1b0e644dd53579454536/library/std/src/panicking.rs:799:13
14: 0x7df10d570de4 - std[fbc7945dfe4e847c]::panicking::begin_panic::<rustc_errors[29c2300d656916ab]::ExplicitBug>::{closure#0}
15: 0x7df10d56d9e6 - std[fbc7945dfe4e847c]::sys_common::backtrace::__rust_end_short_backtrace::<std[fbc7945dfe4e847c]::panicking::begin_panic<rustc_errors[29c2300d656916ab]::ExplicitBug>::{closure#0}, !>
16: 0x7df10d56d6c6 - std[fbc7945dfe4e847c]::panicking::begin_panic::<rustc_errors[29c2300d656916ab]::ExplicitBug>
17: 0x7df10d57a261 - <rustc_errors[29c2300d656916ab]::diagnostic::BugAbort as rustc_errors[29c2300d656916ab]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
18: 0x7df10d4a8e28 - <rustc_errors[29c2300d656916ab]::DiagCtxt>::span_bug::<rustc_span[41e37a1bb73e38bc]::span_encoding::Span, alloc[648a2435367f9e21]::string::String>
19: 0x7df10d4c8c0d - rustc_middle[be94168a967605d5]::util::bug::opt_span_bug_fmt::<rustc_span[41e37a1bb73e38bc]::span_encoding::Span>::{closure#0}
20: 0x7df10d4c8c3a - rustc_middle[be94168a967605d5]::ty::context::tls::with_opt::<rustc_middle[be94168a967605d5]::util::bug::opt_span_bug_fmt<rustc_span[41e37a1bb73e38bc]::span_encoding::Span>::{closure#0}, !>::{closure#0}
21: 0x7df10d4bec9b - rustc_middle[be94168a967605d5]::ty::context::tls::with_context_opt::<rustc_middle[be94168a967605d5]::ty::context::tls::with_opt<rustc_middle[be94168a967605d5]::util::bug::opt_span_bug_fmt<rustc_span[41e37a1bb73e38bc]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
22: 0x7df10c340a57 - rustc_middle[be94168a967605d5]::util::bug::span_bug_fmt::<rustc_span[41e37a1bb73e38bc]::span_encoding::Span>
23: 0x7df10f4ae55a - <rustc_const_eval[d725f5dd974c28ec]::interpret::eval_context::InterpCx<rustc_const_eval[d725f5dd974c28ec]::const_eval::machine::CompileTimeInterpreter>>::eval_rvalue_into_place
24: 0x7df10c937a4d - rustc_const_eval[d725f5dd974c28ec]::const_eval::eval_queries::eval_to_allocation_raw_provider
25: 0x7df10efb763c - rustc_query_impl[c0e0181520bdf354]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c0e0181520bdf354]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[be94168a967605d5]::query::erase::Erased<[u8; 24usize]>>
26: 0x7df10efb6e59 - rustc_query_system[a635211d769013fd]::query::plumbing::try_execute_query::<rustc_query_impl[c0e0181520bdf354]::DynamicConfig<rustc_query_system[a635211d769013fd]::query::caches::DefaultCache<rustc_middle[be94168a967605d5]::ty::ParamEnvAnd<rustc_middle[be94168a967605d5]::mir::interpret::GlobalId>, rustc_middle[be94168a967605d5]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[c0e0181520bdf354]::plumbing::QueryCtxt, false>
27: 0x7df10efb6a30 - rustc_query_impl[c0e0181520bdf354]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
28: 0x7df10f76aaf6 - rustc_middle[be94168a967605d5]::query::plumbing::query_get_at::<rustc_query_system[a635211d769013fd]::query::caches::DefaultCache<rustc_middle[be94168a967605d5]::ty::ParamEnvAnd<rustc_middle[be94168a967605d5]::mir::interpret::GlobalId>, rustc_middle[be94168a967605d5]::query::erase::Erased<[u8; 24usize]>>>
29: 0x7df10f76adb5 - rustc_const_eval[d725f5dd974c28ec]::const_eval::valtrees::eval_to_valtree
30: 0x7df10f76ad49 - <rustc_const_eval[d725f5dd974c28ec]::provide::{closure#0} as core[6d46e2ae36dee942]::ops::function::FnOnce<(rustc_middle[be94168a967605d5]::ty::context::TyCtxt, rustc_middle[be94168a967605d5]::ty::ParamEnvAnd<rustc_middle[be94168a967605d5]::mir::interpret::GlobalId>)>>::call_once
31: 0x7df10f76ad00 - rustc_query_impl[c0e0181520bdf354]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c0e0181520bdf354]::query_impl::eval_to_valtree::dynamic_query::{closure#2}::{closure#0}, rustc_middle[be94168a967605d5]::query::erase::Erased<[u8; 24usize]>>
32: 0x7df10f76acc1 - <rustc_query_impl[c0e0181520bdf354]::query_impl::eval_to_valtree::dynamic_query::{closure#2} as core[6d46e2ae36dee942]::ops::function::FnOnce<(rustc_middle[be94168a967605d5]::ty::context::TyCtxt, rustc_middle[be94168a967605d5]::ty::ParamEnvAnd<rustc_middle[be94168a967605d5]::mir::interpret::GlobalId>)>>::call_once
33: 0x7df10efb6f34 - rustc_query_system[a635211d769013fd]::query::plumbing::try_execute_query::<rustc_query_impl[c0e0181520bdf354]::DynamicConfig<rustc_query_system[a635211d769013fd]::query::caches::DefaultCache<rustc_middle[be94168a967605d5]::ty::ParamEnvAnd<rustc_middle[be94168a967605d5]::mir::interpret::GlobalId>, rustc_middle[be94168a967605d5]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[c0e0181520bdf354]::plumbing::QueryCtxt, false>
34: 0x7df10efb6858 - rustc_query_impl[c0e0181520bdf354]::query_impl::eval_to_valtree::get_query_non_incr::__rust_end_short_backtrace
35: 0x7df10f3c86f1 - rustc_middle[be94168a967605d5]::query::plumbing::query_get_at::<rustc_query_system[a635211d769013fd]::query::caches::DefaultCache<rustc_middle[be94168a967605d5]::ty::ParamEnvAnd<rustc_middle[be94168a967605d5]::mir::interpret::GlobalId>, rustc_middle[be94168a967605d5]::query::erase::Erased<[u8; 24usize]>>>
36: 0x7df10f4e0bf3 - <rustc_middle[be94168a967605d5]::ty::context::TyCtxt>::const_eval_global_id_for_typeck
37: 0x7df10f4e11c2 - <rustc_middle[be94168a967605d5]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
38: 0x7df10d8a0162 - <rustc_infer[94dcf74a7bd108a5]::infer::InferCtxt>::const_eval_resolve
39: 0x7df1102bde47 - rustc_trait_selection[294db240007bd44b]::traits::const_evaluatable::is_const_evaluatable.cold
40: 0x7df10b4eb8d3 - <rustc_trait_selection[294db240007bd44b]::traits::fulfill::FulfillProcessor as rustc_data_structures[db4c5959faeb11bb]::obligation_forest::ObligationProcessor>::process_obligation
41: 0x7df10ea05cf6 - <rustc_data_structures[db4c5959faeb11bb]::obligation_forest::ObligationForest<rustc_trait_selection[294db240007bd44b]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[294db240007bd44b]::traits::fulfill::FulfillProcessor>
42: 0x7df10ee1176b - <core[6d46e2ae36dee942]::iter::adapters::filter::Filter<core[6d46e2ae36dee942]::iter::adapters::map::Map<core[6d46e2ae36dee942]::slice::iter::Iter<rustc_hir_typeck[27bfc99261d6777a]::method::probe::Candidate>, <rustc_hir_typeck[27bfc99261d6777a]::method::probe::ProbeContext>::consider_candidates::{closure#0}>, <rustc_hir_typeck[27bfc99261d6777a]::method::probe::ProbeContext>::consider_candidates::{closure#1}> as core[6d46e2ae36dee942]::iter::traits::iterator::Iterator>::next
43: 0x7df10ee0d220 - <rustc_hir_typeck[27bfc99261d6777a]::method::probe::ProbeContext>::pick_all_method
44: 0x7df10f439f68 - <rustc_hir_typeck[27bfc99261d6777a]::fn_ctxt::FnCtxt>::probe_for_name
45: 0x7df10f446267 - <rustc_hir_typeck[27bfc99261d6777a]::fn_ctxt::FnCtxt>::check_expr_path
46: 0x7df10f3e8e0a - <rustc_hir_typeck[27bfc99261d6777a]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
47: 0x7df10f3e9c47 - <rustc_hir_typeck[27bfc99261d6777a]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
48: 0x7df10f3e57f3 - <rustc_hir_typeck[27bfc99261d6777a]::fn_ctxt::FnCtxt>::check_block_with_expected
49: 0x7df10f3ea937 - <rustc_hir_typeck[27bfc99261d6777a]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
50: 0x7df10ed9e0d4 - rustc_hir_typeck[27bfc99261d6777a]::check::check_fn
51: 0x7df10ed9386c - rustc_hir_typeck[27bfc99261d6777a]::typeck
52: 0x7df10ed932d1 - rustc_query_impl[c0e0181520bdf354]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c0e0181520bdf354]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[be94168a967605d5]::query::erase::Erased<[u8; 8usize]>>
53: 0x7df10ec5a86e - rustc_query_system[a635211d769013fd]::query::plumbing::try_execute_query::<rustc_query_impl[c0e0181520bdf354]::DynamicConfig<rustc_query_system[a635211d769013fd]::query::caches::VecCache<rustc_span[41e37a1bb73e38bc]::def_id::LocalDefId, rustc_middle[be94168a967605d5]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[c0e0181520bdf354]::plumbing::QueryCtxt, false>
54: 0x7df10ec59395 - rustc_query_impl[c0e0181520bdf354]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
55: 0x7df10ec58fcb - <rustc_middle[be94168a967605d5]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[9feabfd3ed563fae]::check_crate::{closure#4}>::{closure#0}
56: 0x7df10ec57a8b - rustc_hir_analysis[9feabfd3ed563fae]::check_crate
57: 0x7df10f4275fe - rustc_interface[c870be2efde3492c]::passes::analysis
58: 0x7df10f42715b - rustc_query_impl[c0e0181520bdf354]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c0e0181520bdf354]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[be94168a967605d5]::query::erase::Erased<[u8; 1usize]>>
59: 0x7df10f78f725 - rustc_query_system[a635211d769013fd]::query::plumbing::try_execute_query::<rustc_query_impl[c0e0181520bdf354]::DynamicConfig<rustc_query_system[a635211d769013fd]::query::caches::SingleCache<rustc_middle[be94168a967605d5]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[c0e0181520bdf354]::plumbing::QueryCtxt, false>
60: 0x7df10f78f48f - rustc_query_impl[c0e0181520bdf354]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
61: 0x7df10f62120e - rustc_interface[c870be2efde3492c]::interface::run_compiler::<core[6d46e2ae36dee942]::result::Result<(), rustc_span[41e37a1bb73e38bc]::ErrorGuaranteed>, rustc_driver_impl[4c120566f3914dcc]::run_compiler::{closure#0}>::{closure#1}
62: 0x7df10f5e23c9 - std[fbc7945dfe4e847c]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[c870be2efde3492c]::util::run_in_thread_with_globals<rustc_interface[c870be2efde3492c]::util::run_in_thread_pool_with_globals<rustc_interface[c870be2efde3492c]::interface::run_compiler<core[6d46e2ae36dee942]::result::Result<(), rustc_span[41e37a1bb73e38bc]::ErrorGuaranteed>, rustc_driver_impl[4c120566f3914dcc]::run_compiler::{closure#0}>::{closure#1}, core[6d46e2ae36dee942]::result::Result<(), rustc_span[41e37a1bb73e38bc]::ErrorGuaranteed>>::{closure#0}, core[6d46e2ae36dee942]::result::Result<(), rustc_span[41e37a1bb73e38bc]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[6d46e2ae36dee942]::result::Result<(), rustc_span[41e37a1bb73e38bc]::ErrorGuaranteed>>
63: 0x7df10f5e2172 - <<std[fbc7945dfe4e847c]::thread::Builder>::spawn_unchecked_<rustc_interface[c870be2efde3492c]::util::run_in_thread_with_globals<rustc_interface[c870be2efde3492c]::util::run_in_thread_pool_with_globals<rustc_interface[c870be2efde3492c]::interface::run_compiler<core[6d46e2ae36dee942]::result::Result<(), rustc_span[41e37a1bb73e38bc]::ErrorGuaranteed>, rustc_driver_impl[4c120566f3914dcc]::run_compiler::{closure#0}>::{closure#1}, core[6d46e2ae36dee942]::result::Result<(), rustc_span[41e37a1bb73e38bc]::ErrorGuaranteed>>::{closure#0}, core[6d46e2ae36dee942]::result::Result<(), rustc_span[41e37a1bb73e38bc]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[6d46e2ae36dee942]::result::Result<(), rustc_span[41e37a1bb73e38bc]::ErrorGuaranteed>>::{closure#2} as core[6d46e2ae36dee942]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
64: 0x7df110d1fbfb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h5d22407a994a8dd7
at /rustc/32a3ed229caaaa6476ee1b0e644dd53579454536/library/alloc/src/boxed.rs:2063:9
65: 0x7df110d1fbfb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he08091f4f7e587cf
at /rustc/32a3ed229caaaa6476ee1b0e644dd53579454536/library/alloc/src/boxed.rs:2063:9
66: 0x7df110d1fbfb - std::sys::pal::unix::thread::Thread::new::thread_start::h4ffcec4576023b2b
at /rustc/32a3ed229caaaa6476ee1b0e644dd53579454536/library/std/src/sys/pal/unix/thread.rs:108:17
67: 0x7df10a2aa1cf - <unknown>
68: 0x7df10a32b6ec - <unknown>
69: 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 make sure that you have updated to the latest nightly
note: rustc 1.80.0-nightly (32a3ed229 2024-05-30) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `<impl at /tmp/icemaker_global_tempdir.6SQ2ETTazrR8/rustc_testrunner_tmpdir_reporting.g7J1FD4KySEA/mvce.rs:4:1: 6:24>::{constant#0}`
#1 [eval_to_valtree] evaluating type-level constant
end of query stack
error: aborting due to 3 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0412`.
@rustbot label +F-generic_const_exprs
Metadata
Assignees
Labels
Area: Constant evaluation, covers all const contexts (static, const fn, ...)Category: This is a bug.`#![feature(generic_const_exprs)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: This bug is tracked inside the repo by a `known-bug` test.Status: A Minimal Complete and Verifiable Example has been found for this issueRelevant to the compiler team, which will review and decide on the PR/issue.This issue requires the use of incomplete features.
Type
Projects
Status
Todo
Activity