Skip to content

ICE could not unify ! with revealed type #135730

Closed
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

//@compile-flags: --edition=2024
fn foo() -> impl ?Future<Output = impl Send> {
    ()
}

fn main() {}

original:

fn foo() -> impl ?Future<Output = impl Send> {
    //~^ ERROR the size for values of type `impl ?Sized` cannot be known at compilation time
    ()
}

fn main() {}

Version information

rustc 1.86.0-nightly (678e669cc 2025-01-19)
binary: rustc
commit-hash: 678e669cc4aab51e3c3fff0660d45362fb830ebd
commit-date: 2025-01-19
host: x86_64-unknown-linux-gnu
release: 1.86.0-nightly
LLVM version: 19.1.7

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc --edition=2024

Program output

warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
 --> /tmp/icemaker_global_tempdir.qzKHRUKhhL4b/rustc_testrunner_tmpdir_reporting.uYhpe96WGOAh/mvce.rs:1:18
  |
1 | fn foo() -> impl ?Future<Output = impl Send> {
  |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `foo` is never used
 --> /tmp/icemaker_global_tempdir.qzKHRUKhhL4b/rustc_testrunner_tmpdir_reporting.uYhpe96WGOAh/mvce.rs:1:4
  |
1 | fn foo() -> impl ?Future<Output = impl Send> {
  |    ^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: 2 warnings emitted

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: could not unify `()` with revealed type:
                                expected opaque type, found `()`
 --> /tmp/icemaker_global_tempdir.qzKHRUKhhL4b/rustc_testrunner_tmpdir_reporting.uYhpe96WGOAh/mvce.rs:1:35
  |
1 | fn foo() -> impl ?Future<Output = impl Send> {
  |                                   ^^^^^^^^^
  |
note: delayed at compiler/rustc_hir_analysis/src/check/check.rs:396:34
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         4: rustc_hir_analysis::check::check::check_item_type
         5: rustc_hir_analysis::check::wfcheck::check_well_formed
         6: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
         7: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 1]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
         8: rustc_query_impl::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
         9: rustc_middle::query::plumbing::query_ensure_error_guaranteed::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 1]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, ()>
        10: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
        11: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        12: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalModDefId, rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        13: rustc_query_impl::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
        14: rustc_hir_analysis::check_crate
        15: rustc_interface::passes::run_required_analyses
        16: rustc_interface::passes::analysis
        17: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
        18: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        19: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        20: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
        21: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        22: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
        23: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        24: std::sys::pal::unix::thread::Thread::new::thread_start
        25: <unknown>
        26: <unknown>
 --> /tmp/icemaker_global_tempdir.qzKHRUKhhL4b/rustc_testrunner_tmpdir_reporting.uYhpe96WGOAh/mvce.rs:1:35
  |
1 | fn foo() -> impl ?Future<Output = impl Send> {
  |                                   ^^^^^^^^^

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.86.0-nightly (678e669cc 2025-01-19) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z dump-mir-dir=dir

query stack during panic:
end of query stack

Metadata

Metadata

Assignees

Labels

A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions