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: compiler/rustc_hir/src/stable_hash_impls.rs None with cargo build of async fn in trait #122508

Closed
matthiaskrgr opened this issue Mar 14, 2024 · 11 comments · Fixed by #122517
Closed
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-critical Critical priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue 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 MyTrait {
    async fn bar(&self) -> i32;
}

original:

#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]

trait MyTrait {
    async fn foo(&self) -> i32;
    async fn bar(&self) -> i32;
}

impl MyTrait for i32 {
    async fn MyTrait(&self) -> i32 {
        *self
    }

    async fn bar(&self) -> i32 {
        self.foo().await
    }
}

fn main() {}

Version information

rustc 1.78.0-nightly (fe6157522 2024-03-14)
binary: rustc
commit-hash: fe6157522848604562f83084154274c545fe3a27
commit-date: 2024-03-14
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zincremental-verify-ich=yes -Cincremental=<dir> -Cdebuginfo=2

Program output

error[E0670]: `async fn` is not permitted in Rust 2015
 --> /tmp/icemaker_global_tempdir.nahpMDltHSnV/rustc_testrunner_tmpdir_reporting.DGRSKJhbAldC/mvce.rs:2:5
  |
2 |     async fn bar(&self) -> i32;
  |     ^^^^^ to use `async fn`, switch to Rust 2018 or later
  |
  = help: pass `--edition 2021` to `rustc`
  = note: for more on editions, read https://doc.rust-lang.org/edition-guide

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

