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: lazy_type_alias None in compiler/rustc_hir_analysis/src/astconv/mod.rs #113736

Closed
matthiaskrgr opened this issue Jul 15, 2023 · 3 comments · Fixed by #113755
Closed

ICE: lazy_type_alias None in compiler/rustc_hir_analysis/src/astconv/mod.rs #113736

matthiaskrgr opened this issue Jul 15, 2023 · 3 comments · Fixed by #113755
Assignees
Labels
C-bug Category: This is a bug. F-lazy_type_alias `#![feature(lazy_type_alias)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Jul 15, 2023

Code

rustc ./68684-2.rs

#![feature(lazy_type_alias)]
enum _Enum {
    A(),
}

type _E = _Enum;

const fn _a() -> _Enum {
    _E::A()
}

const _A: _Enum = _a();

fn main() {}

Meta

rustc --version --verbose:

rustc 1.73.0-nightly (ad963232d 2023-07-14)
binary: rustc
commit-hash: ad963232d9b987d66a6f8e6ec4141f672b8b9900
commit-date: 2023-07-14
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5

Error output

<output>
Backtrace

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_hir_analysis/src/astconv/mod.rs:2080:65
stack backtrace:
   0:     0x7fbedeb63431 - std::backtrace_rs::backtrace::libunwind::trace::hbe1beb7d621d58fa
                               at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fbedeb63431 - std::backtrace_rs::backtrace::trace_unsynchronized::he8e3e2c387ab6872
                               at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fbedeb63431 - std::sys_common::backtrace::_print_fmt::h6dbdf2be39b8270c
                               at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fbedeb63431 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3cbca66214d4a04c
                               at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fbedebc953f - core::fmt::rt::Argument::fmt::hf61be5530d19e8de
                               at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/core/src/fmt/rt.rs:138:9
   5:     0x7fbedebc953f - core::fmt::write::h1241e990bb935116
                               at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/core/src/fmt/mod.rs:1094:21
   6:     0x7fbedeb55dd7 - std::io::Write::write_fmt::h5ee2493dc0c3d50b
                               at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/std/src/io/mod.rs:1714:15
   7:     0x7fbedeb63245 - std::sys_common::backtrace::_print::h3b1cb0d72bcf0b57
                               at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fbedeb63245 - std::sys_common::backtrace::print::h215071bf58f4d692
                               at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fbedeb66023 - std::panicking::default_hook::{{closure}}::h420f57ae0dc930a1
                               at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/std/src/panicking.rs:269:22
  10:     0x7fbedeb65db4 - std::panicking::default_hook::hef46dbbaf7939018
                               at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/std/src/panicking.rs:288:9
  11:     0x7fbee1de3c7b - rustc_driver_impl[356fd39593eb27dc]::install_ice_hook::{closure#0}
  12:     0x7fbedeb6684e - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hdbc20659aa97e72b
                               at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/alloc/src/boxed.rs:2021:9
  13:     0x7fbedeb6684e - std::panicking::rust_panic_with_hook::h38737fd0d1a1b251
                               at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/std/src/panicking.rs:709:13
  14:     0x7fbedeb66591 - std::panicking::begin_panic_handler::{{closure}}::h2774d6ddad1e3ca4
                               at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/std/src/panicking.rs:595:13
  15:     0x7fbedeb63896 - std::sys_common::backtrace::__rust_end_short_backtrace::h5a8afe9240c1b747
                               at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/std/src/sys_common/backtrace.rs:151:18
  16:     0x7fbedeb66322 - rust_begin_unwind
                               at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/std/src/panicking.rs:593:5
  17:     0x7fbedebc5793 - core::panicking::panic_fmt::h4b1ce193065cd564
                               at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/core/src/panicking.rs:67:14
  18:     0x7fbedebc5823 - core::panicking::panic::ha1afc78c48eb006b
                               at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/core/src/panicking.rs:117:5
  19:     0x7fbedffb9c5e - <rustc_hir_typeck[a55f57d54ad1925]::fn_ctxt::FnCtxt>::check_expr_path
  20:     0x7fbedffd9dc7 - <rustc_hir_typeck[a55f57d54ad1925]::fn_ctxt::FnCtxt>::check_call
  21:     0x7fbedff96bd7 - <rustc_hir_typeck[a55f57d54ad1925]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  22:     0x7fbedffd3c7e - <rustc_hir_typeck[a55f57d54ad1925]::fn_ctxt::FnCtxt>::check_block_with_expected
  23:     0x7fbedff97aed - <rustc_hir_typeck[a55f57d54ad1925]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  24:     0x7fbee086b686 - <rustc_hir_typeck[a55f57d54ad1925]::fn_ctxt::FnCtxt>::check_return_expr
  25:     0x7fbee086351f - rustc_hir_typeck[a55f57d54ad1925]::check::check_fn
  26:     0x7fbee0848f7a - rustc_hir_typeck[a55f57d54ad1925]::typeck
  27:     0x7fbedfe716be - rustc_query_impl[4108151966842242]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[4108151966842242]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c95a74456656fb43]::query::erase::Erased<[u8; 8usize]>>
  28:     0x7fbedfe7168e - <rustc_query_impl[4108151966842242]::query_impl::typeck::dynamic_query::{closure#2} as core[82b97d3770534f31]::ops::function::FnOnce<(rustc_middle[c95a74456656fb43]::ty::context::TyCtxt, rustc_span[46061d449caa818]::def_id::LocalDefId)>>::call_once
  29:     0x7fbedff435ed - rustc_query_system[3ad0edb17e4d3225]::query::plumbing::try_execute_query::<rustc_query_impl[4108151966842242]::DynamicConfig<rustc_query_system[3ad0edb17e4d3225]::query::caches::VecCache<rustc_span[46061d449caa818]::def_id::LocalDefId, rustc_middle[c95a74456656fb43]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[4108151966842242]::plumbing::QueryCtxt, false>
  30:     0x7fbee173311f - rustc_query_impl[4108151966842242]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  31:     0x7fbee12d5d3d - rustc_data_structures[f2597d3276b53841]::sync::par_for_each_in::<&[rustc_span[46061d449caa818]::def_id::LocalDefId], <rustc_middle[c95a74456656fb43]::hir::map::Map>::par_body_owners<rustc_hir_analysis[aaa7008e68a74dd7]::check_crate::{closure#7}>::{closure#0}>
  32:     0x7fbee12d4066 - rustc_hir_analysis[aaa7008e68a74dd7]::check_crate
  33:     0x7fbee12ca5da - rustc_interface[cbaee814aa2dcfe5]::passes::analysis
  34:     0x7fbee125e35a - rustc_query_impl[4108151966842242]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[4108151966842242]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c95a74456656fb43]::query::erase::Erased<[u8; 1usize]>>
  35:     0x7fbee125e349 - <rustc_query_impl[4108151966842242]::query_impl::analysis::dynamic_query::{closure#2} as core[82b97d3770534f31]::ops::function::FnOnce<(rustc_middle[c95a74456656fb43]::ty::context::TyCtxt, ())>>::call_once
  36:     0x7fbee1443c78 - rustc_query_system[3ad0edb17e4d3225]::query::plumbing::try_execute_query::<rustc_query_impl[4108151966842242]::DynamicConfig<rustc_query_system[3ad0edb17e4d3225]::query::caches::SingleCache<rustc_middle[c95a74456656fb43]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[4108151966842242]::plumbing::QueryCtxt, false>
  37:     0x7fbee1443a57 - rustc_query_impl[4108151966842242]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7fbee1034675 - <rustc_middle[c95a74456656fb43]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[356fd39593eb27dc]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[82b97d3770534f31]::result::Result<(), rustc_span[46061d449caa818]::ErrorGuaranteed>>
  39:     0x7fbee1033ca2 - <rustc_interface[cbaee814aa2dcfe5]::interface::Compiler>::enter::<rustc_driver_impl[356fd39593eb27dc]::run_compiler::{closure#1}::{closure#2}, core[82b97d3770534f31]::result::Result<core[82b97d3770534f31]::option::Option<rustc_interface[cbaee814aa2dcfe5]::queries::Linker>, rustc_span[46061d449caa818]::ErrorGuaranteed>>
  40:     0x7fbee102cf75 - rustc_span[46061d449caa818]::set_source_map::<core[82b97d3770534f31]::result::Result<(), rustc_span[46061d449caa818]::ErrorGuaranteed>, rustc_interface[cbaee814aa2dcfe5]::interface::run_compiler<core[82b97d3770534f31]::result::Result<(), rustc_span[46061d449caa818]::ErrorGuaranteed>, rustc_driver_impl[356fd39593eb27dc]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  41:     0x7fbee102c9e6 - <scoped_tls[3c9df00b6c3e8015]::ScopedKey<rustc_span[46061d449caa818]::SessionGlobals>>::set::<rustc_interface[cbaee814aa2dcfe5]::interface::run_compiler<core[82b97d3770534f31]::result::Result<(), rustc_span[46061d449caa818]::ErrorGuaranteed>, rustc_driver_impl[356fd39593eb27dc]::run_compiler::{closure#1}>::{closure#0}, core[82b97d3770534f31]::result::Result<(), rustc_span[46061d449caa818]::ErrorGuaranteed>>
  42:     0x7fbee102bfac - std[782566b472440107]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[cbaee814aa2dcfe5]::util::run_in_thread_pool_with_globals<rustc_interface[cbaee814aa2dcfe5]::interface::run_compiler<core[82b97d3770534f31]::result::Result<(), rustc_span[46061d449caa818]::ErrorGuaranteed>, rustc_driver_impl[356fd39593eb27dc]::run_compiler::{closure#1}>::{closure#0}, core[82b97d3770534f31]::result::Result<(), rustc_span[46061d449caa818]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[82b97d3770534f31]::result::Result<(), rustc_span[46061d449caa818]::ErrorGuaranteed>>
  43:     0x7fbee102bd6e - <<std[782566b472440107]::thread::Builder>::spawn_unchecked_<rustc_interface[cbaee814aa2dcfe5]::util::run_in_thread_pool_with_globals<rustc_interface[cbaee814aa2dcfe5]::interface::run_compiler<core[82b97d3770534f31]::result::Result<(), rustc_span[46061d449caa818]::ErrorGuaranteed>, rustc_driver_impl[356fd39593eb27dc]::run_compiler::{closure#1}>::{closure#0}, core[82b97d3770534f31]::result::Result<(), rustc_span[46061d449caa818]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[82b97d3770534f31]::result::Result<(), rustc_span[46061d449caa818]::ErrorGuaranteed>>::{closure#1} as core[82b97d3770534f31]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  44:     0x7fbedeb70ee5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0f6550a69edefeac
                               at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/alloc/src/boxed.rs:2007:9
  45:     0x7fbedeb70ee5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he9892a39d805c380
                               at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/alloc/src/boxed.rs:2007:9
  46:     0x7fbedeb70ee5 - std::sys::unix::thread::Thread::new::thread_start::h13f5e66024f16bec
                               at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/std/src/sys/unix/thread.rs:108:17
  47:     0x7fbede90344b - <unknown>
  48:     0x7fbede986e40 - <unknown>
  49:                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.73.0-nightly (ad963232d 2023-07-14) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z crate-attr=feature(lazy_type_alias)

query stack during panic:
#0 [typeck] type-checking `_a`
#1 [analysis] running analysis passes on this crate
end of query stack

@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. requires-nightly This issue requires a nightly compiler in some way. labels Jul 15, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 15, 2023
@Noratrieb
Copy link
Member

@matthiaskrgr can you please avoid using -Zcrate-attr in the future and directly put the attributes in the source? It makes it easier to copy it to the playground or local invocation.

@fmease
Copy link
Member

fmease commented Jul 16, 2023

I've got a fix already, gonna open a PR later.
@rustbot claim

@Noratrieb Noratrieb added F-lazy_type_alias `#![feature(lazy_type_alias)]` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jul 16, 2023
@fmease
Copy link
Member

fmease commented Jul 16, 2023

Minimized:

#![feature(lazy_type_alias)]

enum Type {
    Variant,
}

fn main() {
    type Alias = Type;
    let _ = Alias::Variant;
}

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 16, 2023
…s, r=oli-obk

Normalize lazy type aliases when probing for ADTs

Fixes rust-lang#113736.

r? `@oli-obk`
workingjubilee added a commit to workingjubilee/rustc that referenced this issue Jul 16, 2023
…s, r=oli-obk

Normalize lazy type aliases when probing for ADTs

Fixes rust-lang#113736.

r? ``@oli-obk``
@bors bors closed this as completed in b42ada2 Jul 17, 2023
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. F-lazy_type_alias `#![feature(lazy_type_alias)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. 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