Skip to content

ICE: failed to normalize with proc_macro in normalize_erasing_regions.rs #109129

Closed

Description

@langston-barrett

This is a fuzzed test case, found with tree-splicer and minimized with treereduce. Please let me know (and many apologies) if it's not helpful!

This happens on the same line as in these issues; though with a different query stack.

[EDIT: Links removed to avoid spurrious backlinks]

Some similar looking issues involve features, none seem to involve proc_macro. Search: https://github.com/rust-lang/rust/issues?q=is%3Aopen+label%3AI-ICE+failed+to+normalize

Code

extern crate proc_macro;

trait Project {
    type Assoc;
}

#[proc_macro]
fn uwu() -> <() as Project>::Assoc {}

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (22f247c6f 2023-03-13)
binary: rustc
commit-hash: 22f247c6f3ed388cb702d01c2ff27da658a8b353
commit-date: 2023-03-13
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7

Error output

error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:195:90: Failed to normalize <() as Project>::Assoc, maybe try to call `try_normalize_erasing_regions` instead
Backtrace

error: the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type
 --> ice.rs:7:1
  |
7 | #[proc_macro]
  | ^^^^^^^^^^^^^

warning: unused macro definition: `uwu`
 --> ice.rs:8:4
  |
8 | fn uwu() -> <() as Project>::Assoc {}
  |    ^^^
  |
  = note: `#[warn(unused_macros)]` on by default

