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

regression: ICE: Failed to normalize Alias(Opaque, AliasTy #135668

Open
BoxyUwU opened this issue Jan 18, 2025 · 5 comments
Open

regression: ICE: Failed to normalize Alias(Opaque, AliasTy #135668

BoxyUwU opened this issue Jan 18, 2025 · 5 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@BoxyUwU
Copy link
Member

BoxyUwU commented Jan 18, 2025

[INFO] [stdout] error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:168:90: Failed to normalize Alias(Opaque, AliasTy { args: [], def_id: DefId(0:850 ~ skynet[716d]::web::create_task::{opaque#0}::{opaque#0}), .. }), maybe try to call `try_normalize_erasing_regions` instead
@BoxyUwU BoxyUwU added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 18, 2025
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 18, 2025
@theemathas

This comment has been minimized.

@theemathas
Copy link
Contributor

theemathas commented Jan 18, 2025

Minimized:

use std::future::Future;

pub async fn foo() {
    let _ = create_task().await;
}

async fn create_task() -> impl Sized {
    bind(documentation)
}

async fn documentation() {
    include_str!("nonexistent");
}

fn bind<F>(_filter: F) -> impl Sized
where
    F: FilterBase,
{
    || -> <F as FilterBase>::Assoc { panic!() }
}

trait FilterBase {
    type Assoc;
}

impl<F, R> FilterBase for F
where
    F: Fn() -> R,
    // Removing the below line makes it correctly error on both stable and beta
    R: Future,
    // Removing the below line makes it ICE on both stable and beta
    R: Send,
    // Removing the above two bounds makes it ICE on stable but correctly error on beta
{
    type Assoc = F;
}

The above code correctly produces an error with cargo +stable build, but produces an ICE with cargo +beta build.

Error output
error: couldn't read `src/nonexistent`: No such file or directory (os error 2)
  --> src/lib.rs:12:5
   |
12 |     include_str!("nonexistent");
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)

error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:168:90: Failed to normalize Alias(Opaque, AliasTy { args: [], def_id: DefId(0:9 ~ playground[a52f]::create_task::{opaque#0}::{opaque#0}), .. }), maybe try to call `try_normalize_erasing_regions` instead


thread 'rustc' panicked at compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:168:90:
Box<dyn Any>
stack backtrace:
   0:     0x721839ee35ca - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h9fe8706f0b7b60e6
   1:     0x72183a6135e6 - core::fmt::write::h8ad1c8502cd006f5
   2:     0x72183b51dd51 - std::io::Write::write_fmt::h89d7067e8130387a
   3:     0x721839ee3422 - std::sys::backtrace::BacktraceLock::print::h2604f7f483ba81db
   4:     0x721839ee59c7 - std::panicking::default_hook::{{closure}}::h980e999aca8eb276
   5:     0x721839ee57b0 - std::panicking::default_hook::h807fe813e668e0ef
   6:     0x721839057218 - std[604c1f9fe749a3ed]::panicking::update_hook::<alloc[ffa4f392899a59d6]::boxed::Box<rustc_driver_impl[4eb5edc82c356bae]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x721839ee6213 - std::panicking::rust_panic_with_hook::hcd0adc674cd46b11
   8:     0x721839090011 - std[604c1f9fe749a3ed]::panicking::begin_panic::<rustc_errors[5a731b7919861d50]::ExplicitBug>::{closure#0}
   9:     0x7218390851f6 - std[604c1f9fe749a3ed]::sys::backtrace::__rust_end_short_backtrace::<std[604c1f9fe749a3ed]::panicking::begin_panic<rustc_errors[5a731b7919861d50]::ExplicitBug>::{closure#0}, !>
  10:     0x721839081c99 - std[604c1f9fe749a3ed]::panicking::begin_panic::<rustc_errors[5a731b7919861d50]::ExplicitBug>
  11:     0x721839099f71 - <rustc_errors[5a731b7919861d50]::diagnostic::BugAbort as rustc_errors[5a731b7919861d50]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x721839674093 - rustc_middle[3771967c7a7309a7]::util::bug::opt_span_bug_fmt::<rustc_span[af8ed1c1c0732708]::span_encoding::Span>::{closure#0}
  13:     0x72183965913a - rustc_middle[3771967c7a7309a7]::ty::context::tls::with_opt::<rustc_middle[3771967c7a7309a7]::util::bug::opt_span_bug_fmt<rustc_span[af8ed1c1c0732708]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x721839658fcb - rustc_middle[3771967c7a7309a7]::ty::context::tls::with_context_opt::<rustc_middle[3771967c7a7309a7]::ty::context::tls::with_opt<rustc_middle[3771967c7a7309a7]::util::bug::opt_span_bug_fmt<rustc_span[af8ed1c1c0732708]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x721837af4d70 - rustc_middle[3771967c7a7309a7]::util::bug::bug_fmt
  16:     0x72183abce06e - <rustc_middle[3771967c7a7309a7]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_type_ir[19e8b914371807c6]::fold::TypeFolder<rustc_middle[3771967c7a7309a7]::ty::context::TyCtxt>>::fold_ty
  17:     0x72183a8ab87f - <rustc_mir_dataflow[7733e32ee594b36e]::elaborate_drops::DropCtxt<rustc_mir_transform[fb5f6ede96b166b4]::elaborate_drops::ElaborateDropsCtxt>>::elaborate_drop
  18:     0x72183732106a - <rustc_mir_transform[fb5f6ede96b166b4]::elaborate_drops::ElaborateDrops as rustc_mir_transform[fb5f6ede96b166b4]::pass_manager::MirPass>::run_pass
  19:     0x72183a609a17 - rustc_mir_transform[fb5f6ede96b166b4]::run_analysis_to_runtime_passes
  20:     0x721837e03f7a - rustc_mir_transform[fb5f6ede96b166b4]::mir_drops_elaborated_and_const_checked
  21:     0x72183a9143f7 - rustc_query_impl[a4e03142de931e4f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a4e03142de931e4f]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3771967c7a7309a7]::query::erase::Erased<[u8; 8usize]>>
  22:     0x72183a91474e - rustc_query_system[499354da019e31b1]::query::plumbing::try_execute_query::<rustc_query_impl[a4e03142de931e4f]::DynamicConfig<rustc_data_structures[5d10024945ee32aa]::vec_cache::VecCache<rustc_span[af8ed1c1c0732708]::def_id::LocalDefId, rustc_middle[3771967c7a7309a7]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[499354da019e31b1]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[a4e03142de931e4f]::plumbing::QueryCtxt, false>
  23:     0x72183a91418d - rustc_query_impl[a4e03142de931e4f]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
  24:     0x72183a727239 - rustc_mir_transform[fb5f6ede96b166b4]::optimized_mir
  25:     0x72183a72695f - rustc_query_impl[a4e03142de931e4f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a4e03142de931e4f]::query_impl::optimized_mir::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3771967c7a7309a7]::query::erase::Erased<[u8; 8usize]>>
  26:     0x72183a6ef39f - rustc_query_system[499354da019e31b1]::query::plumbing::try_execute_query::<rustc_query_impl[a4e03142de931e4f]::DynamicConfig<rustc_query_system[499354da019e31b1]::query::caches::DefIdCache<rustc_middle[3771967c7a7309a7]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[a4e03142de931e4f]::plumbing::QueryCtxt, false>
  27:     0x72183a6ee85f - rustc_query_impl[a4e03142de931e4f]::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
  28:     0x72183a995560 - rustc_middle[3771967c7a7309a7]::query::plumbing::query_get_at::<rustc_query_system[499354da019e31b1]::query::caches::DefIdCache<rustc_middle[3771967c7a7309a7]::query::erase::Erased<[u8; 8usize]>>>
  29:     0x721839673925 - <rustc_middle[3771967c7a7309a7]::ty::context::TyCtxt>::coroutine_layout
  30:     0x721839e643fd - rustc_ty_utils[dd5813ad9bfce6f9]::layout::coroutine_layout
  31:     0x72183ac0a326 - rustc_ty_utils[dd5813ad9bfce6f9]::layout::layout_of_uncached
  32:     0x72183abfd7db - rustc_ty_utils[dd5813ad9bfce6f9]::layout::layout_of
  33:     0x72183abfd742 - rustc_query_impl[a4e03142de931e4f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a4e03142de931e4f]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3771967c7a7309a7]::query::erase::Erased<[u8; 16usize]>>
  34:     0x72183abfc785 - rustc_query_system[499354da019e31b1]::query::plumbing::try_execute_query::<rustc_query_impl[a4e03142de931e4f]::DynamicConfig<rustc_query_system[499354da019e31b1]::query::caches::DefaultCache<rustc_middle[3771967c7a7309a7]::ty::PseudoCanonicalInput<rustc_middle[3771967c7a7309a7]::ty::Ty>, rustc_middle[3771967c7a7309a7]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[a4e03142de931e4f]::plumbing::QueryCtxt, false>
  35:     0x72183abfc3a2 - rustc_query_impl[a4e03142de931e4f]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
  36:     0x72183b408a31 - <rustc_mir_transform[fb5f6ede96b166b4]::known_panics_lint::KnownPanicsLint as rustc_mir_transform[fb5f6ede96b166b4]::pass_manager::MirLint>::run_lint
  37:     0x72183a609a17 - rustc_mir_transform[fb5f6ede96b166b4]::run_analysis_to_runtime_passes
  38:     0x721837e03f7a - rustc_mir_transform[fb5f6ede96b166b4]::mir_drops_elaborated_and_const_checked
  39:     0x72183a9143f7 - rustc_query_impl[a4e03142de931e4f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a4e03142de931e4f]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3771967c7a7309a7]::query::erase::Erased<[u8; 8usize]>>
  40:     0x72183a91474e - rustc_query_system[499354da019e31b1]::query::plumbing::try_execute_query::<rustc_query_impl[a4e03142de931e4f]::DynamicConfig<rustc_data_structures[5d10024945ee32aa]::vec_cache::VecCache<rustc_span[af8ed1c1c0732708]::def_id::LocalDefId, rustc_middle[3771967c7a7309a7]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[499354da019e31b1]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[a4e03142de931e4f]::plumbing::QueryCtxt, false>
  41:     0x72183a91418d - rustc_query_impl[a4e03142de931e4f]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
  42:     0x72183aa57f71 - rustc_interface[6ccca059d52aaa56]::passes::run_required_analyses
  43:     0x72183b521bde - rustc_interface[6ccca059d52aaa56]::passes::analysis
  44:     0x72183b521baf - rustc_query_impl[a4e03142de931e4f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a4e03142de931e4f]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3771967c7a7309a7]::query::erase::Erased<[u8; 0usize]>>
  45:     0x72183b5a2ad5 - rustc_query_system[499354da019e31b1]::query::plumbing::try_execute_query::<rustc_query_impl[a4e03142de931e4f]::DynamicConfig<rustc_query_system[499354da019e31b1]::query::caches::SingleCache<rustc_middle[3771967c7a7309a7]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[a4e03142de931e4f]::plumbing::QueryCtxt, false>
  46:     0x72183b5a280e - rustc_query_impl[a4e03142de931e4f]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  47:     0x72183b56601e - rustc_interface[6ccca059d52aaa56]::passes::create_and_enter_global_ctxt::<core[80152c8e99758bdd]::option::Option<rustc_interface[6ccca059d52aaa56]::queries::Linker>, rustc_driver_impl[4eb5edc82c356bae]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  48:     0x72183b5cb396 - rustc_interface[6ccca059d52aaa56]::interface::run_compiler::<(), rustc_driver_impl[4eb5edc82c356bae]::run_compiler::{closure#0}>::{closure#1}
  49:     0x72183b4456c7 - std[604c1f9fe749a3ed]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[6ccca059d52aaa56]::util::run_in_thread_with_globals<rustc_interface[6ccca059d52aaa56]::util::run_in_thread_pool_with_globals<rustc_interface[6ccca059d52aaa56]::interface::run_compiler<(), rustc_driver_impl[4eb5edc82c356bae]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  50:     0x72183b445b64 - <<std[604c1f9fe749a3ed]::thread::Builder>::spawn_unchecked_<rustc_interface[6ccca059d52aaa56]::util::run_in_thread_with_globals<rustc_interface[6ccca059d52aaa56]::util::run_in_thread_pool_with_globals<rustc_interface[6ccca059d52aaa56]::interface::run_compiler<(), rustc_driver_impl[4eb5edc82c356bae]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[80152c8e99758bdd]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  51:     0x72183b447141 - std::sys::pal::unix::thread::Thread::new::thread_start::h757ffa7c64c641a9
  52:     0x72183cbd0a94 - <unknown>
  53:     0x72183cc5da34 - clone
  54:                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.85.0-beta.4 (752fecf80 2025-01-17) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `foo::{closure#0}`
#1 [optimized_mir] optimizing MIR for `foo::{closure#0}`
end of query stack
  • R: Future + Send: Correctly error on stable, ICE on beta
  • R: Send: Correctly error on both stable and beta
  • R: Future: ICE on both stable and beta
  • R: /* nothing */: ICE on stable, correctly error on beta

(In other words: The code ICEs on stable iff there is not an R: Send bound. The code ICEs on beta iff there is an R: Future bound.)

@ranger-ross
Copy link
Contributor

The most recent minimized example bisects to #134798 in nightly-2024-12-28

@theemathas
Copy link
Contributor

cc @compiler-errors (author of the aforementioned PR)

@compiler-errors
Copy link
Member

given this is error->ICE i'll consider this P-low. i'll look into a fix though.

@compiler-errors compiler-errors added P-low Low priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants