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 could not unify ! with revealed type #135730

Open
matthiaskrgr opened this issue Jan 19, 2025 · 3 comments · May be fixed by #135841
Open

ICE could not unify ! with revealed type #135730

matthiaskrgr opened this issue Jan 19, 2025 · 3 comments · May be fixed by #135841
Assignees
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. fixed-by-next-solver Fixed by the next-generation trait solver, `-Znext-solver`. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. 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):

//@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

@matthiaskrgr matthiaskrgr added C-bug Category: This is a bug. 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. labels Jan 19, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 19, 2025
@fmease fmease added A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. fixed-by-next-solver Fixed by the next-generation trait solver, `-Znext-solver`. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 19, 2025
@matthiaskrgr
Copy link
Member Author

matthiaskrgr commented Jan 20, 2025

use std::future::Future;
fn foo() -> impl ?Future<Output = impl Send> {
    ()
}

pub fn main() {}

I guess edition 2024 added Future to the prelude which is why the flag showed up as "required"

The above example compiles with nightly-2024-03-11 but ICEs with nightly-2024-03-12

@matthiaskrgr matthiaskrgr added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Jan 20, 2025
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jan 20, 2025
@matthiaskrgr
Copy link
Member Author


Regression in nightly-2024-03-12


fetching https://static.rust-lang.org/dist/2024-03-11/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2024-03-11: 40 B / 40 B [==============================================================================================] 100.00 % 1.21 MB/s converted 2024-03-11 to 3b1717c
fetching https://static.rust-lang.org/dist/2024-03-12/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2024-03-12: 40 B / 40 B [==============================================================================================] 100.00 % 1.20 MB/s converted 2024-03-12 to 4a0cc88
looking for regression commit between 2024-03-11 and 2024-03-12
fetching (via remote github) commits from max(3b1717c, 2024-03-09) to 4a0cc88
ending github query because we found starting sha: 3b1717c
get_commits_between returning commits, len: 12
commit[0] 2024-03-10: Auto merge of #122306 - workingjubilee:backtrace-0.3.70, r=workingjubilee
commit[1] 2024-03-10: Auto merge of #122312 - matthiaskrgr:rollup-0p8y7gg, r=matthiaskrgr
commit[2] 2024-03-11: Auto merge of #122132 - nnethercote:diag-renaming3, r=nnethercote
commit[3] 2024-03-11: Auto merge of #121752 - mu001999:dead_code/improve, r=pnkfelix
commit[4] 2024-03-11: Auto merge of #122050 - erikdesjardins:sret, r=nikic
commit[5] 2024-03-11: Auto merge of #117156 - jmillikin:os-unix-socket-ext, r=Amanieu,dtolnay
commit[6] 2024-03-11: Auto merge of #122331 - jhpratt:rollup-cbl8xsy, r=jhpratt
commit[7] 2024-03-11: Auto merge of #122305 - Nilstrieb:target-tiers, r=davidtwco
commit[8] 2024-03-11: Auto merge of #122140 - oli-obk:track_errors13, r=davidtwco
commit[9] 2024-03-11: Auto merge of #122338 - workingjubilee:rollup-xzpt4v4, r=workingjubilee
commit[10] 2024-03-11: Auto merge of #121796 - oli-obk:eager_opaque_checks3, r=lcnr
commit[11] 2024-03-11: Auto merge of #112267 - lqd:win-1cgu, r=Kobzol

@matthiaskrgr
Copy link
Member Author

my guess would be #121796 🤔

@lcnr lcnr added P-low Low priority P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. P-low Low priority labels Jan 21, 2025
@oli-obk oli-obk self-assigned this Jan 21, 2025
bors added a commit to rust-lang-ci/rust that referenced this issue Jan 21, 2025
Reject `impl Trait` within `?Trait` generics or assoc ty bounds

fixes rust-lang#135730

Also a breaking change, so let's see what crater says.

This has been an unconditional warning since *before* 1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. fixed-by-next-solver Fixed by the next-generation trait solver, `-Znext-solver`. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. 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