error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:195:90: Failed to normalize <() as Project>::Assoc, maybe try to call `try_normalize_erasing_regions` instead

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/compiler/rustc_errors/src/lib.rs:1644:9
stack backtrace:
   0:     0x7fd22542051a - std::backtrace_rs::backtrace::libunwind::trace::h1ac6254167c780d9
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fd22542051a - std::backtrace_rs::backtrace::trace_unsynchronized::hec2af85915e24f36
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fd22542051a - std::sys_common::backtrace::_print_fmt::h58a4e3535fcce206
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fd22542051a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5107e13758b8321c
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fd225483c5e - core::fmt::write::h2e851dc027730d81
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/core/src/fmt/mod.rs:1232:17
   5:     0x7fd225413375 - std::io::Write::write_fmt::hca00074de9f85084
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/io/mod.rs:1684:15
   6:     0x7fd2254202e5 - std::sys_common::backtrace::_print::h870053c845cddf24
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7fd2254202e5 - std::sys_common::backtrace::print::hb56add862f96c5fd
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7fd22542305f - std::panicking::default_hook::{{closure}}::h636d4ba3ff8fdc46
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/panicking.rs:271:22
   9:     0x7fd225422d9b - std::panicking::default_hook::hf29b58145ee6e43c
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/panicking.rs:290:9
  10:     0x7fd2287630c5 - <rustc_driver_impl[74350ec99973fded]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[2011dc7817943e09]::ops::function::FnOnce<(&core[2011dc7817943e09]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7fd22542389d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h7342d57f33f6634f
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/alloc/src/boxed.rs:2002:9
  12:     0x7fd22542389d - std::panicking::rust_panic_with_hook::hbf9ef936d990c16f
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/panicking.rs:696:13
  13:     0x7fd228ccd5b1 - std[1337fb43929788f1]::panicking::begin_panic::<rustc_errors[9dbe0d28acf3471b]::ExplicitBug>::{closure#0}
  14:     0x7fd228cc8a36 - std[1337fb43929788f1]::sys_common::backtrace::__rust_end_short_backtrace::<std[1337fb43929788f1]::panicking::begin_panic<rustc_errors[9dbe0d28acf3471b]::ExplicitBug>::{closure#0}, !>
  15:     0x7fd228d4de86 - std[1337fb43929788f1]::panicking::begin_panic::<rustc_errors[9dbe0d28acf3471b]::ExplicitBug>
  16:     0x7fd228d19fe6 - std[1337fb43929788f1]::panic::panic_any::<rustc_errors[9dbe0d28acf3471b]::ExplicitBug>
  17:     0x7fd228d16866 - <rustc_errors[9dbe0d28acf3471b]::HandlerInner>::bug::<&alloc[b7ae3602ac956de8]::string::String>
  18:     0x7fd228d16530 - <rustc_errors[9dbe0d28acf3471b]::Handler>::bug::<&alloc[b7ae3602ac956de8]::string::String>
  19:     0x7fd228d0295b - rustc_middle[eaae5d2a0b8f0144]::util::bug::opt_span_bug_fmt::<rustc_span[18b84908941c7cdf]::span_encoding::Span>::{closure#0}
  20:     0x7fd228d013ba - rustc_middle[eaae5d2a0b8f0144]::ty::context::tls::with_opt::<rustc_middle[eaae5d2a0b8f0144]::util::bug::opt_span_bug_fmt<rustc_span[18b84908941c7cdf]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7fd228d01386 - rustc_middle[eaae5d2a0b8f0144]::ty::context::tls::with_context_opt::<rustc_middle[eaae5d2a0b8f0144]::ty::context::tls::with_opt<rustc_middle[eaae5d2a0b8f0144]::util::bug::opt_span_bug_fmt<rustc_span[18b84908941c7cdf]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7fd228d028a6 - rustc_middle[eaae5d2a0b8f0144]::util::bug::opt_span_bug_fmt::<rustc_span[18b84908941c7cdf]::span_encoding::Span>
  23:     0x7fd226e3c5c3 - rustc_middle[eaae5d2a0b8f0144]::util::bug::bug_fmt
  24:     0x7fd2269345c8 - <rustc_middle[eaae5d2a0b8f0144]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_type_ir[65f3a8acf733f7d2]::fold::TypeFolder<rustc_middle[eaae5d2a0b8f0144]::ty::context::TyCtxt>>::fold_ty
  25:     0x7fd228fb5119 - rustc_middle[eaae5d2a0b8f0144]::ty::util::fold_list::<rustc_middle[eaae5d2a0b8f0144]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder, rustc_middle[eaae5d2a0b8f0144]::ty::Ty, <&rustc_middle[eaae5d2a0b8f0144]::ty::list::List<rustc_middle[eaae5d2a0b8f0144]::ty::Ty> as rustc_type_ir[65f3a8acf733f7d2]::fold::TypeFoldable<rustc_middle[eaae5d2a0b8f0144]::ty::context::TyCtxt>>::try_fold_with<rustc_middle[eaae5d2a0b8f0144]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder>::{closure#0}>
  26:     0x7fd228fe8df5 - <rustc_middle[eaae5d2a0b8f0144]::ty::sty::FnSig as rustc_type_ir[65f3a8acf733f7d2]::fold::TypeFoldable<rustc_middle[eaae5d2a0b8f0144]::ty::context::TyCtxt>>::fold_with::<rustc_middle[eaae5d2a0b8f0144]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder>
  27:     0x7fd226bae47d - <rustc_passes[5734ea879e29deaf]::check_attr::CheckAttrVisitor>::check_proc_macro
  28:     0x7fd226fbf9ca - <rustc_passes[5734ea879e29deaf]::check_attr::CheckAttrVisitor>::check_attributes
  29:     0x7fd226fba9ca - <rustc_middle[eaae5d2a0b8f0144]::hir::map::Map>::visit_item_likes_in_module::<rustc_passes[5734ea879e29deaf]::check_attr::CheckAttrVisitor>
  30:     0x7fd226fba6b7 - rustc_passes[5734ea879e29deaf]::check_attr::check_mod_attrs
  31:     0x7fd227d9cd3e - rustc_query_system[f881c7f40ee7dcf0]::query::plumbing::try_execute_query::<rustc_query_impl[eb95ff51c492efdd]::queries::check_mod_attrs, rustc_query_impl[eb95ff51c492efdd]::plumbing::QueryCtxt>
  32:     0x7fd227d9c8c3 - <rustc_query_impl[eb95ff51c492efdd]::Queries as rustc_middle[eaae5d2a0b8f0144]::ty::query::QueryEngine>::check_mod_attrs
  33:     0x7fd226b478a8 - <core[2011dc7817943e09]::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures[75b47a18491287a9]::sync::par_for_each_in<&[rustc_hir[ca07edd3831bb6e2]::hir_id::OwnerId], <rustc_middle[eaae5d2a0b8f0144]::hir::map::Map>::par_for_each_module<rustc_interface[ceda1fd77ec39e1b]::passes::analysis::{closure#0}::{closure#1}::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}> as core[2011dc7817943e09]::ops::function::FnOnce<()>>::call_once
  34:     0x7fd226b47748 - rustc_data_structures[75b47a18491287a9]::sync::par_for_each_in::<&[rustc_hir[ca07edd3831bb6e2]::hir_id::OwnerId], <rustc_middle[eaae5d2a0b8f0144]::hir::map::Map>::par_for_each_module<rustc_interface[ceda1fd77ec39e1b]::passes::analysis::{closure#0}::{closure#1}::{closure#0}>::{closure#0}>
  35:     0x7fd226b47516 - <core[2011dc7817943e09]::panic::unwind_safe::AssertUnwindSafe<rustc_interface[ceda1fd77ec39e1b]::passes::analysis::{closure#0}::{closure#1}> as core[2011dc7817943e09]::ops::function::FnOnce<()>>::call_once
  36:     0x7fd226b471b5 - <rustc_session[a360c2d099171c08]::session::Session>::time::<(), rustc_interface[ceda1fd77ec39e1b]::passes::analysis::{closure#0}>
  37:     0x7fd226b461a8 - rustc_interface[ceda1fd77ec39e1b]::passes::analysis
  38:     0x7fd227f81a4c - rustc_query_system[f881c7f40ee7dcf0]::query::plumbing::try_execute_query::<rustc_query_impl[eb95ff51c492efdd]::queries::analysis, rustc_query_impl[eb95ff51c492efdd]::plumbing::QueryCtxt>
  39:     0x7fd227f81740 - <rustc_query_impl[eb95ff51c492efdd]::Queries as rustc_middle[eaae5d2a0b8f0144]::ty::query::QueryEngine>::analysis
  40:     0x7fd227daa789 - <rustc_middle[eaae5d2a0b8f0144]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[74350ec99973fded]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>>
  41:     0x7fd227999f08 - rustc_span[18b84908941c7cdf]::with_source_map::<core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>, rustc_interface[ceda1fd77ec39e1b]::interface::run_compiler<core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>, rustc_driver_impl[74350ec99973fded]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  42:     0x7fd22799116c - std[1337fb43929788f1]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[ceda1fd77ec39e1b]::util::run_in_thread_pool_with_globals<rustc_interface[ceda1fd77ec39e1b]::interface::run_compiler<core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>, rustc_driver_impl[74350ec99973fded]::run_compiler::{closure#1}>::{closure#0}, core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>>
  43:     0x7fd227990b9a - <<std[1337fb43929788f1]::thread::Builder>::spawn_unchecked_<rustc_interface[ceda1fd77ec39e1b]::util::run_in_thread_pool_with_globals<rustc_interface[ceda1fd77ec39e1b]::interface::run_compiler<core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>, rustc_driver_impl[74350ec99973fded]::run_compiler::{closure#1}>::{closure#0}, core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>>::{closure#1} as core[2011dc7817943e09]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  44:     0x7fd22542d793 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7e0474dd3b8659fa
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/alloc/src/boxed.rs:1988:9
  45:     0x7fd22542d793 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::heb8c41cf543a5c11
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/alloc/src/boxed.rs:1988:9
  46:     0x7fd22542d793 - std::sys::unix::thread::Thread::new::thread_start::hc791abe67253fe06
                               at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys/unix/thread.rs:108:17
  47:     0x7fd2252f9d40 - start_thread
  48:     0x7fd22521603f - __GI___clone
  49:                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.70.0-nightly (22f247c6f 2023-03-13) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib

query stack during panic:
#0 [check_mod_attrs] checking attributes in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors; 1 warning emitted

Activity

  1. added
    C-bugCategory: This is a bug.
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Mar 14, 2023
  2. compiler-errors commented on Mar 14, 2023

    @compiler-errors
    Contributor

    This happens on the same line as in these issues; though with a different query stack.

    For future reference, this generally suggests that this is a totally unrelated issue.

  3. compiler-errors commented on Mar 14, 2023

    @compiler-errors
    Contributor

    To be a bit clearer with that last message, there are a few ICEs that commonly crop up in the compiler with similar "leaf" causes but different root causes. Anything having to do with snapshot_vec, to give another example, is probably unique.

  4. matthiaskrgr commented on Mar 14, 2023

    @matthiaskrgr
    Member

    Anything having to do with snapshot_vec, to give another example, is probably unique.

    👀

  5. added a commit that references this issue on Mar 15, 2023
    8c5ea61
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions