Closed
Description
auto-reduced (treereduce-rust):
#![feature(effects)]
#[const_trait]
trait Foo {}
impl const Foo for i32 {}
impl<T> const Foo for T where T: ~const Foo {}
original:
//@ compile-flags: -Znext-solver
//@ check-pass
#![feature(effects)]
#![feature(const_trait_impl)]
#[const_trait]
trait Foo {
fn foo();
}
trait Bar {}
impl const Foo for i32 {
type A = ();
type B = impl Bar<A = Self::A>;
fn foo() -> Self::B {
()
}
}
impl<T> const Foo for T where
T: ~const Foo, {
fn foo() {}
}
fn main() {}
Version information
rustc 1.80.0-nightly (0f40f14b6 2024-05-07)
binary: rustc
commit-hash: 0f40f14b61430792cc0ea316f424685041e8443e
commit-date: 2024-05-07
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.4
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Znext-solver=coherence
Program output
error[E0658]: const trait impls are experimental
--> /tmp/icemaker_global_tempdir.gVveZocFDa0Q/rustc_testrunner_tmpdir_reporting.AUlmcYwrGUca/mvce.rs:6:6
|
6 | impl const Foo for i32 {}
| ^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on 2024-05-07; consider upgrading it if it is out of date
error[E0658]: const trait impls are experimental
--> /tmp/icemaker_global_tempdir.gVveZocFDa0Q/rustc_testrunner_tmpdir_reporting.AUlmcYwrGUca/mvce.rs:8:9
|
8 | impl<T> const Foo for T where T: ~const Foo {}
| ^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on 2024-05-07; consider upgrading it if it is out of date
error[E0658]: const trait impls are experimental
--> /tmp/icemaker_global_tempdir.gVveZocFDa0Q/rustc_testrunner_tmpdir_reporting.AUlmcYwrGUca/mvce.rs:8:34
|
8 | impl<T> const Foo for T where T: ~const Foo {}
| ^^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on 2024-05-07; consider upgrading it if it is out of date
error[E0658]: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future.
--> /tmp/icemaker_global_tempdir.gVveZocFDa0Q/rustc_testrunner_tmpdir_reporting.AUlmcYwrGUca/mvce.rs:3:1
|
3 | #[const_trait]
| ^^^^^^^^^^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on 2024-05-07; consider upgrading it if it is out of date
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.gVveZocFDa0Q/rustc_testrunner_tmpdir_reporting.AUlmcYwrGUca/mvce.rs:8:47
|
8 | impl<T> const Foo for T where T: ~const Foo {}
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.gVveZocFDa0Q/rustc_testrunner_tmpdir_reporting.AUlmcYwrGUca/mvce.rs`
error: internal compiler error: compiler/rustc_infer/src/infer/relate/combine.rs:218:17: tried to combine ConstKind::Infer/ConstKind::Infer(InferConst::Var): ?1e: bool and ?0c: bool
thread 'rustc' panicked at compiler/rustc_infer/src/infer/relate/combine.rs:218:17:
Box<dyn Any>
stack backtrace:
0: 0x753dbce63b35 - std::backtrace_rs::backtrace::libunwind::trace::h16226f415edd7020
at /rustc/0f40f14b61430792cc0ea316f424685041e8443e/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
1: 0x753dbce63b35 - std::backtrace_rs::backtrace::trace_unsynchronized::hd074bfbed0466e66
at /rustc/0f40f14b61430792cc0ea316f424685041e8443e/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x753dbce63b35 - std::sys_common::backtrace::_print_fmt::h6bd81933b11821e3
at /rustc/0f40f14b61430792cc0ea316f424685041e8443e/library/std/src/sys_common/backtrace.rs:68:5
3: 0x753dbce63b35 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h65a05c4cbe1ebf40
at /rustc/0f40f14b61430792cc0ea316f424685041e8443e/library/std/src/sys_common/backtrace.rs:44:22
4: 0x753dbceb2cfb - core::fmt::rt::Argument::fmt::h033c76ea7ea75413
at /rustc/0f40f14b61430792cc0ea316f424685041e8443e/library/core/src/fmt/rt.rs:165:63
5: 0x753dbceb2cfb - core::fmt::write::h33ad7509b2338e1d
at /rustc/0f40f14b61430792cc0ea316f424685041e8443e/library/core/src/fmt/mod.rs:1157:21
6: 0x753dbce588ff - std::io::Write::write_fmt::hf66d49f3041f55e8
at /rustc/0f40f14b61430792cc0ea316f424685041e8443e/library/std/src/io/mod.rs:1835:15
7: 0x753dbce6390e - std::sys_common::backtrace::_print::h2ca303a605610994
at /rustc/0f40f14b61430792cc0ea316f424685041e8443e/library/std/src/sys_common/backtrace.rs:47:5
8: 0x753dbce6390e - std::sys_common::backtrace::print::h592d77d1173200d4
at /rustc/0f40f14b61430792cc0ea316f424685041e8443e/library/std/src/sys_common/backtrace.rs:34:9
9: 0x753dbce66279 - std::panicking::default_hook::{{closure}}::h4da60be94553ec4b
10: 0x753dbce65fbd - std::panicking::default_hook::h40234bfa16395ce9
at /rustc/0f40f14b61430792cc0ea316f424685041e8443e/library/std/src/panicking.rs:298:9
11: 0x753db98bdb20 - std[8d7719e78985e352]::panicking::update_hook::<alloc[836d2b0baf2f5989]::boxed::Box<rustc_driver_impl[589f8a1b01aee9f6]::install_ice_hook::{closure#0}>>::{closure#0}
12: 0x753dbce66976 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hceeefca90c01e520
at /rustc/0f40f14b61430792cc0ea316f424685041e8443e/library/alloc/src/boxed.rs:2036:9
13: 0x753dbce66976 - std::panicking::rust_panic_with_hook::h9534e82f08371dbb
at /rustc/0f40f14b61430792cc0ea316f424685041e8443e/library/std/src/panicking.rs:799:13
14: 0x753db98ed2a4 - std[8d7719e78985e352]::panicking::begin_panic::<rustc_errors[fd86f5e87ff11908]::ExplicitBug>::{closure#0}
15: 0x753db98e9c56 - std[8d7719e78985e352]::sys_common::backtrace::__rust_end_short_backtrace::<std[8d7719e78985e352]::panicking::begin_panic<rustc_errors[fd86f5e87ff11908]::ExplicitBug>::{closure#0}, !>
16: 0x753db98e5206 - std[8d7719e78985e352]::panicking::begin_panic::<rustc_errors[fd86f5e87ff11908]::ExplicitBug>
17: 0x753db98f6431 - <rustc_errors[fd86f5e87ff11908]::diagnostic::BugAbort as rustc_errors[fd86f5e87ff11908]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
18: 0x753db9dba19c - rustc_middle[bc0899ebf53e261d]::util::bug::opt_span_bug_fmt::<rustc_span[fbdf81e3d6e3d53e]::span_encoding::Span>::{closure#0}
19: 0x753db9d9d9da - rustc_middle[bc0899ebf53e261d]::ty::context::tls::with_opt::<rustc_middle[bc0899ebf53e261d]::util::bug::opt_span_bug_fmt<rustc_span[fbdf81e3d6e3d53e]::span_encoding::Span>::{closure#0}, !>::{closure#0}
20: 0x753db9d9d87b - rustc_middle[bc0899ebf53e261d]::ty::context::tls::with_context_opt::<rustc_middle[bc0899ebf53e261d]::ty::context::tls::with_opt<rustc_middle[bc0899ebf53e261d]::util::bug::opt_span_bug_fmt<rustc_span[fbdf81e3d6e3d53e]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
21: 0x753db7b707e0 - rustc_middle[bc0899ebf53e261d]::util::bug::bug_fmt
22: 0x753dbad2c0da - <rustc_infer[2b5dcaad1be1da29]::infer::InferCtxt>::super_combine_consts::<rustc_infer[2b5dcaad1be1da29]::infer::relate::type_relating::TypeRelating>
23: 0x753dbc38863b - <rustc_middle[bc0899ebf53e261d]::ty::generic_args::GenericArg as rustc_middle[bc0899ebf53e261d]::ty::relate::Relate>::relate::<rustc_infer[2b5dcaad1be1da29]::infer::relate::type_relating::TypeRelating>.cold
24: 0x753dbb7f07e1 - <rustc_trait_selection[2e2c9bd5c426cc94]::solve::eval_ctxt::EvalCtxt>::unify_query_var_values
25: 0x753dbb7e5126 - <rustc_trait_selection[2e2c9bd5c426cc94]::solve::inspect::analyse::InspectCandidate>::instantiate_nested_goals_and_opt_impl_args
26: 0x753dba4095ab - <rustc_trait_selection[2e2c9bd5c426cc94]::traits::coherence::AmbiguityCausesVisitor as rustc_trait_selection[2e2c9bd5c426cc94]::solve::inspect::analyse::ProofTreeVisitor>::visit_goal
27: 0x753dbb13202c - rustc_trait_selection[2e2c9bd5c426cc94]::traits::coherence::overlap
28: 0x753dbb87ae4b - <rustc_middle[bc0899ebf53e261d]::traits::specialization_graph::Children as rustc_trait_selection[2e2c9bd5c426cc94]::traits::specialize::specialization_graph::ChildrenExt>::insert
29: 0x753db8931a38 - <rustc_middle[bc0899ebf53e261d]::traits::specialization_graph::Graph as rustc_trait_selection[2e2c9bd5c426cc94]::traits::specialize::specialization_graph::GraphExt>::insert
30: 0x753dbac8527c - rustc_trait_selection[2e2c9bd5c426cc94]::traits::specialize::specialization_graph_provider
31: 0x753dbac84ddf - rustc_query_impl[f12a8811d86a62d9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f12a8811d86a62d9]::query_impl::specialization_graph_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[bc0899ebf53e261d]::query::erase::Erased<[u8; 8usize]>>
32: 0x753dbac877d7 - rustc_query_system[6d5fb7023970bca8]::query::plumbing::try_execute_query::<rustc_query_impl[f12a8811d86a62d9]::DynamicConfig<rustc_query_system[6d5fb7023970bca8]::query::caches::DefIdCache<rustc_middle[bc0899ebf53e261d]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[f12a8811d86a62d9]::plumbing::QueryCtxt, false>
33: 0x753dbb3271b4 - rustc_query_impl[f12a8811d86a62d9]::query_impl::specialization_graph_of::get_query_non_incr::__rust_end_short_backtrace
34: 0x753dbb5963c4 - rustc_hir_analysis[7f78c912bc544423]::coherence::coherent_trait
35: 0x753dbb5960d1 - rustc_query_impl[f12a8811d86a62d9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f12a8811d86a62d9]::query_impl::coherent_trait::dynamic_query::{closure#2}::{closure#0}, rustc_middle[bc0899ebf53e261d]::query::erase::Erased<[u8; 1usize]>>
36: 0x753dbaf13758 - rustc_query_system[6d5fb7023970bca8]::query::plumbing::try_execute_query::<rustc_query_impl[f12a8811d86a62d9]::DynamicConfig<rustc_query_system[6d5fb7023970bca8]::query::caches::DefIdCache<rustc_middle[bc0899ebf53e261d]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[f12a8811d86a62d9]::plumbing::QueryCtxt, false>
37: 0x753dbaf116df - rustc_query_impl[f12a8811d86a62d9]::query_impl::coherent_trait::get_query_non_incr::__rust_end_short_backtrace
38: 0x753dbb2b1aaa - rustc_hir_analysis[7f78c912bc544423]::check::wfcheck::check_well_formed
39: 0x753dbb2af89d - rustc_query_impl[f12a8811d86a62d9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f12a8811d86a62d9]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[bc0899ebf53e261d]::query::erase::Erased<[u8; 1usize]>>
40: 0x753dbb2af040 - rustc_query_system[6d5fb7023970bca8]::query::plumbing::try_execute_query::<rustc_query_impl[f12a8811d86a62d9]::DynamicConfig<rustc_query_system[6d5fb7023970bca8]::query::caches::VecCache<rustc_hir[b4c4e1f6e3b963a3]::hir_id::OwnerId, rustc_middle[bc0899ebf53e261d]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[f12a8811d86a62d9]::plumbing::QueryCtxt, false>
41: 0x753dbb2aedbf - rustc_query_impl[f12a8811d86a62d9]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
42: 0x753dbb2acd01 - rustc_hir_analysis[7f78c912bc544423]::check::wfcheck::check_mod_type_wf
43: 0x753dbb2acb47 - rustc_query_impl[f12a8811d86a62d9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f12a8811d86a62d9]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[bc0899ebf53e261d]::query::erase::Erased<[u8; 1usize]>>
44: 0x753dbb71ce30 - rustc_query_system[6d5fb7023970bca8]::query::plumbing::try_execute_query::<rustc_query_impl[f12a8811d86a62d9]::DynamicConfig<rustc_query_system[6d5fb7023970bca8]::query::caches::DefaultCache<rustc_span[fbdf81e3d6e3d53e]::def_id::LocalModDefId, rustc_middle[bc0899ebf53e261d]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[f12a8811d86a62d9]::plumbing::QueryCtxt, false>
45: 0x753dbb71cbdb - rustc_query_impl[f12a8811d86a62d9]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
46: 0x753dbb1cd0dc - rustc_hir_analysis[7f78c912bc544423]::check_crate
47: 0x753dbb5b9047 - rustc_interface[1dc2dcc2b864e855]::passes::analysis
48: 0x753dbb5b8b87 - rustc_query_impl[f12a8811d86a62d9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f12a8811d86a62d9]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[bc0899ebf53e261d]::query::erase::Erased<[u8; 1usize]>>
49: 0x753dbb9d0225 - rustc_query_system[6d5fb7023970bca8]::query::plumbing::try_execute_query::<rustc_query_impl[f12a8811d86a62d9]::DynamicConfig<rustc_query_system[6d5fb7023970bca8]::query::caches::SingleCache<rustc_middle[bc0899ebf53e261d]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[f12a8811d86a62d9]::plumbing::QueryCtxt, false>
50: 0x753dbb9cff89 - rustc_query_impl[f12a8811d86a62d9]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
51: 0x753dbb82e70e - rustc_interface[1dc2dcc2b864e855]::interface::run_compiler::<core[b90f87831ee46a2c]::result::Result<(), rustc_span[fbdf81e3d6e3d53e]::ErrorGuaranteed>, rustc_driver_impl[589f8a1b01aee9f6]::run_compiler::{closure#0}>::{closure#1}
52: 0x753dbb80be49 - std[8d7719e78985e352]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[1dc2dcc2b864e855]::util::run_in_thread_with_globals<rustc_interface[1dc2dcc2b864e855]::util::run_in_thread_pool_with_globals<rustc_interface[1dc2dcc2b864e855]::interface::run_compiler<core[b90f87831ee46a2c]::result::Result<(), rustc_span[fbdf81e3d6e3d53e]::ErrorGuaranteed>, rustc_driver_impl[589f8a1b01aee9f6]::run_compiler::{closure#0}>::{closure#1}, core[b90f87831ee46a2c]::result::Result<(), rustc_span[fbdf81e3d6e3d53e]::ErrorGuaranteed>>::{closure#0}, core[b90f87831ee46a2c]::result::Result<(), rustc_span[fbdf81e3d6e3d53e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b90f87831ee46a2c]::result::Result<(), rustc_span[fbdf81e3d6e3d53e]::ErrorGuaranteed>>
53: 0x753dbb80bbf8 - <<std[8d7719e78985e352]::thread::Builder>::spawn_unchecked_<rustc_interface[1dc2dcc2b864e855]::util::run_in_thread_with_globals<rustc_interface[1dc2dcc2b864e855]::util::run_in_thread_pool_with_globals<rustc_interface[1dc2dcc2b864e855]::interface::run_compiler<core[b90f87831ee46a2c]::result::Result<(), rustc_span[fbdf81e3d6e3d53e]::ErrorGuaranteed>, rustc_driver_impl[589f8a1b01aee9f6]::run_compiler::{closure#0}>::{closure#1}, core[b90f87831ee46a2c]::result::Result<(), rustc_span[fbdf81e3d6e3d53e]::ErrorGuaranteed>>::{closure#0}, core[b90f87831ee46a2c]::result::Result<(), rustc_span[fbdf81e3d6e3d53e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b90f87831ee46a2c]::result::Result<(), rustc_span[fbdf81e3d6e3d53e]::ErrorGuaranteed>>::{closure#2} as core[b90f87831ee46a2c]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
54: 0x753dbce707bb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8236c067dabb3bba
at /rustc/0f40f14b61430792cc0ea316f424685041e8443e/library/alloc/src/boxed.rs:2022:9
55: 0x753dbce707bb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h842b37a516a98fc8
at /rustc/0f40f14b61430792cc0ea316f424685041e8443e/library/alloc/src/boxed.rs:2022:9
56: 0x753dbce707bb - std::sys::pal::unix::thread::Thread::new::thread_start::h82e010f2c7789ffb
at /rustc/0f40f14b61430792cc0ea316f424685041e8443e/library/std/src/sys/pal/unix/thread.rs:108:17
57: 0x753db66a955a - <unknown>
58: 0x753db6726a3c - <unknown>
59: 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 (0f40f14b6 2024-05-07) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z next-solver=coherence -Z dump-mir-dir=dir
query stack during panic:
#0 [specialization_graph_of] building specialization graph of trait `Foo`
#1 [coherent_trait] coherence checking all impls of trait `Foo`
#2 [check_well_formed] checking that `<impl at /tmp/icemaker_global_tempdir.gVveZocFDa0Q/rustc_testrunner_tmpdir_reporting.AUlmcYwrGUca/mvce.rs:6:1: 6:23>` is well-formed
#3 [check_mod_type_wf] checking that types are well-formed in top-level module
#4 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0601, E0658.
For more information about an error, try `rustc --explain E0601`.
@rustbot label +F-effects +F-const_trait_impl
Metadata
Metadata
Assignees
Labels
Category: This is a bug.`#![feature(const_trait_impl)]``#![feature(effects)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: This bug is tracked inside the repo by a `known-bug` test.Relevant to the compiler team, which will review and decide on the PR/issue.The Rustc Trait System Refactor Initiative (-Znext-solver)This issue requires a nightly compiler in some way.