thread 'rustc' panicked at /rustc/fe6157522848604562f83084154274c545fe3a27/compiler/rustc_hir/src/stable_hash_impls.rs:97:35:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x7f738718c902 - std::backtrace_rs::backtrace::libunwind::trace::h04d3f68962db70a2
                               at /rustc/fe6157522848604562f83084154274c545fe3a27/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x7f738718c902 - std::backtrace_rs::backtrace::trace_unsynchronized::h8622c2bf3f1d5ffd
                               at /rustc/fe6157522848604562f83084154274c545fe3a27/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f738718c902 - std::sys_common::backtrace::_print_fmt::h8d75f4d5405ad14b
                               at /rustc/fe6157522848604562f83084154274c545fe3a27/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f738718c902 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2c6bd99000dd0bf9
                               at /rustc/fe6157522848604562f83084154274c545fe3a27/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f73871ddc5c - core::fmt::rt::Argument::fmt::h517cf1f14c25baae
                               at /rustc/fe6157522848604562f83084154274c545fe3a27/library/core/src/fmt/rt.rs:142:9
   5:     0x7f73871ddc5c - core::fmt::write::h99fe5948aa1aba14
                               at /rustc/fe6157522848604562f83084154274c545fe3a27/library/core/src/fmt/mod.rs:1153:17
   6:     0x7f73871817ff - std::io::Write::write_fmt::h01412846dad28bf6
                               at /rustc/fe6157522848604562f83084154274c545fe3a27/library/std/src/io/mod.rs:1843:15
   7:     0x7f738718c6d4 - std::sys_common::backtrace::_print::h3470b0baf687e467
                               at /rustc/fe6157522848604562f83084154274c545fe3a27/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f738718c6d4 - std::sys_common::backtrace::print::h05286ca51f8e1745
                               at /rustc/fe6157522848604562f83084154274c545fe3a27/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f738718f3db - std::panicking::default_hook::{{closure}}::hd6705566bb345b29
  10:     0x7f738718f133 - std::panicking::default_hook::hd1de05b1a0fb6145
                               at /rustc/fe6157522848604562f83084154274c545fe3a27/library/std/src/panicking.rs:292:9
  11:     0x7f738a108b4f - std[da7e6d9d2d140271]::panicking::update_hook::<alloc[8351d74e211dacf4]::boxed::Box<rustc_driver_impl[17e7e644b21a572c]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f738718fb40 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::he02eef82f40e4d18
                               at /rustc/fe6157522848604562f83084154274c545fe3a27/library/alloc/src/boxed.rs:2034:9
  13:     0x7f738718fb40 - std::panicking::rust_panic_with_hook::h294f7b939906ee86
                               at /rustc/fe6157522848604562f83084154274c545fe3a27/library/std/src/panicking.rs:783:13
  14:     0x7f738718f849 - std::panicking::begin_panic_handler::{{closure}}::hc6bf729e15cf864d
                               at /rustc/fe6157522848604562f83084154274c545fe3a27/library/std/src/panicking.rs:649:13
  15:     0x7f738718cdd6 - std::sys_common::backtrace::__rust_end_short_backtrace::h003548bc9ef0065f
                               at /rustc/fe6157522848604562f83084154274c545fe3a27/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f738718f5b4 - rust_begin_unwind
                               at /rustc/fe6157522848604562f83084154274c545fe3a27/library/std/src/panicking.rs:645:5
  17:     0x7f73871da175 - core::panicking::panic_fmt::hdbbe1ed9f6bec1af
                               at /rustc/fe6157522848604562f83084154274c545fe3a27/library/core/src/panicking.rs:72:14
  18:     0x7f73871da233 - core::panicking::panic::h5b2a2d202380131b
                               at /rustc/fe6157522848604562f83084154274c545fe3a27/library/core/src/panicking.rs:145:5
  19:     0x7f73871d9f06 - core::option::unwrap_failed::hbafee380a201b79f
                               at /rustc/fe6157522848604562f83084154274c545fe3a27/library/core/src/option.rs:1985:5
  20:     0x7f738ac62ae9 - rustc_query_system[25477918277334a0]::dep_graph::graph::hash_result::<core[7bc0e81c83c7b2c5]::option::Option<&rustc_hir[c53db5b3a21d46be]::hir::OwnerNodes>>
  21:     0x7f738ac97109 - rustc_ty_utils[c6744ff33f9121ef]::assoc::feed_hir
  22:     0x7f738ac983bb - rustc_ty_utils[c6744ff33f9121ef]::assoc::associated_type_for_impl_trait_in_trait
  23:     0x7f738a930cc7 - rustc_query_impl[20a0b58a2f23eb28]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[20a0b58a2f23eb28]::query_impl::associated_type_for_impl_trait_in_trait::dynamic_query::{closure#2}::{closure#0}, rustc_middle[adb49fe0971a482e]::query::erase::Erased<[u8; 4usize]>>
  24:     0x7f738baaf6fc - rustc_query_system[25477918277334a0]::query::plumbing::try_execute_query::<rustc_query_impl[20a0b58a2f23eb28]::DynamicConfig<rustc_query_system[25477918277334a0]::query::caches::VecCache<rustc_span[64111255fd428194]::def_id::LocalDefId, rustc_middle[adb49fe0971a482e]::query::erase::Erased<[u8; 4usize]>>, false, false, false>, rustc_query_impl[20a0b58a2f23eb28]::plumbing::QueryCtxt, true>
  25:     0x7f738a938a1a - rustc_query_impl[20a0b58a2f23eb28]::query_impl::associated_type_for_impl_trait_in_trait::get_query_incr::__rust_end_short_backtrace
  26:     0x7f738ac7aa19 - <core[7bc0e81c83c7b2c5]::iter::adapters::map::Map<indexmap[96378ee9fff0bfc]::set::iter::Iter<rustc_span[64111255fd428194]::def_id::LocalDefId>, rustc_ty_utils[c6744ff33f9121ef]::assoc::associated_types_for_impl_traits_in_associated_fn::{closure#0}> as core[7bc0e81c83c7b2c5]::iter::traits::iterator::Iterator>::next
  27:     0x7f738bc7bbc2 - rustc_ty_utils[c6744ff33f9121ef]::assoc::associated_types_for_impl_traits_in_associated_fn
  28:     0x7f738bc7b7b4 - rustc_query_impl[20a0b58a2f23eb28]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[20a0b58a2f23eb28]::query_impl::associated_types_for_impl_traits_in_associated_fn::dynamic_query::{closure#2}::{closure#0}, rustc_middle[adb49fe0971a482e]::query::erase::Erased<[u8; 16usize]>>
  29:     0x7f738bc7b789 - <rustc_query_impl[20a0b58a2f23eb28]::query_impl::associated_types_for_impl_traits_in_associated_fn::dynamic_query::{closure#2} as core[7bc0e81c83c7b2c5]::ops::function::FnOnce<(rustc_middle[adb49fe0971a482e]::ty::context::TyCtxt, rustc_span[64111255fd428194]::def_id::DefId)>>::call_once
  30:     0x7f738b98146a - rustc_query_system[25477918277334a0]::query::plumbing::try_execute_query::<rustc_query_impl[20a0b58a2f23eb28]::DynamicConfig<rustc_query_system[25477918277334a0]::query::caches::DefIdCache<rustc_middle[adb49fe0971a482e]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[20a0b58a2f23eb28]::plumbing::QueryCtxt, true>
  31:     0x7f738b97f8e3 - rustc_query_impl[20a0b58a2f23eb28]::query_impl::associated_types_for_impl_traits_in_associated_fn::get_query_incr::__rust_end_short_backtrace
  32:     0x7f738bc7bd90 - rustc_middle[adb49fe0971a482e]::query::plumbing::query_get_at::<rustc_query_system[25477918277334a0]::query::caches::DefIdCache<rustc_middle[adb49fe0971a482e]::query::erase::Erased<[u8; 16usize]>>>
  33:     0x7f738bc7a4c6 - rustc_arena[a1eb1bb71a24e11a]::outline::<<rustc_arena[a1eb1bb71a24e11a]::DroplessArena>::alloc_from_iter<rustc_span[64111255fd428194]::def_id::DefId, core[7bc0e81c83c7b2c5]::iter::adapters::chain::Chain<core[7bc0e81c83c7b2c5]::iter::adapters::map::Map<core[7bc0e81c83c7b2c5]::slice::iter::Iter<rustc_hir[c53db5b3a21d46be]::hir::TraitItemRef>, rustc_ty_utils[c6744ff33f9121ef]::assoc::associated_item_def_ids::{closure#0}>, core[7bc0e81c83c7b2c5]::iter::adapters::copied::Copied<core[7bc0e81c83c7b2c5]::iter::adapters::flatten::FlatMap<core[7bc0e81c83c7b2c5]::iter::adapters::filter::Filter<core[7bc0e81c83c7b2c5]::slice::iter::Iter<rustc_hir[c53db5b3a21d46be]::hir::TraitItemRef>, rustc_ty_utils[c6744ff33f9121ef]::assoc::associated_item_def_ids::{closure#1}>, &[rustc_span[64111255fd428194]::def_id::DefId], rustc_ty_utils[c6744ff33f9121ef]::assoc::associated_item_def_ids::{closure#2}>>>>::{closure#0}, &mut [rustc_span[64111255fd428194]::def_id::DefId]>
  34:     0x7f738b7f45f0 - rustc_ty_utils[c6744ff33f9121ef]::assoc::associated_item_def_ids
  35:     0x7f738b705541 - rustc_query_impl[20a0b58a2f23eb28]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[20a0b58a2f23eb28]::query_impl::associated_item_def_ids::dynamic_query::{closure#2}::{closure#0}, rustc_middle[adb49fe0971a482e]::query::erase::Erased<[u8; 16usize]>>
  36:     0x7f738b705515 - <rustc_query_impl[20a0b58a2f23eb28]::query_impl::associated_item_def_ids::dynamic_query::{closure#2} as core[7bc0e81c83c7b2c5]::ops::function::FnOnce<(rustc_middle[adb49fe0971a482e]::ty::context::TyCtxt, rustc_span[64111255fd428194]::def_id::DefId)>>::call_once
  37:     0x7f738b98146a - rustc_query_system[25477918277334a0]::query::plumbing::try_execute_query::<rustc_query_impl[20a0b58a2f23eb28]::DynamicConfig<rustc_query_system[25477918277334a0]::query::caches::DefIdCache<rustc_middle[adb49fe0971a482e]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[20a0b58a2f23eb28]::plumbing::QueryCtxt, true>
  38:     0x7f738b97fb87 - rustc_query_impl[20a0b58a2f23eb28]::query_impl::associated_item_def_ids::get_query_incr::__rust_end_short_backtrace
  39:     0x7f738bc6b8dd - rustc_ty_utils[c6744ff33f9121ef]::assoc::associated_items
  40:     0x7f738bc6b636 - rustc_query_impl[20a0b58a2f23eb28]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[20a0b58a2f23eb28]::query_impl::associated_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle[adb49fe0971a482e]::query::erase::Erased<[u8; 8usize]>>
  41:     0x7f738b80d8f9 - rustc_query_system[25477918277334a0]::query::plumbing::try_execute_query::<rustc_query_impl[20a0b58a2f23eb28]::DynamicConfig<rustc_query_system[25477918277334a0]::query::caches::DefIdCache<rustc_middle[adb49fe0971a482e]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[20a0b58a2f23eb28]::plumbing::QueryCtxt, true>
  42:     0x7f738b926d47 - rustc_query_impl[20a0b58a2f23eb28]::query_impl::associated_items::get_query_incr::__rust_end_short_backtrace
  43:     0x7f738b4b8254 - rustc_middle[adb49fe0971a482e]::query::plumbing::query_get_at::<rustc_query_system[25477918277334a0]::query::caches::DefIdCache<rustc_middle[adb49fe0971a482e]::query::erase::Erased<[u8; 8usize]>>>
  44:     0x7f738bf51203 - rustc_hir_analysis[f25c3b69d0967229]::check::wfcheck::check_trait
  45:     0x7f738bae7cfc - rustc_hir_analysis[f25c3b69d0967229]::check::wfcheck::check_well_formed
  46:     0x7f738bae64ab - rustc_query_impl[20a0b58a2f23eb28]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[20a0b58a2f23eb28]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[adb49fe0971a482e]::query::erase::Erased<[u8; 1usize]>>
  47:     0x7f738b92d464 - rustc_query_system[25477918277334a0]::query::plumbing::try_execute_query::<rustc_query_impl[20a0b58a2f23eb28]::DynamicConfig<rustc_query_system[25477918277334a0]::query::caches::VecCache<rustc_hir[c53db5b3a21d46be]::hir_id::OwnerId, rustc_middle[adb49fe0971a482e]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[20a0b58a2f23eb28]::plumbing::QueryCtxt, true>
  48:     0x7f738b92cf6f - rustc_query_impl[20a0b58a2f23eb28]::query_impl::check_well_formed::get_query_incr::__rust_end_short_backtrace
  49:     0x7f738bae36fa - rustc_hir_analysis[f25c3b69d0967229]::check::wfcheck::check_mod_type_wf
  50:     0x7f738bae3537 - rustc_query_impl[20a0b58a2f23eb28]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[20a0b58a2f23eb28]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[adb49fe0971a482e]::query::erase::Erased<[u8; 1usize]>>
  51:     0x7f738bae19d3 - rustc_query_system[25477918277334a0]::query::plumbing::try_execute_query::<rustc_query_impl[20a0b58a2f23eb28]::DynamicConfig<rustc_query_system[25477918277334a0]::query::caches::DefaultCache<rustc_span[64111255fd428194]::def_id::LocalModDefId, rustc_middle[adb49fe0971a482e]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[20a0b58a2f23eb28]::plumbing::QueryCtxt, true>
  52:     0x7f738b96804a - rustc_query_impl[20a0b58a2f23eb28]::query_impl::check_mod_type_wf::get_query_incr::__rust_end_short_backtrace
  53:     0x7f738b968397 - rustc_hir_analysis[f25c3b69d0967229]::check_crate
  54:     0x7f738bb8742a - rustc_interface[2a44aa61faca3666]::passes::analysis
  55:     0x7f738bb87065 - rustc_query_impl[20a0b58a2f23eb28]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[20a0b58a2f23eb28]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[adb49fe0971a482e]::query::erase::Erased<[u8; 1usize]>>
  56:     0x7f738c236a22 - rustc_query_system[25477918277334a0]::query::plumbing::try_execute_query::<rustc_query_impl[20a0b58a2f23eb28]::DynamicConfig<rustc_query_system[25477918277334a0]::query::caches::SingleCache<rustc_middle[adb49fe0971a482e]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[20a0b58a2f23eb28]::plumbing::QueryCtxt, true>
  57:     0x7f738c236626 - rustc_query_impl[20a0b58a2f23eb28]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  58:     0x7f738bec40c4 - rustc_interface[2a44aa61faca3666]::interface::run_compiler::<core[7bc0e81c83c7b2c5]::result::Result<(), rustc_span[64111255fd428194]::ErrorGuaranteed>, rustc_driver_impl[17e7e644b21a572c]::run_compiler::{closure#0}>::{closure#0}
  59:     0x7f738c472545 - std[da7e6d9d2d140271]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[2a44aa61faca3666]::util::run_in_thread_with_globals<rustc_interface[2a44aa61faca3666]::util::run_in_thread_pool_with_globals<rustc_interface[2a44aa61faca3666]::interface::run_compiler<core[7bc0e81c83c7b2c5]::result::Result<(), rustc_span[64111255fd428194]::ErrorGuaranteed>, rustc_driver_impl[17e7e644b21a572c]::run_compiler::{closure#0}>::{closure#0}, core[7bc0e81c83c7b2c5]::result::Result<(), rustc_span[64111255fd428194]::ErrorGuaranteed>>::{closure#0}, core[7bc0e81c83c7b2c5]::result::Result<(), rustc_span[64111255fd428194]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7bc0e81c83c7b2c5]::result::Result<(), rustc_span[64111255fd428194]::ErrorGuaranteed>>
  60:     0x7f738c472372 - <<std[da7e6d9d2d140271]::thread::Builder>::spawn_unchecked_<rustc_interface[2a44aa61faca3666]::util::run_in_thread_with_globals<rustc_interface[2a44aa61faca3666]::util::run_in_thread_pool_with_globals<rustc_interface[2a44aa61faca3666]::interface::run_compiler<core[7bc0e81c83c7b2c5]::result::Result<(), rustc_span[64111255fd428194]::ErrorGuaranteed>, rustc_driver_impl[17e7e644b21a572c]::run_compiler::{closure#0}>::{closure#0}, core[7bc0e81c83c7b2c5]::result::Result<(), rustc_span[64111255fd428194]::ErrorGuaranteed>>::{closure#0}, core[7bc0e81c83c7b2c5]::result::Result<(), rustc_span[64111255fd428194]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7bc0e81c83c7b2c5]::result::Result<(), rustc_span[64111255fd428194]::ErrorGuaranteed>>::{closure#1} as core[7bc0e81c83c7b2c5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  61:     0x7f73871991d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb91162b0b688133b
                               at /rustc/fe6157522848604562f83084154274c545fe3a27/library/alloc/src/boxed.rs:2020:9
  62:     0x7f73871991d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hfe6e861eab2d00fa
                               at /rustc/fe6157522848604562f83084154274c545fe3a27/library/alloc/src/boxed.rs:2020:9
  63:     0x7f73871991d5 - std::sys::pal::unix::thread::Thread::new::thread_start::heab36b33e6209afa
                               at /rustc/fe6157522848604562f83084154274c545fe3a27/library/std/src/sys/pal/unix/thread.rs:108:17
  64:     0x7f7386f8155a - <unknown>
  65:     0x7f7386ffea3c - <unknown>
  66:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

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 (fe6157522 2024-03-14) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z incremental-verify-ich=yes -C incremental=[REDACTED] -C debuginfo=2

query stack during panic:
#0 [associated_type_for_impl_trait_in_trait] creating the associated item corresponding to the opaque type `MyTrait::bar::{opaque#0}`
#1 [associated_types_for_impl_traits_in_associated_fn] creating associated items for opaque types returned by `MyTrait::bar`
#2 [associated_item_def_ids] collecting associated items or fields of `MyTrait`
#3 [associated_items] collecting associated items of `MyTrait`
#4 [check_well_formed] checking that `MyTrait` is well-formed
#5 [check_mod_type_wf] checking that types are well-formed in top-level module
#6 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors

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

@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. labels Mar 14, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 14, 2024
@matthiaskrgr matthiaskrgr added P-critical Critical priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. labels Mar 14, 2024
@matthiaskrgr
Copy link
Member Author

This will probably make a simple cargo build crash in a lot of cases :3

@matthiaskrgr matthiaskrgr added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. and removed regression-from-stable-to-stable Performance or correctness regression from one stable version to another. labels Mar 14, 2024
@matthiaskrgr
Copy link
Member Author

#120943 cc @petrochenkov

@matthiaskrgr
Copy link
Member Author

minimal repro:

cargo new dontpanic
cd dontpanic
echo "trait MyTrait {
    async fn bar(&self) -> i32;
}

pub fn main() {}" > src/main.rs
cargo +master build

@jieyouxu jieyouxu added S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 14, 2024
@matthiaskrgr matthiaskrgr changed the title ICE: compiler/rustc_hir/src/stable_hash_impls.rs None ICE: compiler/rustc_hir/src/stable_hash_impls.rs None with cargo build of async fn in trait Mar 14, 2024
@petrochenkov petrochenkov self-assigned this Mar 14, 2024
@petrochenkov
Copy link
Contributor

Hmm, when writing #120943 I tried to trigger the opt_hash_including_bodies.unwrap() case by enabling -Cincremental, but it didn't ICE.
I'll check what is the difference with what cargo does.

@petrochenkov
Copy link
Contributor

Fixed in #122517.

bors added a commit to rust-lang-ci/rust that referenced this issue Mar 14, 2024
Fill in HIR hash for associated opaque types

Fixes rust-lang#122508
@bors bors closed this as completed in ee03c28 Mar 15, 2024
@matthiaskrgr matthiaskrgr pinned this issue Mar 15, 2024
@matthiaskrgr
Copy link
Member Author

A workaround to this issue should be to use cargo check --release or cargo build --release which should disable incremental compilation.

@zhuxiujia
Copy link

zhuxiujia commented Mar 15, 2024

A workaround to this issue should be to use cargo check --release or cargo build --release which should disable incremental compilation.

run cargo test on nightly rust also [ICE: compiler/rustc_hir/src/stable_hash_impls.rs None with cargo build of async fn in trait](https://github.com/rust-lang/rust/issues/122508#top) #122508

but. if you use rustup default stable to switch stable version rust
will be run cargo test will successful

@lqd
Copy link
Member

lqd commented Mar 15, 2024

…which should disable incremental compilation.

There’s also an environment variable to control incremental compilation, so you could set CARGO_INCREMENTAL=0 to do that.

@zhuxiujia
Copy link

…which should disable incremental compilation.

There’s also an environment variable to control incremental compilation, so you could set CARGO_INCREMENTAL=0 to do that.

I think this error should be completely fixed, otherwise it will still fail to compile in the IDE environment and the automatic build environment of GitHub Action

@lqd
Copy link
Member

lqd commented Mar 15, 2024

Sure, we were just offering a workaround to unblock people temporarily. The fix is already present on master and should be available in tomorrow’s nightly.

@zhuxiujia
Copy link

Sure, we were just offering a workaround to unblock people temporarily. The fix is already present on master and should be available in tomorrow’s nightly.

Oh, this is great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-critical Critical priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue 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.

6 participants