Skip to content

ICE: unexpected sort of node in fn_sig() in collect.rs #109079

Closed
@langston-barrett

Description

@langston-barrett

This is a fuzzed test case, found with tree-splicer and minimized with treereduce. I hope it's valid, please let me know (and many apologies) if it's not helpful! I searched the issue tracker like so, but found no similar issues.

In any case, I'm going to stop posting issues for now until I hear back about a few of the issues I've posted. I don't want to be spammy!

Code

#[target_feature( = )]
static A: System = System;

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (7b4f48927 2023-03-12)
binary: rustc
commit-hash: 7b4f48927dce585f747a58083b45ab62b9d73a53
commit-date: 2023-03-12
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7

Error output

error: internal compiler error: compiler/rustc_hir_analysis/src/collect.rs:1174:13: unexpected sort of node in fn_sig(): Item(Item { ident: A#0, owner_id: DefId(0:3 ~ ice_min[f0b4]::A), kind: Static(Ty { hir_id: HirId(DefId(0:3 ~ ice_min[f0b4]::A).1), kind: Path(Resolved(None, Path { span: ice_min.rs:2:11: 2:17 (#0), res: Err, segments: [PathSegment { ident: System#0, hir_id: HirId(DefId(0:3 ~ ice_min[f0b4]::A).2), res: Err, args: None, infer_args: false }] })), span: ice_min.rs:2:11: 2:17 (#0) }, Not, BodyId { hir_id: HirId(DefId(0:3 ~ ice_min[f0b4]::A).3) }), span: ice_min.rs:2:1: 2:27 (#0), vis_span: ice_min.rs:2:1: 2:1 (#0) })
Backtrace

error: expected unsuffixed literal or identifier, found `=`
 --> ice_min.rs:1:19
  |
1 | #[target_feature( = )]
  |                   ^

error[E0412]: cannot find type `System` in this scope
 --> ice_min.rs:2:11
  |
2 | static A: System = System;
  |           ^^^^^^ not found in this scope
  |
help: consider importing this struct
  |
1 | use std::alloc::System;
  |

error[E0425]: cannot find value `System` in this scope
 --> ice_min.rs:2:20
  |
2 | static A: System = System;
  |                    ^^^^^^ not found in this scope
  |
help: consider importing this unit struct
  |
1 | use std::alloc::System;
  |

error[E0601]: `main` function not found in crate `ice_min`
 --> ice_min.rs:2:27
  |
2 | static A: System = System;
  |                           ^ consider adding a `main` function to `ice_min.rs`

error: attribute should be applied to a function definition
 --> ice_min.rs:1:1
  |
1 | #[target_feature( = )]
  | ^^^^^^^^^^^^^^^^^^^^^^
2 | static A: System = System;
  | -------------------------- not a function definition

error: internal compiler error: compiler/rustc_hir_analysis/src/collect.rs:1174:13: unexpected sort of node in fn_sig(): Item(Item { ident: A#0, owner_id: DefId(0:3 ~ ice_min[f0b4]::A), kind: Static(Ty { hir_id: HirId(DefId(0:3 ~ ice_min[f0b4]::A).1), kind: Path(Resolved(None, Path { span: ice_min.rs:2:11: 2:17 (#0), res: Err, segments: [PathSegment { ident: System#0, hir_id: HirId(DefId(0:3 ~ ice_min[f0b4]::A).2), res: Err, args: None, infer_args: false }] })), span: ice_min.rs:2:11: 2:17 (#0) }, Not, BodyId { hir_id: HirId(DefId(0:3 ~ ice_min[f0b4]::A).3) }), span: ice_min.rs:2:1: 2:27 (#0), vis_span: ice_min.rs:2:1: 2:1 (#0) })

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/compiler/rustc_errors/src/lib.rs:1644:9
stack backtrace:
   0:     0x7f03e60f251a - std::backtrace_rs::backtrace::libunwind::trace::hf7d75cca16fd1b61
                               at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f03e60f251a - std::backtrace_rs::backtrace::trace_unsynchronized::hf5ec95734aab509d
                               at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f03e60f251a - std::sys_common::backtrace::_print_fmt::he95113413355c8cd
                               at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f03e60f251a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h072d12f2e69ca92b
                               at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f03e6155c5e - core::fmt::write::h1d23f16415e96af2
                               at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/core/src/fmt/mod.rs:1232:17
   5:     0x7f03e60e5275 - std::io::Write::write_fmt::hcf1e413fde4ffcd5
                               at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/io/mod.rs:1684:15
   6:     0x7f03e60f22e5 - std::sys_common::backtrace::_print::h6b2b14bedd5177e7
                               at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f03e60f22e5 - std::sys_common::backtrace::print::h09ccebfbcd382e89
                               at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f03e60f505f - std::panicking::default_hook::{{closure}}::h4ee055db778febc2
                               at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/panicking.rs:271:22
   9:     0x7f03e60f4d9b - std::panicking::default_hook::ha74f60e3a15d95fb
                               at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/panicking.rs:290:9
  10:     0x7f03e9474085 - rustc_driver_impl[d355a67661263e47]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f03e60f589d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h7f34603beb945e8f
                               at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/alloc/src/boxed.rs:2002:9
  12:     0x7f03e60f589d - std::panicking::rust_panic_with_hook::h4b5d379936d4932f
                               at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/panicking.rs:696:13
  13:     0x7f03e99df371 - std[e52d7c968ed01318]::panicking::begin_panic::<rustc_errors[45159b7f7e36021d]::ExplicitBug>::{closure#0}
  14:     0x7f03e99daaa6 - std[e52d7c968ed01318]::sys_common::backtrace::__rust_end_short_backtrace::<std[e52d7c968ed01318]::panicking::begin_panic<rustc_errors[45159b7f7e36021d]::ExplicitBug>::{closure#0}, !>
  15:     0x7f03e9a63046 - std[e52d7c968ed01318]::panicking::begin_panic::<rustc_errors[45159b7f7e36021d]::ExplicitBug>
  16:     0x7f03e9a2ee06 - std[e52d7c968ed01318]::panic::panic_any::<rustc_errors[45159b7f7e36021d]::ExplicitBug>
  17:     0x7f03e9a2a966 - <rustc_errors[45159b7f7e36021d]::HandlerInner>::bug::<&alloc[fc860cae0dfa1ab1]::string::String>
  18:     0x7f03e9a2a630 - <rustc_errors[45159b7f7e36021d]::Handler>::bug::<&alloc[fc860cae0dfa1ab1]::string::String>
  19:     0x7f03e9a16a9b - rustc_middle[a96ac5d591578447]::util::bug::opt_span_bug_fmt::<rustc_span[f8bdfaef83e46314]::span_encoding::Span>::{closure#0}
  20:     0x7f03e9a154fa - rustc_middle[a96ac5d591578447]::ty::context::tls::with_opt::<rustc_middle[a96ac5d591578447]::util::bug::opt_span_bug_fmt<rustc_span[f8bdfaef83e46314]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f03e9a154c6 - rustc_middle[a96ac5d591578447]::ty::context::tls::with_context_opt::<rustc_middle[a96ac5d591578447]::ty::context::tls::with_opt<rustc_middle[a96ac5d591578447]::util::bug::opt_span_bug_fmt<rustc_span[f8bdfaef83e46314]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f03e9a169e6 - rustc_middle[a96ac5d591578447]::util::bug::opt_span_bug_fmt::<rustc_span[f8bdfaef83e46314]::span_encoding::Span>
  23:     0x7f03e7a914b3 - rustc_middle[a96ac5d591578447]::util::bug::bug_fmt
  24:     0x7f03e83e022d - rustc_hir_analysis[357075c2c3fc2a7b]::collect::fn_sig
  25:     0x7f03e83de140 - rustc_query_system[704b80a7bc44cd49]::query::plumbing::try_execute_query::<rustc_query_impl[217bee59c5548bf5]::queries::fn_sig, rustc_query_impl[217bee59c5548bf5]::plumbing::QueryCtxt>
  26:     0x7f03e83dd5b1 - <rustc_query_impl[217bee59c5548bf5]::Queries as rustc_middle[a96ac5d591578447]::ty::query::QueryEngine>::fn_sig
  27:     0x7f03e8879919 - rustc_codegen_ssa[d7553c89eed4006]::codegen_attrs::codegen_fn_attrs
  28:     0x7f03e81c91c3 - rustc_query_system[704b80a7bc44cd49]::query::plumbing::try_execute_query::<rustc_query_impl[217bee59c5548bf5]::queries::codegen_fn_attrs, rustc_query_impl[217bee59c5548bf5]::plumbing::QueryCtxt>
  29:     0x7f03e81c8736 - <rustc_query_impl[217bee59c5548bf5]::Queries as rustc_middle[a96ac5d591578447]::ty::query::QueryEngine>::codegen_fn_attrs
  30:     0x7f03e83bfcaa - rustc_hir_analysis[357075c2c3fc2a7b]::check::wfcheck::check_item_type
  31:     0x7f03e839f5de - rustc_hir_analysis[357075c2c3fc2a7b]::check::wfcheck::check_well_formed
  32:     0x7f03e78940dd - rustc_query_system[704b80a7bc44cd49]::query::plumbing::try_execute_query::<rustc_query_impl[217bee59c5548bf5]::queries::check_well_formed, rustc_query_impl[217bee59c5548bf5]::plumbing::QueryCtxt>
  33:     0x7f03e89466d2 - rustc_data_structures[cc19bc993ab9b64]::sync::par_for_each_in::<&[rustc_hir[4aa57babd8685147]::hir::ItemId], <rustc_middle[a96ac5d591578447]::hir::ModuleItems>::par_items<rustc_hir_analysis[357075c2c3fc2a7b]::check::wfcheck::check_mod_type_wf::{closure#0}>::{closure#0}>
  34:     0x7f03e8946291 - rustc_hir_analysis[357075c2c3fc2a7b]::check::wfcheck::check_mod_type_wf
  35:     0x7f03e8aa525e - rustc_query_system[704b80a7bc44cd49]::query::plumbing::try_execute_query::<rustc_query_impl[217bee59c5548bf5]::queries::check_mod_type_wf, rustc_query_impl[217bee59c5548bf5]::plumbing::QueryCtxt>
  36:     0x7f03e8aa4de3 - <rustc_query_impl[217bee59c5548bf5]::Queries as rustc_middle[a96ac5d591578447]::ty::query::QueryEngine>::check_mod_type_wf
  37:     0x7f03e778cca8 - rustc_data_structures[cc19bc993ab9b64]::sync::par_for_each_in::<&[rustc_hir[4aa57babd8685147]::hir_id::OwnerId], <rustc_middle[a96ac5d591578447]::hir::map::Map>::par_for_each_module<rustc_hir_analysis[357075c2c3fc2a7b]::check_crate::{closure#5}::{closure#0}::{closure#0}>::{closure#0}>
  38:     0x7f03e778cb30 - <rustc_session[7e23441c2db8ce4a]::session::Session>::track_errors::<rustc_hir_analysis[357075c2c3fc2a7b]::check_crate::{closure#5}, ()>
  39:     0x7f03e7789d60 - rustc_hir_analysis[357075c2c3fc2a7b]::check_crate
  40:     0x7f03e777fd12 - rustc_interface[6bf42eb308c32713]::passes::analysis
  41:     0x7f03e8c8871c - rustc_query_system[704b80a7bc44cd49]::query::plumbing::try_execute_query::<rustc_query_impl[217bee59c5548bf5]::queries::analysis, rustc_query_impl[217bee59c5548bf5]::plumbing::QueryCtxt>
  42:     0x7f03e8c88410 - <rustc_query_impl[217bee59c5548bf5]::Queries as rustc_middle[a96ac5d591578447]::ty::query::QueryEngine>::analysis
  43:     0x7f03e8aad2f9 - <rustc_middle[a96ac5d591578447]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[d355a67661263e47]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[125d846441ac421f]::result::Result<(), rustc_span[f8bdfaef83e46314]::ErrorGuaranteed>>
  44:     0x7f03e86a5498 - rustc_span[f8bdfaef83e46314]::with_source_map::<core[125d846441ac421f]::result::Result<(), rustc_span[f8bdfaef83e46314]::ErrorGuaranteed>, rustc_interface[6bf42eb308c32713]::interfa
ce::run_compiler<core[125d846441ac421f]::result::Result<(), rustc_span[f8bdfaef83e46314]::ErrorGuaranteed>, rustc_driver_impl[d355a67661263e47]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  45:     0x7f03e869c70c - std[e52d7c968ed01318]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[6bf42eb308c32713]::util::run_in_thread_pool_with_globals<rustc_interface[6bf42eb308c32713]::interface::run_compiler<core[125d846441ac421f]::result::Result<(), rustc_span[f8bdfaef83e46314]::ErrorGuaranteed>, rustc_driver_impl[d355a67661263e47]::run_compiler::{closure#1}>::{closure#0}, core[125d846441ac421f]::result::Result<(), rustc_span[f8bdfaef83e46314]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[125d846441ac421f]::result::Result<(), rustc_span[f8bdfaef83e46314]::ErrorGuaranteed>>
  46:     0x7f03e869c13a - <<std[e52d7c968ed01318]::thread::Builder>::spawn_unchecked_<rustc_interface[6bf42eb308c32713]::util::run_in_thread_pool_with_globals<rustc_interface[6bf42eb308c32713]::interface::run_compiler<core[125d846441ac421f]::result::Result<(), rustc_span[f8bdfaef83e46314]::ErrorGuaranteed>, rustc_driver_impl[d355a67661263e47]::run_compiler::{closure#1}>::{closure#0}, core[125d846441ac421f]::result::Result<(), rustc_span[f8bdfaef83e46314]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[125d846441ac421f]::result::Result<(), rustc_span[f8bdfaef83e46314]::ErrorGuaranteed>>::{closure#1} as core[125d846441ac421f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  47:     0x7f03e60ff793 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc0a50816e1eb2bba
                               at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/alloc/src/boxed.rs:1988:9
  48:     0x7f03e60ff793 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb2f83fc2049033c3
                               at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/alloc/src/boxed.rs:1988:9
  49:     0x7f03e60ff793 - std::sys::unix::thread::Thread::new::thread_start::hce5861512f8bf7ea
                               at /rustc/7b4f48927dce585f747a58083b45ab62b9d73a53/library/std/src/sys/unix/thread.rs:108:17
  50:     0x7f03e5e69ff2 - start_thread
  51:     0x7f03e5eecbfc - clone3
  52:                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 (7b4f48927 2023-03-12) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [fn_sig] computing function signature of `A`
#1 [codegen_fn_attrs] computing codegen attributes of `A`
#2 [check_well_formed] checking that `A` is well-formed
#3 [check_mod_type_wf] checking that types are well-formed in top-level module
#4 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 6 previous errors

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

Metadata

Metadata

Assignees

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.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions