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: tcx.dcx().has_errors().is_some() #120856

Closed
matthiaskrgr opened this issue Feb 9, 2024 · 7 comments · Fixed by #120859
Closed

ICE: tcx.dcx().has_errors().is_some() #120856

matthiaskrgr opened this issue Feb 9, 2024 · 7 comments · Fixed by #120859
Assignees
Labels
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.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

pub type Archived<T> = <m::Alias as m::Trait>::Archived;

fn main() {}

original:

// check-pass
pub trait Archive {
    type Archived;
}

impl<T> Archive for Option<T> {
    type Archived = ();
}
pub type Archived<T> = <m::Alias as m::Trait>::Archived;

pub trait Deserialize<D> {}

const ARRAY_SIZE: usize = 32;
impl<__D> Deserialize<__D> for ()
where
    Option<[u8; ARRAY_SIZE]>: Archive,
    Archived<Option<[u8; ARRAY_SIZE]>>: Deserialize<__D>,
{
}
fn main() {}

Version information

rustc 1.78.0-nightly (e28fae52d 2024-02-09)
binary: rustc
commit-hash: e28fae52d99d7c14bf0890d1f2b13c2c34fa8932
commit-date: 2024-02-09
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 17.0.6

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

thread 'rustc' panicked at compiler/rustc_hir_analysis/src/check/check.rs:1286:9:
assertion failed: tcx.dcx().has_errors().is_some()
stack backtrace:
   0:     0x7f8af1f8b946 - std::backtrace_rs::backtrace::libunwind::trace::h3b9c271bc5ab1a54
                               at /rustc/e28fae52d99d7c14bf0890d1f2b13c2c34fa8932/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f8af1f8b946 - std::backtrace_rs::backtrace::trace_unsynchronized::h744a131fea5a9ee1
                               at /rustc/e28fae52d99d7c14bf0890d1f2b13c2c34fa8932/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f8af1f8b946 - std::sys_common::backtrace::_print_fmt::hab520e9f265cb2b8
                               at /rustc/e28fae52d99d7c14bf0890d1f2b13c2c34fa8932/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f8af1f8b946 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h406018ae35c10d47
                               at /rustc/e28fae52d99d7c14bf0890d1f2b13c2c34fa8932/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f8af1fde390 - core::fmt::rt::Argument::fmt::h19bd13b7b7a31f56
                               at /rustc/e28fae52d99d7c14bf0890d1f2b13c2c34fa8932/library/core/src/fmt/rt.rs:142:9
   5:     0x7f8af1fde390 - core::fmt::write::hfa2369b325b01363
                               at /rustc/e28fae52d99d7c14bf0890d1f2b13c2c34fa8932/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f8af1f7f0ff - std::io::Write::write_fmt::h67530c983e72b96c
                               at /rustc/e28fae52d99d7c14bf0890d1f2b13c2c34fa8932/library/std/src/io/mod.rs:1854:15
   7:     0x7f8af1f8b724 - std::sys_common::backtrace::_print::h9ff1a94f5fed850e
                               at /rustc/e28fae52d99d7c14bf0890d1f2b13c2c34fa8932/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f8af1f8b724 - std::sys_common::backtrace::print::h6b4245831c2c8d7f
                               at /rustc/e28fae52d99d7c14bf0890d1f2b13c2c34fa8932/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f8af1f8e4e7 - std::panicking::default_hook::{{closure}}::h8b807c1c5e3ff489
  10:     0x7f8af1f8e249 - std::panicking::default_hook::h8873717ebd78f990
                               at /rustc/e28fae52d99d7c14bf0890d1f2b13c2c34fa8932/library/std/src/panicking.rs:292:9
  11:     0x7f8af4d24a9c - std[1c696104f3dc63d8]::panicking::update_hook::<alloc[f36b9cea45f2e3ed]::boxed::Box<rustc_driver_impl[7b91d97827f0c7e7]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f8af1f8ec36 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h0241e27eca2b18b8
                               at /rustc/e28fae52d99d7c14bf0890d1f2b13c2c34fa8932/library/alloc/src/boxed.rs:2029:9
  13:     0x7f8af1f8ec36 - std::panicking::rust_panic_with_hook::h07fb22e64b8ea80e
                               at /rustc/e28fae52d99d7c14bf0890d1f2b13c2c34fa8932/library/std/src/panicking.rs:785:13
  14:     0x7f8af1f8e949 - std::panicking::begin_panic_handler::{{closure}}::h768da4bdbb4e0e1a
                               at /rustc/e28fae52d99d7c14bf0890d1f2b13c2c34fa8932/library/std/src/panicking.rs:651:13
  15:     0x7f8af1f8be46 - std::sys_common::backtrace::__rust_end_short_backtrace::h1f47919693562f6d
                               at /rustc/e28fae52d99d7c14bf0890d1f2b13c2c34fa8932/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f8af1f8e6d4 - rust_begin_unwind
                               at /rustc/e28fae52d99d7c14bf0890d1f2b13c2c34fa8932/library/std/src/panicking.rs:647:5
  17:     0x7f8af1fdaa95 - core::panicking::panic_fmt::h2dd384aef7c4d342
                               at /rustc/e28fae52d99d7c14bf0890d1f2b13c2c34fa8932/library/core/src/panicking.rs:72:14
  18:     0x7f8af1fdab53 - core::panicking::panic::hae85c1382aee5373
                               at /rustc/e28fae52d99d7c14bf0890d1f2b13c2c34fa8932/library/core/src/panicking.rs:144:5
  19:     0x7f8af6aeae22 - rustc_hir_analysis[fba8a298c073d009]::check::check::check_item_type
  20:     0x7f8af678700c - rustc_hir_analysis[fba8a298c073d009]::check::wfcheck::check_well_formed
  21:     0x7f8af6785eb3 - rustc_query_impl[2a165ebfbc09ec32]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2a165ebfbc09ec32]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[23a1a4edc08e7149]::query::erase::Erased<[u8; 1usize]>>
  22:     0x7f8af678558b - rustc_query_system[fda1309255d9b241]::query::plumbing::try_execute_query::<rustc_query_impl[2a165ebfbc09ec32]::DynamicConfig<rustc_query_system[fda1309255d9b241]::query::caches::VecCache<rustc_hir[982436f6f5c06abf]::hir_id::OwnerId, rustc_middle[23a1a4edc08e7149]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[2a165ebfbc09ec32]::plumbing::QueryCtxt, false>
  23:     0x7f8af6785303 - rustc_query_impl[2a165ebfbc09ec32]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  24:     0x7f8af6783098 - rustc_hir_analysis[fba8a298c073d009]::check::wfcheck::check_mod_type_wf
  25:     0x7f8af6782fc9 - rustc_query_impl[2a165ebfbc09ec32]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2a165ebfbc09ec32]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[23a1a4edc08e7149]::query::erase::Erased<[u8; 1usize]>>
  26:     0x7f8af696cdbb - rustc_query_system[fda1309255d9b241]::query::plumbing::try_execute_query::<rustc_query_impl[2a165ebfbc09ec32]::DynamicConfig<rustc_query_system[fda1309255d9b241]::query::caches::DefaultCache<rustc_span[bdca0d1afb713e81]::def_id::LocalModDefId, rustc_middle[23a1a4edc08e7149]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[2a165ebfbc09ec32]::plumbing::QueryCtxt, false>
  27:     0x7f8af696cac3 - rustc_query_impl[2a165ebfbc09ec32]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7f8af617f059 - rustc_middle[23a1a4edc08e7149]::query::plumbing::query_ensure_error_guaranteed::<rustc_query_system[fda1309255d9b241]::query::caches::DefaultCache<rustc_span[bdca0d1afb713e81]::def_id::LocalModDefId, rustc_middle[23a1a4edc08e7149]::query::erase::Erased<[u8; 1usize]>>, ()>
  29:     0x7f8af617f8d6 - rustc_hir_analysis[fba8a298c073d009]::check_crate
  30:     0x7f8af6a4e752 - rustc_interface[4b2caed72d93bbfa]::passes::analysis
  31:     0x7f8af6a4e39f - rustc_query_impl[2a165ebfbc09ec32]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2a165ebfbc09ec32]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[23a1a4edc08e7149]::query::erase::Erased<[u8; 1usize]>>
  32:     0x7f8af6d12ea4 - rustc_query_system[fda1309255d9b241]::query::plumbing::try_execute_query::<rustc_query_impl[2a165ebfbc09ec32]::DynamicConfig<rustc_query_system[fda1309255d9b241]::query::caches::SingleCache<rustc_middle[23a1a4edc08e7149]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[2a165ebfbc09ec32]::plumbing::QueryCtxt, false>
  33:     0x7f8af6d12c07 - rustc_query_impl[2a165ebfbc09ec32]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  34:     0x7f8af6d21c82 - rustc_interface[4b2caed72d93bbfa]::interface::run_compiler::<core[4ce96bca115a8104]::result::Result<(), rustc_span[bdca0d1afb713e81]::ErrorGuaranteed>, rustc_driver_impl[7b91d97827f0c7e7]::run_compiler::{closure#0}>::{closure#0}
  35:     0x7f8af6dd1fc6 - std[1c696104f3dc63d8]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[4b2caed72d93bbfa]::util::run_in_thread_with_globals<rustc_interface[4b2caed72d93bbfa]::util::run_in_thread_pool_with_globals<rustc_interface[4b2caed72d93bbfa]::interface::run_compiler<core[4ce96bca115a8104]::result::Result<(), rustc_span[bdca0d1afb713e81]::ErrorGuaranteed>, rustc_driver_impl[7b91d97827f0c7e7]::run_compiler::{closure#0}>::{closure#0}, core[4ce96bca115a8104]::result::Result<(), rustc_span[bdca0d1afb713e81]::ErrorGuaranteed>>::{closure#0}, core[4ce96bca115a8104]::result::Result<(), rustc_span[bdca0d1afb713e81]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4ce96bca115a8104]::result::Result<(), rustc_span[bdca0d1afb713e81]::ErrorGuaranteed>>
  36:     0x7f8af6dd1df3 - <<std[1c696104f3dc63d8]::thread::Builder>::spawn_unchecked_<rustc_interface[4b2caed72d93bbfa]::util::run_in_thread_with_globals<rustc_interface[4b2caed72d93bbfa]::util::run_in_thread_pool_with_globals<rustc_interface[4b2caed72d93bbfa]::interface::run_compiler<core[4ce96bca115a8104]::result::Result<(), rustc_span[bdca0d1afb713e81]::ErrorGuaranteed>, rustc_driver_impl[7b91d97827f0c7e7]::run_compiler::{closure#0}>::{closure#0}, core[4ce96bca115a8104]::result::Result<(), rustc_span[bdca0d1afb713e81]::ErrorGuaranteed>>::{closure#0}, core[4ce96bca115a8104]::result::Result<(), rustc_span[bdca0d1afb713e81]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4ce96bca115a8104]::result::Result<(), rustc_span[bdca0d1afb713e81]::ErrorGuaranteed>>::{closure#1} as core[4ce96bca115a8104]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  37:     0x7f8af1f982d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb800e73bb2952867
                               at /rustc/e28fae52d99d7c14bf0890d1f2b13c2c34fa8932/library/alloc/src/boxed.rs:2015:9
  38:     0x7f8af1f982d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8d73198cd42ba80a
                               at /rustc/e28fae52d99d7c14bf0890d1f2b13c2c34fa8932/library/alloc/src/boxed.rs:2015:9
  39:     0x7f8af1f982d5 - std::sys::pal::unix::thread::Thread::new::thread_start::h6e0317b32ca28b1a
                               at /rustc/e28fae52d99d7c14bf0890d1f2b13c2c34fa8932/library/std/src/sys/pal/unix/thread.rs:108:17
  40:     0x7f8af1d819eb - <unknown>
  41:     0x7f8af1e057cc - <unknown>
  42:                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 (e28fae52d 2024-02-09) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_well_formed] checking that `Archived` is well-formed
#1 [check_mod_type_wf] checking that types are well-formed in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error[E0433]: failed to resolve: use of undeclared crate or module `m`
 --> /tmp/icemaker_global_tempdir.z9KqoWtXvAYj/rustc_testrunner_tmpdir_reporting.xigk6F76Z2fl/mvce.rs:1:37
  |
1 | pub type Archived<T> = <m::Alias as m::Trait>::Archived;
  |                                     ^
  |                                     |
  |                                     use of undeclared crate or module `m`
  |                                     help: a type parameter with a similar name exists: `T`

error[E0433]: failed to resolve: use of undeclared crate or module `m`
 --> /tmp/icemaker_global_tempdir.z9KqoWtXvAYj/rustc_testrunner_tmpdir_reporting.xigk6F76Z2fl/mvce.rs:1:25
  |
1 | pub type Archived<T> = <m::Alias as m::Trait>::Archived;
  |                         ^
  |                         |
  |                         use of undeclared crate or module `m`
  |                         help: a type parameter with a similar name exists: `T`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0433`.

@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 Feb 9, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 9, 2024
@matthiaskrgr
Copy link
Member Author

#120828 cc @nnethercote

@matthiaskrgr
Copy link
Member Author

in #120482 'ish ICEs, I am seeing internal compiler error: some stashed error is waiting for use' ice now, im wondering if that also relates to #120828 somehow 🤔

@nnethercote nnethercote self-assigned this Feb 9, 2024
@nnethercote
Copy link
Contributor

im wondering if that also relates to #120828 somehow 🤔

Quite likely, I'll take a look.

@nnethercote
Copy link
Contributor

I can reproduce this. It's Saturday morning here, I might get to it today, if not I'll look on Monday morning.

@nnethercote
Copy link
Contributor

Fixing this is really easy, I just need to adjust the assertion a tiny bit.

The hard part is deciding where to put the test. tests/ui/issues/ is the obvious place, but then I get tidy complaining that there are too many files in that directory. Suggestions?

@matthiaskrgr
Copy link
Member Author

just bump the limit by one like everybody else? 🙃 🙈

@nnethercote
Copy link
Contributor

I ended up putting the test in tests/ui/typeck/, because it happens during type checking.

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 10, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 10, 2024
Loosen an assertion to account for stashed errors.

The meaning of this assertion changed in rust-lang#120828 when the meaning of `has_errors` changed to exclude stashed errors. Evidently the new meaning is too restrictive.

Fixes rust-lang#120856.

r? `@oli-obk`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 10, 2024
Loosen an assertion to account for stashed errors.

The meaning of this assertion changed in rust-lang#120828 when the meaning of `has_errors` changed to exclude stashed errors. Evidently the new meaning is too restrictive.

Fixes rust-lang#120856.

r? ``@oli-obk``
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 10, 2024
Loosen an assertion to account for stashed errors.

The meaning of this assertion changed in rust-lang#120828 when the meaning of `has_errors` changed to exclude stashed errors. Evidently the new meaning is too restrictive.

Fixes rust-lang#120856.

r? ```@oli-obk```
@bors bors closed this as completed in bb60ded Feb 10, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Feb 10, 2024
Rollup merge of rust-lang#120859 - nnethercote:fix-120856, r=oli-obk

Loosen an assertion to account for stashed errors.

The meaning of this assertion changed in rust-lang#120828 when the meaning of `has_errors` changed to exclude stashed errors. Evidently the new meaning is too restrictive.

Fixes rust-lang#120856.

r? ```@oli-obk```
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) ❄️ 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.

4 participants