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: is not fully resolved #119830

Closed
matthiaskrgr opened this issue Jan 10, 2024 · 2 comments · Fixed by #125865
Closed

ice: is not fully resolved #119830

matthiaskrgr opened this issue Jan 10, 2024 · 2 comments · Fixed by #125865
Labels
A-specialization Area: Trait impl specialization C-bug Category: This is a bug. F-effects `#![feature(effects)]` F-specialization `#![feature(specialization)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority requires-nightly This issue requires a nightly compiler in some way. S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Another regression of #117449 @oli-obk

snippet:

#![feature(effects)]
#![feature(min_specialization)]

trait Specialize {}

trait Foo {}

impl<T> const Foo for T {}

impl<T> const Foo for T where T: const Specialize {}

Version information

rustc 1.77.0-nightly (e92718462 2024-01-10)
binary: rustc
commit-hash: e9271846294c4ee5bd7706df68180320c0b5ff20
commit-date: 2024-01-10
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0658]: const trait impls are experimental
 --> /tmp/icemaker_global_tempdir.m8yucfI0lXDa/rustc_testrunner_tmpdir_reporting.dPnmsUv2HB9L/mvce.rs:8:9
  |
8 | impl<T> const Foo for T {}
  |         ^^^^^
  |
  = 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

error[E0658]: const trait impls are experimental
  --> /tmp/icemaker_global_tempdir.m8yucfI0lXDa/rustc_testrunner_tmpdir_reporting.dPnmsUv2HB9L/mvce.rs:10:9
   |
10 | impl<T> const Foo for T where T: const Specialize {}
   |         ^^^^^
   |
   = 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

error[E0658]: const trait impls are experimental
  --> /tmp/icemaker_global_tempdir.m8yucfI0lXDa/rustc_testrunner_tmpdir_reporting.dPnmsUv2HB9L/mvce.rs:10:34
   |
10 | impl<T> const Foo for T where T: const Specialize {}
   |                                  ^^^^^
   |
   = 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

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.m8yucfI0lXDa/rustc_testrunner_tmpdir_reporting.dPnmsUv2HB9L/mvce.rs:10:53
   |
10 | impl<T> const Foo for T where T: const Specialize {}
   |                                                     ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.m8yucfI0lXDa/rustc_testrunner_tmpdir_reporting.dPnmsUv2HB9L/mvce.rs`

error: const `impl` for trait `Foo` which is not marked with `#[const_trait]`
 --> /tmp/icemaker_global_tempdir.m8yucfI0lXDa/rustc_testrunner_tmpdir_reporting.dPnmsUv2HB9L/mvce.rs:8:15
  |
6 | trait Foo {}
  | - help: mark `Foo` as const: `#[const_trait]`
7 |
8 | impl<T> const Foo for T {}
  |               ^^^
  |
  = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
  = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `Foo` which is not marked with `#[const_trait]`
  --> /tmp/icemaker_global_tempdir.m8yucfI0lXDa/rustc_testrunner_tmpdir_reporting.dPnmsUv2HB9L/mvce.rs:10:15
   |
6  | trait Foo {}
   | - help: mark `Foo` as const: `#[const_trait]`
...
10 | impl<T> const Foo for T where T: const Specialize {}
   |               ^^^
   |
   = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
   = note: adding a non-const method body in the future would be a breaking change

error: `const` can only be applied to `#[const_trait]` traits
  --> /tmp/icemaker_global_tempdir.m8yucfI0lXDa/rustc_testrunner_tmpdir_reporting.dPnmsUv2HB9L/mvce.rs:10:40
   |
10 | impl<T> const Foo for T where T: const Specialize {}
   |                                        ^^^^^^^^^^

error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
 --> /tmp/icemaker_global_tempdir.m8yucfI0lXDa/rustc_testrunner_tmpdir_reporting.dPnmsUv2HB9L/mvce.rs:8:9
  |
8 | impl<T> const Foo for T {}
  |         ^^^^^ unconstrained const parameter
  |
  = note: expressions using a const parameter must map each value to a distinct output value
  = note: proving the result of expressions other than the parameter are unique is not supported

error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
  --> /tmp/icemaker_global_tempdir.m8yucfI0lXDa/rustc_testrunner_tmpdir_reporting.dPnmsUv2HB9L/mvce.rs:10:9
   |
10 | impl<T> const Foo for T where T: const Specialize {}
   |         ^^^^^ unconstrained const parameter
   |
   = note: expressions using a const parameter must map each value to a distinct output value
   = note: proving the result of expressions other than the parameter are unique is not supported

error: specialization impl does not specialize any associated items
  --> /tmp/icemaker_global_tempdir.m8yucfI0lXDa/rustc_testrunner_tmpdir_reporting.dPnmsUv2HB9L/mvce.rs:10:1
   |
10 | impl<T> const Foo for T where T: const Specialize {}
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: impl is a specialization of this impl
  --> /tmp/icemaker_global_tempdir.m8yucfI0lXDa/rustc_testrunner_tmpdir_reporting.dPnmsUv2HB9L/mvce.rs:8:1
   |
8  | impl<T> const Foo for T {}
   | ^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: /rustc/e9271846294c4ee5bd7706df68180320c0b5ff20/compiler/rustc_infer/src/infer/mod.rs:1434:21: `[T/#0, ?0e: bool]` is not fully resolved

thread 'rustc' panicked at /rustc/e9271846294c4ee5bd7706df68180320c0b5ff20/compiler/rustc_errors/src/lib.rs:937:30:
Box<dyn Any>
stack backtrace:
   0:     0x7f554df8c7e6 - std::backtrace_rs::backtrace::libunwind::trace::h4e8b6d32d7dcd498
                               at /rustc/e9271846294c4ee5bd7706df68180320c0b5ff20/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f554df8c7e6 - std::backtrace_rs::backtrace::trace_unsynchronized::ha88031840b9f4a2e
                               at /rustc/e9271846294c4ee5bd7706df68180320c0b5ff20/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f554df8c7e6 - std::sys_common::backtrace::_print_fmt::h6c652548d6de2167
                               at /rustc/e9271846294c4ee5bd7706df68180320c0b5ff20/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f554df8c7e6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h099aa61dbf587b72
                               at /rustc/e9271846294c4ee5bd7706df68180320c0b5ff20/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f554dfdeec0 - core::fmt::rt::Argument::fmt::h8ea5c32ee70cc6ed
                               at /rustc/e9271846294c4ee5bd7706df68180320c0b5ff20/library/core/src/fmt/rt.rs:142:9
   5:     0x7f554dfdeec0 - core::fmt::write::h465d7647510b0e90
                               at /rustc/e9271846294c4ee5bd7706df68180320c0b5ff20/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f554df8014f - std::io::Write::write_fmt::h5c35515aeaa7e8fa
                               at /rustc/e9271846294c4ee5bd7706df68180320c0b5ff20/library/std/src/io/mod.rs:1810:15
   7:     0x7f554df8c5c4 - std::sys_common::backtrace::_print::h3f03a228ef688f8b
                               at /rustc/e9271846294c4ee5bd7706df68180320c0b5ff20/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f554df8c5c4 - std::sys_common::backtrace::print::hfa61eeb1a7b5419d
                               at /rustc/e9271846294c4ee5bd7706df68180320c0b5ff20/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f554df8f357 - std::panicking::default_hook::{{closure}}::h6af33eb943d51021
  10:     0x7f554df8f0b9 - std::panicking::default_hook::h7695ba792af1dd2f
                               at /rustc/e9271846294c4ee5bd7706df68180320c0b5ff20/library/std/src/panicking.rs:292:9
  11:     0x7f5550d55bbc - std[f174e998751286d7]::panicking::update_hook::<alloc[dd0f9dac4d1c2b55]::boxed::Box<rustc_driver_impl[87d1b731212ed153]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f554df8faa6 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hef752b8be7573308
                               at /rustc/e9271846294c4ee5bd7706df68180320c0b5ff20/library/alloc/src/boxed.rs:2030:9
  13:     0x7f554df8faa6 - std::panicking::rust_panic_with_hook::h53b5c8441c16b7dc
                               at /rustc/e9271846294c4ee5bd7706df68180320c0b5ff20/library/std/src/panicking.rs:785:13
  14:     0x7f5550d87c04 - std[f174e998751286d7]::panicking::begin_panic::<rustc_errors[1356d5bcd4a24573]::ExplicitBug>::{closure#0}
  15:     0x7f5550d844f6 - std[f174e998751286d7]::sys_common::backtrace::__rust_end_short_backtrace::<std[f174e998751286d7]::panicking::begin_panic<rustc_errors[1356d5bcd4a24573]::ExplicitBug>::{closure#0}, !>
  16:     0x7f5550d84166 - std[f174e998751286d7]::panicking::begin_panic::<rustc_errors[1356d5bcd4a24573]::ExplicitBug>
  17:     0x7f5550d92c81 - <rustc_errors[1356d5bcd4a24573]::diagnostic_builder::BugAbort as rustc_errors[1356d5bcd4a24573]::diagnostic_builder::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7f555115a6ae - <rustc_errors[1356d5bcd4a24573]::DiagCtxt>::bug::<alloc[dd0f9dac4d1c2b55]::string::String>
  19:     0x7f55511f309b - rustc_middle[2f8d8a9fb975d25e]::util::bug::opt_span_bug_fmt::<rustc_span[67cae37aa81b7c83]::span_encoding::Span>::{closure#0}
  20:     0x7f55511dbc8a - rustc_middle[2f8d8a9fb975d25e]::ty::context::tls::with_opt::<rustc_middle[2f8d8a9fb975d25e]::util::bug::opt_span_bug_fmt<rustc_span[67cae37aa81b7c83]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f55511dbb28 - rustc_middle[2f8d8a9fb975d25e]::ty::context::tls::with_context_opt::<rustc_middle[2f8d8a9fb975d25e]::ty::context::tls::with_opt<rustc_middle[2f8d8a9fb975d25e]::util::bug::opt_span_bug_fmt<rustc_span[67cae37aa81b7c83]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f554f18d810 - rustc_middle[2f8d8a9fb975d25e]::util::bug::bug_fmt
  23:     0x7f5550e8b071 - rustc_hir_analysis[1e63daf843f87d]::impl_wf_check::min_specialization::get_impl_args
  24:     0x7f5552c1e75f - rustc_hir_analysis[1e63daf843f87d]::impl_wf_check::check_mod_impl_wf
  25:     0x7f5552c1b79d - rustc_query_impl[16d1cd34db60958]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[16d1cd34db60958]::query_impl::check_mod_impl_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2f8d8a9fb975d25e]::query::erase::Erased<[u8; 0usize]>>
  26:     0x7f5552caed8f - rustc_query_system[7153283b9fb9fb6d]::query::plumbing::try_execute_query::<rustc_query_impl[16d1cd34db60958]::DynamicConfig<rustc_query_system[7153283b9fb9fb6d]::query::caches::DefaultCache<rustc_span[67cae37aa81b7c83]::def_id::LocalModDefId, rustc_middle[2f8d8a9fb975d25e]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[16d1cd34db60958]::plumbing::QueryCtxt, false>
  27:     0x7f5552cae81f - rustc_query_impl[16d1cd34db60958]::query_impl::check_mod_impl_wf::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7f55525040bb - rustc_hir_analysis[1e63daf843f87d]::check_crate
  29:     0x7f5552a562d9 - rustc_interface[c9e2075c66deb843]::passes::analysis
  30:     0x7f5552a55f1f - rustc_query_impl[16d1cd34db60958]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[16d1cd34db60958]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2f8d8a9fb975d25e]::query::erase::Erased<[u8; 1usize]>>
  31:     0x7f5552fc47a4 - rustc_query_system[7153283b9fb9fb6d]::query::plumbing::try_execute_query::<rustc_query_impl[16d1cd34db60958]::DynamicConfig<rustc_query_system[7153283b9fb9fb6d]::query::caches::SingleCache<rustc_middle[2f8d8a9fb975d25e]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[16d1cd34db60958]::plumbing::QueryCtxt, false>
  32:     0x7f5552fc4595 - rustc_query_impl[16d1cd34db60958]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7f5552d49408 - rustc_interface[c9e2075c66deb843]::interface::run_compiler::<core[61d3efaba9c696db]::result::Result<(), rustc_span[67cae37aa81b7c83]::ErrorGuaranteed>, rustc_driver_impl[87d1b731212ed153]::run_compiler::{closure#0}>::{closure#0}
  34:     0x7f5552fe6fc6 - std[f174e998751286d7]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[c9e2075c66deb843]::util::run_in_thread_with_globals<rustc_interface[c9e2075c66deb843]::util::run_in_thread_pool_with_globals<rustc_interface[c9e2075c66deb843]::interface::run_compiler<core[61d3efaba9c696db]::result::Result<(), rustc_span[67cae37aa81b7c83]::ErrorGuaranteed>, rustc_driver_impl[87d1b731212ed153]::run_compiler::{closure#0}>::{closure#0}, core[61d3efaba9c696db]::result::Result<(), rustc_span[67cae37aa81b7c83]::ErrorGuaranteed>>::{closure#0}, core[61d3efaba9c696db]::result::Result<(), rustc_span[67cae37aa81b7c83]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[61d3efaba9c696db]::result::Result<(), rustc_span[67cae37aa81b7c83]::ErrorGuaranteed>>
  35:     0x7f5552fe6df3 - <<std[f174e998751286d7]::thread::Builder>::spawn_unchecked_<rustc_interface[c9e2075c66deb843]::util::run_in_thread_with_globals<rustc_interface[c9e2075c66deb843]::util::run_in_thread_pool_with_globals<rustc_interface[c9e2075c66deb843]::interface::run_compiler<core[61d3efaba9c696db]::result::Result<(), rustc_span[67cae37aa81b7c83]::ErrorGuaranteed>, rustc_driver_impl[87d1b731212ed153]::run_compiler::{closure#0}>::{closure#0}, core[61d3efaba9c696db]::result::Result<(), rustc_span[67cae37aa81b7c83]::ErrorGuaranteed>>::{closure#0}, core[61d3efaba9c696db]::result::Result<(), rustc_span[67cae37aa81b7c83]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[61d3efaba9c696db]::result::Result<(), rustc_span[67cae37aa81b7c83]::ErrorGuaranteed>>::{closure#1} as core[61d3efaba9c696db]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  36:     0x7f554df999d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3063de10ed539a03
                               at /rustc/e9271846294c4ee5bd7706df68180320c0b5ff20/library/alloc/src/boxed.rs:2016:9
  37:     0x7f554df999d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::heefcae306faffc01
                               at /rustc/e9271846294c4ee5bd7706df68180320c0b5ff20/library/alloc/src/boxed.rs:2016:9
  38:     0x7f554df999d5 - std::sys::unix::thread::Thread::new::thread_start::h5c4b5675991b9c64
                               at /rustc/e9271846294c4ee5bd7706df68180320c0b5ff20/library/std/src/sys/unix/thread.rs:108:17
  39:     0x7f554dd859eb - <unknown>
  40:     0x7f554de097cc - <unknown>
  41:                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.77.0-nightly (e92718462 2024-01-10) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_mod_impl_wf] checking that impls are well-formed in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 11 previous errors

Some errors have detailed explanations: E0207, E0601, E0658.
For more information about an error, try `rustc --explain E0207`.

@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 Jan 10, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 10, 2024
@oli-obk oli-obk added P-low Low priority A-specialization Area: Trait impl specialization requires-nightly This issue requires a nightly compiler in some way. F-specialization `#![feature(specialization)]` F-effects `#![feature(effects)]` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 10, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Apr 15, 2024
@BoxyUwU
Copy link
Member

BoxyUwU commented May 29, 2024

This is caused by the fact that fully_resolve does not check for const effect vars when visiting Const. It should be relatively simple to match on InferConst::EffectVar in the folder.

@ajwock
Copy link
Contributor

ajwock commented Jun 1, 2024

Working on this one.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 3, 2024
…ee1-dead

Fix ICE caused by ignoring EffectVars in type inference

Fixes rust-lang#119830
​r? `@matthiaskrgr`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 3, 2024
…ee1-dead

Fix ICE caused by ignoring EffectVars in type inference

Fixes rust-lang#119830
​r? ``@matthiaskrgr``
@bors bors closed this as completed in 7699da4 Jun 4, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jun 4, 2024
Rollup merge of rust-lang#125865 - ajwock:ice_not_fully_resolved, r=fee1-dead

Fix ICE caused by ignoring EffectVars in type inference

Fixes rust-lang#119830
​r? ```@matthiaskrgr```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-specialization Area: Trait impl specialization C-bug Category: This is a bug. F-effects `#![feature(effects)]` F-specialization `#![feature(specialization)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority requires-nightly This issue requires a nightly compiler in some way. S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. 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.

5 participants