rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.34k stars 12.72k forks source link

regression: failed to normalize alias(opaque ...) #123276

Closed Mark-Simulacrum closed 4 months ago

Mark-Simulacrum commented 7 months ago
[INFO] [stdout] error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:187:90: Failed to normalize Alias(Opaque, AliasTy { args: [], def_id: DefId(0:10611 ~ skynet[2ead]::web::create_task::{opaque#0}::{opaque#0}) }), maybe try to call `try_normalize_erasing_regions` instead
apiraino commented 7 months ago

Trying to bisect. Not so easy because cargo-bisect runs on nightlies and on nightly this crate does not compile.

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-medium

kadiwa4 commented 6 months ago

Using a patched version of ahash 0.7.8 that doesn't activate feature(stdsimd):

searched nightlies: from nightly-2024-02-01 to nightly-2024-03-17 regressed nightly: nightly-2024-02-09 searched commit range: https://github.com/rust-lang/rust/compare/8ace7ea1f7cbba7b4f031e66c54ca237a0d65de6...98aa3624be70462d6a25ed5544333e3df62f4c66 regressed commit: https://github.com/rust-lang/rust/commit/af88f7db51f6f2a1472f9279d7c7e7c822afff77 (#120550 @oli-obk)

bisected with cargo-bisect-rustc v0.6.8 Host triple: aarch64-apple-darwin Reproduce with: ```bash cargo bisect-rustc --regress=ice --start=2024-02-01 --end=2024-03-17 ```

@rustbot label: -E-needs-bisection

oli-obk commented 6 months ago

Yea, this crate already errors with

error: couldn't read src/web/../../docs/web/index.html: No such file or directory (os error 2)
[INFO] [stdout]    --> src/web/mod.rs:114:20
[INFO] [stdout]     |
[INFO] [stdout] 114 |     Ok(reply::html(include_str!("../../docs/web/index.html")))
[INFO] [stdout]     |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout]     |
[INFO] [stdout]     = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)

before it ICEs, so while this is an ICE to be fixed, it's not beta critical

oli-obk commented 6 months ago

Using a patched version of ahash 0.7.8 that doesn't activate feature(stdsimd):

💀 nightly feature detection is starting to affect rustc development

kadiwa4 commented 6 months ago

Minimized:

async fn create_task() {
    _ = Some(async { bind(documentation_filter()) });
}

async fn bind<Fut, F: Filter<Future = Fut>>(_: F) {}

fn documentation_filter() -> impl Filter {
    AndThen
}

trait Filter {
    type Future;
}

struct AndThen;

impl Filter for AndThen
where
    Foo: Filter,
{
    type Future = ();
}
Produces ``` error[E0412]: cannot find type `Foo` in this scope --> src/lib.rs:19:5 | 19 | Foo: Filter, | ^^^ not found in this scope error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:187:90: Failed to normalize Coroutine(DefId(0:5 ~ tmp2[2e32]::create_task::{closure#0}::{closure#0}), [(), std::future::ResumeTy, (), Alias(Opaque, AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Opaque, AliasTy { args: [], def_id: DefId(0:19 ~ tmp2[2e32]::documentation_filter::{opaque#0}) })], def_id: DefId(0:12 ~ tmp2[2e32]::Filter::Future) }), Alias(Opaque, AliasTy { args: [], def_id: DefId(0:19 ~ tmp2[2e32]::documentation_filter::{opaque#0}) })], def_id: DefId(0:18 ~ tmp2[2e32]::bind::{opaque#0}) }), CoroutineWitness(DefId(0:5 ~ tmp2[2e32]::create_task::{closure#0}::{closure#0}), []), ()]), maybe try to call `try_normalize_erasing_regions` instead thread 'rustc' panicked at compiler/rustc_middle/src/util/bug.rs:35:44: Box stack backtrace: 0: 0x102f9eeac - ::fmt::h5f1ad299b62739b8 1: 0x102fe2e14 - core::fmt::write::he309f022a11c174d 2: 0x102f95478 - std::io::Write::write_fmt::h19fcf32f597a27fd 3: 0x102f9ed04 - std::sys_common::backtrace::print::hba726cdeff1b161d 4: 0x102fa1610 - std::panicking::default_hook::{{closure}}::h8b1d5cebc4deea2b 5: 0x102fa12f4 - std::panicking::default_hook::hba52536fc1e50063 6: 0x10c250fd8 - as core[e7ee6eaff9d1e9]::ops::function::Fn<(&dyn for<'a, 'b> core[e7ee6eaff9d1e9]::ops::function::Fn<(&'a core[e7ee6eaff9d1e9]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[e7ee6eaff9d1e9]::marker::Send + core[e7ee6eaff9d1e9]::marker::Sync, &core[e7ee6eaff9d1e9]::panic::panic_info::PanicInfo)>>::call 7: 0x102fa2044 - std::panicking::rust_panic_with_hook::h3a32dccb392f8664 8: 0x10c2eeca8 - std[667740e72467fa52]::panicking::begin_panic::::{closure#0} 9: 0x10c2eec5c - std[667740e72467fa52]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> 10: 0x110239c04 - std[667740e72467fa52]::panicking::begin_panic:: 11: 0x10c2fe12c - ::emit_producing_guarantee 12: 0x10cd7c164 - rustc_middle[468f886809330e9e]::util::bug::opt_span_bug_fmt::::{closure#0} 13: 0x10cd7461c - rustc_middle[468f886809330e9e]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} 14: 0x10cd745e8 - rustc_middle[468f886809330e9e]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> 15: 0x1102d44d0 - rustc_middle[468f886809330e9e]::util::bug::bug_fmt 16: 0x10c1cf22c - ::normalize_erasing_regions:: 17: 0x10c13020c - ::visit_rvalue 18: 0x10c13299c - ::visit_statement 19: 0x10c12e384 - rustc_const_eval[cf4dd5d2083d19ff]::transform::validate::validate_types 20: 0x10c12b268 - ::run_pass 21: 0x10d0a0160 - rustc_mir_transform[24ffb6cc83ca816a]::pass_manager::run_passes_inner 22: 0x10cf66298 - rustc_mir_transform[24ffb6cc83ca816a]::optimized_mir 23: 0x10d449e0c - rustc_query_impl[c603a22348a2ad2c]::plumbing::__rust_begin_short_backtrace::> 24: 0x10d5eb494 - >::call_once 25: 0x10d3b0a34 - rustc_query_system[cfb412240652a0f]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[c603a22348a2ad2c]::plumbing::QueryCtxt, false> 26: 0x10d4c0778 - rustc_query_impl[c603a22348a2ad2c]::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace 27: 0x10cc2da50 - rustc_middle[468f886809330e9e]::query::plumbing::query_get_at::>> 28: 0x10db59128 - rustc_ty_utils[547c1a16b17b7b35]::layout::layout_of_uncached 29: 0x10db5e0f0 - rustc_ty_utils[547c1a16b17b7b35]::layout::layout_of 30: 0x10d44e6d8 - rustc_query_impl[c603a22348a2ad2c]::plumbing::__rust_begin_short_backtrace::> 31: 0x10d4b7f84 - )>>::call_once 32: 0x10d3bc09c - rustc_query_system[cfb412240652a0f]::query::plumbing::try_execute_query::, rustc_middle[468f886809330e9e]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[c603a22348a2ad2c]::plumbing::QueryCtxt, false> 33: 0x10d4d455c - rustc_query_impl[c603a22348a2ad2c]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace 34: 0x10cf6b980 - rustc_middle[468f886809330e9e]::query::plumbing::query_get_at::, rustc_middle[468f886809330e9e]::query::erase::Erased<[u8; 16usize]>>> 35: 0x10cf76250 - ::run_lint 36: 0x10d09fc68 - rustc_mir_transform[24ffb6cc83ca816a]::pass_manager::run_passes_inner 37: 0x10cf65c44 - rustc_mir_transform[24ffb6cc83ca816a]::run_analysis_to_runtime_passes 38: 0x10cf6590c - rustc_mir_transform[24ffb6cc83ca816a]::mir_drops_elaborated_and_const_checked 39: 0x10d44de8c - rustc_query_impl[c603a22348a2ad2c]::plumbing::__rust_begin_short_backtrace::> 40: 0x10d556144 - >::call_once 41: 0x10d3fc1bc - rustc_query_system[cfb412240652a0f]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[c603a22348a2ad2c]::plumbing::QueryCtxt, false> 42: 0x10d4bf510 - rustc_query_impl[c603a22348a2ad2c]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace 43: 0x10c9e8364 - ::time::<(), rustc_interface[c64a2a395e992482]::passes::analysis::{closure#2}> 44: 0x10c993c58 - rustc_interface[c64a2a395e992482]::passes::analysis 45: 0x10d44e3b8 - rustc_query_impl[c603a22348a2ad2c]::plumbing::__rust_begin_short_backtrace::> 46: 0x10d50193c - >::call_once 47: 0x10d3b6460 - rustc_query_system[cfb412240652a0f]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[c603a22348a2ad2c]::plumbing::QueryCtxt, false> 48: 0x10d4bb9dc - rustc_query_impl[c603a22348a2ad2c]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace 49: 0x10c25d31c - ::enter::> 50: 0x10c25c544 - ::enter::, rustc_span[15d402de9654d1a3]::ErrorGuaranteed>> 51: 0x10c231c2c - rustc_span[15d402de9654d1a3]::create_session_globals_then::, rustc_interface[c64a2a395e992482]::interface::run_compiler, rustc_driver_impl[10f519aa03496fc]::run_compiler::{closure#0}>::{closure#0}> 52: 0x10c25a268 - std[667740e72467fa52]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[10f519aa03496fc]::run_compiler::{closure#0}>::{closure#0}, core[e7ee6eaff9d1e9]::result::Result<(), rustc_span[15d402de9654d1a3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e7ee6eaff9d1e9]::result::Result<(), rustc_span[15d402de9654d1a3]::ErrorGuaranteed>> 53: 0x10c239fdc - <::spawn_unchecked_, rustc_driver_impl[10f519aa03496fc]::run_compiler::{closure#0}>::{closure#0}, core[e7ee6eaff9d1e9]::result::Result<(), rustc_span[15d402de9654d1a3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e7ee6eaff9d1e9]::result::Result<(), rustc_span[15d402de9654d1a3]::ErrorGuaranteed>>::{closure#1} as core[e7ee6eaff9d1e9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 54: 0x102faa578 - std::sys::pal::unix::thread::Thread::new::thread_start::h720503677457678a 55: 0x199a6ef94 - __pthread_joiner_wake 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-beta.9 (205af5d6b 2024-04-23) running on aarch64-apple-darwin note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C strip=debuginfo note: some of the compiler flags provided by cargo are hidden query stack during panic: #0 [optimized_mir] optimizing MIR for `create_task::{closure#0}` #1 [layout_of] computing layout of `{async fn body@src/lib.rs:1:24: 3:2}` #2 [mir_drops_elaborated_and_const_checked] elaborating drops for `create_task` #3 [analysis] running analysis passes on this crate end of query stack For more information about this error, try `rustc --explain E0412`. error: could not compile `tmp2` (lib) due to 1 previous error ```

@rustbot label: -E-needs-mcve +S-has-mcve