Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ICE: could not unify () with revealed type #122445

Closed
matthiaskrgr opened this issue Mar 13, 2024 · 4 comments · Fixed by #122449
Closed

ICE: could not unify () with revealed type #122445

matthiaskrgr opened this issue Mar 13, 2024 · 4 comments · Fixed by #122449
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

trait Trait<T: ?Sized> {}

impl<T: ?Sized> Trait<T> for i32 {}

fn produce() -> impl for<'this, Args> Trait<(), Assoc = impl Trait<T>> {
    16
}

original:

// check-pass

#![feature(non_lifetime_binders)]
//~^ WARN the feature `non_lifetime_binders` is incomplete

trait Trait<T: ?Sized> {}

impl<T: ?Sized> Trait<T> for i32 {}

fn produce() -> impl for<'this, Args> Trait<(), Assoc = impl Trait<T>> {
    16
}

fn main() {
    let _ = produce();
}

Version information

rustc 1.78.0-nightly (d3555f3d8 2024-03-13)
binary: rustc
commit-hash: d3555f3d8e555ce488bbf8eee5eccdb66a464e14
commit-date: 2024-03-13
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

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

Program output

error[E0412]: cannot find type `T` in this scope
 --> /tmp/icemaker_global_tempdir.jrhNDGFnLcIQ/rustc_testrunner_tmpdir_reporting.90W5br0UFsBA/mvce.rs:5:68
  |
5 | fn produce() -> impl for<'this, Args> Trait<(), Assoc = impl Trait<T>> {
  |                                                                    ^ not found in this scope
  |
help: you might be missing a type parameter
  |
5 | fn produce<T>() -> impl for<'this, Args> Trait<(), Assoc = impl Trait<T>> {
  |           +++

error[E0658]: only lifetime parameters can be used in this context
 --> /tmp/icemaker_global_tempdir.jrhNDGFnLcIQ/rustc_testrunner_tmpdir_reporting.90W5br0UFsBA/mvce.rs:5:33
  |
5 | fn produce() -> impl for<'this, Args> Trait<(), Assoc = impl Trait<T>> {
  |                                 ^^^^
  |
  = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
  = help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable
  = note: this compiler was built on 2024-03-13; consider upgrading it if it is out of date

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.jrhNDGFnLcIQ/rustc_testrunner_tmpdir_reporting.90W5br0UFsBA/mvce.rs:7:2
  |
7 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.jrhNDGFnLcIQ/rustc_testrunner_tmpdir_reporting.90W5br0UFsBA/mvce.rs`

error[E0220]: associated type `Assoc` not found for `Trait`
 --> /tmp/icemaker_global_tempdir.jrhNDGFnLcIQ/rustc_testrunner_tmpdir_reporting.90W5br0UFsBA/mvce.rs:5:49
  |
5 | fn produce() -> impl for<'this, Args> Trait<(), Assoc = impl Trait<T>> {
  |                                                 ^^^^^ associated type `Assoc` not found

error: internal compiler error: could not unify `()` with revealed type:
                                expected opaque type, found `()`
 --> /tmp/icemaker_global_tempdir.jrhNDGFnLcIQ/rustc_testrunner_tmpdir_reporting.90W5br0UFsBA/mvce.rs:5:57
  |
5 | fn produce() -> impl for<'this, Args> Trait<(), Assoc = impl Trait<T>> {
  |                                                         ^^^^^^^^^^^^^

thread 'rustc' panicked at compiler/rustc_hir_analysis/src/check/check.rs:385:23:
Box<dyn Any>
stack backtrace:
   0:     0x7f442e4d46f2 - std::backtrace_rs::backtrace::libunwind::trace::h7176acefcd6ebe93
                               at /rustc/d3555f3d8e555ce488bbf8eee5eccdb66a464e14/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x7f442e4d46f2 - std::backtrace_rs::backtrace::trace_unsynchronized::h75bfe1905e297959
                               at /rustc/d3555f3d8e555ce488bbf8eee5eccdb66a464e14/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f442e4d46f2 - std::sys_common::backtrace::_print_fmt::h6ce29d3c0bb49396
                               at /rustc/d3555f3d8e555ce488bbf8eee5eccdb66a464e14/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f442e4d46f2 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3d16fb016120ee06
                               at /rustc/d3555f3d8e555ce488bbf8eee5eccdb66a464e14/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f442e5257fc - core::fmt::rt::Argument::fmt::hd6e6fdfe1420f311
                               at /rustc/d3555f3d8e555ce488bbf8eee5eccdb66a464e14/library/core/src/fmt/rt.rs:142:9
   5:     0x7f442e5257fc - core::fmt::write::he6616053916e1580
                               at /rustc/d3555f3d8e555ce488bbf8eee5eccdb66a464e14/library/core/src/fmt/mod.rs:1153:17
   6:     0x7f442e4c914f - std::io::Write::write_fmt::h07cf5ec830757168
                               at /rustc/d3555f3d8e555ce488bbf8eee5eccdb66a464e14/library/std/src/io/mod.rs:1843:15
   7:     0x7f442e4d44c4 - std::sys_common::backtrace::_print::h7ca0b368a5508322
                               at /rustc/d3555f3d8e555ce488bbf8eee5eccdb66a464e14/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f442e4d44c4 - std::sys_common::backtrace::print::hc11169b38563f320
                               at /rustc/d3555f3d8e555ce488bbf8eee5eccdb66a464e14/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f442e4d71cb - std::panicking::default_hook::{{closure}}::h899ca63dd84d9e9c
  10:     0x7f442e4d6f23 - std::panicking::default_hook::h7cbc607b0ee738f6
                               at /rustc/d3555f3d8e555ce488bbf8eee5eccdb66a464e14/library/std/src/panicking.rs:292:9
  11:     0x7f442b0ff78f - std[e4ca89aad17f16ea]::panicking::update_hook::<alloc[9e0163fdd9c805f6]::boxed::Box<rustc_driver_impl[40dea88607b53e45]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f442e4d7930 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hb09edab710f27bd5
                               at /rustc/d3555f3d8e555ce488bbf8eee5eccdb66a464e14/library/alloc/src/boxed.rs:2034:9
  13:     0x7f442e4d7930 - std::panicking::rust_panic_with_hook::h1ece5913ff12b66d
                               at /rustc/d3555f3d8e555ce488bbf8eee5eccdb66a464e14/library/std/src/panicking.rs:783:13
  14:     0x7f442b12be64 - std[e4ca89aad17f16ea]::panicking::begin_panic::<rustc_errors[c7acd035c265e7a]::ExplicitBug>::{closure#0}
  15:     0x7f442b128bd6 - std[e4ca89aad17f16ea]::sys_common::backtrace::__rust_end_short_backtrace::<std[e4ca89aad17f16ea]::panicking::begin_panic<rustc_errors[c7acd035c265e7a]::ExplicitBug>::{closure#0}, !>
  16:     0x7f442b1288b6 - std[e4ca89aad17f16ea]::panicking::begin_panic::<rustc_errors[c7acd035c265e7a]::ExplicitBug>
  17:     0x7f442b135271 - <rustc_errors[c7acd035c265e7a]::diagnostic::BugAbort as rustc_errors[c7acd035c265e7a]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7f442b1a8958 - <rustc_errors[c7acd035c265e7a]::DiagCtxt>::span_bug::<rustc_span[f288f51d3351f5c5]::span_encoding::Span, alloc[9e0163fdd9c805f6]::string::String>
  19:     0x7f442cf6959d - rustc_hir_analysis[bc30648c1e221e71]::check::check::check_item_type
  20:     0x7f442cae8613 - rustc_hir_analysis[bc30648c1e221e71]::check::wfcheck::check_well_formed
  21:     0x7f442cae70d5 - rustc_query_impl[1c7621cae8bc291d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1c7621cae8bc291d]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[62fffd65f45dee21]::query::erase::Erased<[u8; 1usize]>>
  22:     0x7f442cae67aa - rustc_query_system[47b9d6fa517bb73b]::query::plumbing::try_execute_query::<rustc_query_impl[1c7621cae8bc291d]::DynamicConfig<rustc_query_system[47b9d6fa517bb73b]::query::caches::VecCache<rustc_hir[5f26ea27f86d78be]::hir_id::OwnerId, rustc_middle[62fffd65f45dee21]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[1c7621cae8bc291d]::plumbing::QueryCtxt, false>
  23:     0x7f442cae6513 - rustc_query_impl[1c7621cae8bc291d]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  24:     0x7f442cae437a - rustc_hir_analysis[bc30648c1e221e71]::check::wfcheck::check_mod_type_wf
  25:     0x7f442cae41b7 - rustc_query_impl[1c7621cae8bc291d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1c7621cae8bc291d]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[62fffd65f45dee21]::query::erase::Erased<[u8; 1usize]>>
  26:     0x7f442cae34c6 - rustc_query_system[47b9d6fa517bb73b]::query::plumbing::try_execute_query::<rustc_query_impl[1c7621cae8bc291d]::DynamicConfig<rustc_query_system[47b9d6fa517bb73b]::query::caches::DefaultCache<rustc_span[f288f51d3351f5c5]::def_id::LocalModDefId, rustc_middle[62fffd65f45dee21]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[1c7621cae8bc291d]::plumbing::QueryCtxt, false>
  27:     0x7f442cae327f - rustc_query_impl[1c7621cae8bc291d]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7f442ccdd217 - rustc_hir_analysis[bc30648c1e221e71]::check_crate
  29:     0x7f442c9335fc - rustc_interface[9a3cd2d3c822e489]::passes::analysis
  30:     0x7f442c933251 - rustc_query_impl[1c7621cae8bc291d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1c7621cae8bc291d]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[62fffd65f45dee21]::query::erase::Erased<[u8; 1usize]>>
  31:     0x7f442d226a65 - rustc_query_system[47b9d6fa517bb73b]::query::plumbing::try_execute_query::<rustc_query_impl[1c7621cae8bc291d]::DynamicConfig<rustc_query_system[47b9d6fa517bb73b]::query::caches::SingleCache<rustc_middle[62fffd65f45dee21]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[1c7621cae8bc291d]::plumbing::QueryCtxt, false>
  32:     0x7f442d2267c9 - rustc_query_impl[1c7621cae8bc291d]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7f442cf47084 - rustc_interface[9a3cd2d3c822e489]::interface::run_compiler::<core[6c23e1c395e91352]::result::Result<(), rustc_span[f288f51d3351f5c5]::ErrorGuaranteed>, rustc_driver_impl[40dea88607b53e45]::run_compiler::{closure#0}>::{closure#0}
  34:     0x7f442d42dfc5 - std[e4ca89aad17f16ea]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[9a3cd2d3c822e489]::util::run_in_thread_with_globals<rustc_interface[9a3cd2d3c822e489]::util::run_in_thread_pool_with_globals<rustc_interface[9a3cd2d3c822e489]::interface::run_compiler<core[6c23e1c395e91352]::result::Result<(), rustc_span[f288f51d3351f5c5]::ErrorGuaranteed>, rustc_driver_impl[40dea88607b53e45]::run_compiler::{closure#0}>::{closure#0}, core[6c23e1c395e91352]::result::Result<(), rustc_span[f288f51d3351f5c5]::ErrorGuaranteed>>::{closure#0}, core[6c23e1c395e91352]::result::Result<(), rustc_span[f288f51d3351f5c5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[6c23e1c395e91352]::result::Result<(), rustc_span[f288f51d3351f5c5]::ErrorGuaranteed>>
  35:     0x7f442d42ddf2 - <<std[e4ca89aad17f16ea]::thread::Builder>::spawn_unchecked_<rustc_interface[9a3cd2d3c822e489]::util::run_in_thread_with_globals<rustc_interface[9a3cd2d3c822e489]::util::run_in_thread_pool_with_globals<rustc_interface[9a3cd2d3c822e489]::interface::run_compiler<core[6c23e1c395e91352]::result::Result<(), rustc_span[f288f51d3351f5c5]::ErrorGuaranteed>, rustc_driver_impl[40dea88607b53e45]::run_compiler::{closure#0}>::{closure#0}, core[6c23e1c395e91352]::result::Result<(), rustc_span[f288f51d3351f5c5]::ErrorGuaranteed>>::{closure#0}, core[6c23e1c395e91352]::result::Result<(), rustc_span[f288f51d3351f5c5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[6c23e1c395e91352]::result::Result<(), rustc_span[f288f51d3351f5c5]::ErrorGuaranteed>>::{closure#1} as core[6c23e1c395e91352]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  36:     0x7f442e4e1135 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4536aa42bd0d3113
                               at /rustc/d3555f3d8e555ce488bbf8eee5eccdb66a464e14/library/alloc/src/boxed.rs:2020:9
  37:     0x7f442e4e1135 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb91635e045c871b6
                               at /rustc/d3555f3d8e555ce488bbf8eee5eccdb66a464e14/library/alloc/src/boxed.rs:2020:9
  38:     0x7f442e4e1135 - std::sys::pal::unix::thread::Thread::new::thread_start::hacf3fcf155fa3642
                               at /rustc/d3555f3d8e555ce488bbf8eee5eccdb66a464e14/library/std/src/sys/pal/unix/thread.rs:108:17
  39:     0x7f44280a955a - <unknown>
  40:     0x7f4428126a3c - <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.78.0-nightly (d3555f3d8 2024-03-13) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_well_formed] checking that `produce::{opaque#0}::{opaque#0}` is well-formed
#1 [check_mod_type_wf] checking that types are well-formed in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors

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

@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. F-non_lifetime_binders `#![feature(non_lifetime_binders)]` labels Mar 13, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 13, 2024
@matthiaskrgr
Copy link
Member Author

crashes since #121796 cc @oli-obk

@oli-obk
Copy link
Contributor

oli-obk commented Mar 13, 2024

Note: ICEs aren't crashes, we have a separate label for crashes (they mean segfaults and similar)

@oli-obk oli-obk added the requires-nightly This issue requires a nightly compiler in some way. label Mar 13, 2024
@matthiaskrgr
Copy link
Member Author

ungraceful exit of the compiler has been observed since #121796 🙃

@compiler-errors
Copy link
Member

compiler-errors commented Mar 13, 2024

This has nothing to do with non-lifetime binders.

I somewhat expect that when a "minimized" repro is tagged with a feature tag, there has been an attempt to check that the ICE is actually dependent on the feature, since that affects the prioritization of the issue.

trait Trait {}

impl Trait for i32 {}

fn produce<T>() -> impl Trait<Assoc = impl Trait> {
    16
}

@matthiaskrgr matthiaskrgr removed the F-non_lifetime_binders `#![feature(non_lifetime_binders)]` label Mar 13, 2024
@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 13, 2024
@bors bors closed this as completed in c52ce4e Mar 14, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 14, 2024
Rollup merge of rust-lang#122449 - compiler-errors:stranded-opaque, r=oli-obk

Delay a bug for stranded opaques

r? oli-obk

Fixes rust-lang#122445
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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.

5 participants