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: generic_const_exprs: unexpected non-type Node::GenericParam, #109300

Closed
matthiaskrgr opened this issue Mar 18, 2023 · 4 comments · Fixed by #109364
Closed

ICE: generic_const_exprs: unexpected non-type Node::GenericParam, #109300

matthiaskrgr opened this issue Mar 18, 2023 · 4 comments · Fixed by #109364
Labels
C-bug Category: This is a bug. F-generic_const_exprs `#![feature(generic_const_exprs)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features This issue requires the use of incomplete features. 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 Mar 18, 2023

Code

#![crate_type = "lib"]
#![feature(generic_const_exprs)]
trait B {
    type U<T: A>;
}

fn f<T: B<U<1i32> = ()>>() {}

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (13afbdaa0 2023-03-17)
binary: rustc
commit-hash: 13afbdaa0655dda23d7129e59ac48f1ec88b2084
commit-date: 2023-03-17
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7

Error output

error[E0405]: cannot find trait `A` in this scope
 --> treereduce.out:4:15
  |
4 |     type U<T: A>;
  |               ^ not found in this scope

warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
 --> <crate attribute>:1:9
  |
1 | feature(generic_const_exprs)
  |         ^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
  = note: `#[warn(incomplete_features)]` on by default

error[E0601]: `main` function not found in crate `treereduce`
 --> treereduce.out:7:30
  |
7 | fn f<T: B<U<1i32> = ()>>() {}
  |                              ^ consider adding a `main` function to `treereduce.out`

warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
 --> treereduce.out:1:1
  |
1 | #[crate_type = "lib"]
  | ^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_attributes)]` on by default

error[E0747]: constant provided when a type was expected
 --> treereduce.out:7:13
  |
7 | fn f<T: B<U<1i32> = ()>>() {}
  |             ^^^^
Backtrace


error: internal compiler error: compiler/rustc_hir_analysis/src/collect/type_of.rs:549:18: unexpected non-type Node::GenericParam: Type { default: None, synthetic: false }

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/compiler/rustc_errors/src/lib.rs:1644:9
stack backtrace:
   0:     0x7fb10336739a - std::backtrace_rs::backtrace::libunwind::trace::h84d2711f38e4d049
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fb10336739a - std::backtrace_rs::backtrace::trace_unsynchronized::h07f6ebc5344709db
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fb10336739a - std::sys_common::backtrace::_print_fmt::h05a29271ab24b307
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fb10336739a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2badcaa62266c6d2
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fb1033ca9be - core::fmt::write::h029bd029dcf67de1
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/core/src/fmt/mod.rs:1254:17
   5:     0x7fb10335a225 - std::io::Write::write_fmt::h80e1934b9bd451b8
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/io/mod.rs:1684:15
   6:     0x7fb103367165 - std::sys_common::backtrace::_print::hd15e10f9274c89b0
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7fb103367165 - std::sys_common::backtrace::print::h170965e4e66b5ee4
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7fb103369edf - std::panicking::default_hook::{{closure}}::h0164004bb09e0366
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/panicking.rs:271:22
   9:     0x7fb103369c1b - std::panicking::default_hook::h5e2940911ec5582f
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/panicking.rs:290:9
  10:     0x7fb1065f2415 - rustc_driver_impl[bad2ed848d64dbdc]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fb10336a71d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h0f3cc38fa49d6ba4
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:2002:9
  12:     0x7fb10336a71d - std::panicking::rust_panic_with_hook::h591d1df500c4db69
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/panicking.rs:696:13
  13:     0x7fb106b2aef1 - std[b4247acdb72724ff]::panicking::begin_panic::<rustc_errors[48bb1377a0478866]::ExplicitBug>::{closure#0}
  14:     0x7fb106b28996 - std[b4247acdb72724ff]::sys_common::backtrace::__rust_end_short_backtrace::<std[b4247acdb72724ff]::panicking::begin_panic<rustc_errors[48bb1377a0478866]::ExplicitBug>::{closure#0}, !>
  15:     0x7fb106b3ec96 - std[b4247acdb72724ff]::panicking::begin_panic::<rustc_errors[48bb1377a0478866]::ExplicitBug>
  16:     0x7fb106ba10d6 - std[b4247acdb72724ff]::panic::panic_any::<rustc_errors[48bb1377a0478866]::ExplicitBug>
  17:     0x7fb106b9e896 - <rustc_errors[48bb1377a0478866]::HandlerInner>::bug::<&alloc[c5857ad37805d36e]::string::String>
  18:     0x7fb106b9e560 - <rustc_errors[48bb1377a0478866]::Handler>::bug::<&alloc[c5857ad37805d36e]::string::String>
  19:     0x7fb106b9684b - rustc_middle[eaf6378de1cdbfa8]::util::bug::opt_span_bug_fmt::<rustc_span[4d522547309d7b79]::span_encoding::Span>::{closure#0}
  20:     0x7fb106b9529a - rustc_middle[eaf6378de1cdbfa8]::ty::context::tls::with_opt::<rustc_middle[eaf6378de1cdbfa8]::util::bug::opt_span_bug_fmt<rustc_span[4d522547309d7b79]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7fb106b95266 - rustc_middle[eaf6378de1cdbfa8]::ty::context::tls::with_context_opt::<rustc_middle[eaf6378de1cdbfa8]::ty::context::tls::with_opt<rustc_middle[eaf6378de1cdbfa8]::util::bug::opt_span_bug_fmt<rustc_span[4d522547309d7b79]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7fb106b96796 - rustc_middle[eaf6378de1cdbfa8]::util::bug::opt_span_bug_fmt::<rustc_span[4d522547309d7b79]::span_encoding::Span>
  23:     0x7fb104c874e3 - rustc_middle[eaf6378de1cdbfa8]::util::bug::bug_fmt
  24:     0x7fb105d03ac5 - rustc_hir_analysis[7035f0189d3c093a]::collect::type_of::type_of
  25:     0x7fb104edebad - rustc_query_system[3b264ab6e948b942]::query::plumbing::try_execute_query::<rustc_query_impl[1cc93b35ef872c79]::queries::type_of, rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt>
  26:     0x7fb104edd7bd - <rustc_query_impl[1cc93b35ef872c79]::Queries as rustc_middle[eaf6378de1cdbfa8]::ty::query::QueryEngine>::type_of
  27:     0x7fb105d05113 - rustc_hir_analysis[7035f0189d3c093a]::collect::type_of::type_of
  28:     0x7fb104edebad - rustc_query_system[3b264ab6e948b942]::query::plumbing::try_execute_query::<rustc_query_impl[1cc93b35ef872c79]::queries::type_of, rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt>
  29:     0x7fb104edd7bd - <rustc_query_impl[1cc93b35ef872c79]::Queries as rustc_middle[eaf6378de1cdbfa8]::ty::query::QueryEngine>::type_of
  30:     0x7fb1057e4476 - <rustc_middle[eaf6378de1cdbfa8]::ty::consts::Const>::from_opt_const_arg_anon_const
  31:     0x7fb10677b49e - <rustc_hir_analysis[7035f0189d3c093a]::collect::predicates_of::const_evaluatable_predicates_of::ConstCollector as rustc_hir[f188a593009d666f]::intravisit::Visitor>::visit_anon_const
  32:     0x7fb1067439fa - rustc_hir[f188a593009d666f]::intravisit::walk_generic_args::<rustc_hir_analysis[7035f0189d3c093a]::collect::predicates_of::const_evaluatable_predicates_of::ConstCollector>
  33:     0x7fb106744d44 - rustc_hir[f188a593009d666f]::intravisit::walk_assoc_type_binding::<rustc_hir_analysis[7035f0189d3c093a]::collect::predicates_of::const_evaluatable_predicates_of::ConstCollector>
  34:     0x7fb106743a20 - rustc_hir[f188a593009d666f]::intravisit::walk_generic_args::<rustc_hir_analysis[7035f0189d3c093a]::collect::predicates_of::const_evaluatable_predicates_of::ConstCollector>
  35:     0x7fb106747c0d - rustc_hir[f188a593009d666f]::intravisit::walk_path::<rustc_hir_analysis[7035f0189d3c093a]::collect::predicates_of::const_evaluatable_predicates_of::ConstCollector>
  36:     0x7fb1067449f0 - rustc_hir[f188a593009d666f]::intravisit::walk_where_predicate::<rustc_hir_analysis[7035f0189d3c093a]::collect::predicates_of::const_evaluatable_predicates_of::ConstCollector>
  37:     0x7fb1067424e4 - rustc_hir[f188a593009d666f]::intravisit::walk_generics::<rustc_hir_analysis[7035f0189d3c093a]::collect::predicates_of::const_evaluatable_predicates_of::ConstCollector>
  38:     0x7fb104c121c5 - rustc_hir_analysis[7035f0189d3c093a]::collect::predicates_of::gather_explicit_predicates_of
  39:     0x7fb104c09c5f - rustc_query_system[3b264ab6e948b942]::query::plumbing::try_execute_query::<rustc_query_impl[1cc93b35ef872c79]::queries::explicit_predicates_of, rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt>
  40:     0x7fb104cc9633 - rustc_hir_analysis[7035f0189d3c093a]::collect::predicates_defined_on
  41:     0x7fb104cc7abc - rustc_query_system[3b264ab6e948b942]::query::plumbing::try_execute_query::<rustc_query_impl[1cc93b35ef872c79]::queries::predicates_defined_on, rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt>
  42:     0x7fb104fdfaed - rustc_query_system[3b264ab6e948b942]::query::plumbing::try_execute_query::<rustc_query_impl[1cc93b35ef872c79]::queries::predicates_of, rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt>
  43:     0x7fb104fdea4f - <rustc_query_impl[1cc93b35ef872c79]::Queries as rustc_middle[eaf6378de1cdbfa8]::ty::query::QueryEngine>::predicates_of
  44:     0x7fb104d56d84 - <rustc_hir_analysis[7035f0189d3c093a]::collect::CollectItemTypesVisitor as rustc_hir[f188a593009d666f]::intravisit::Visitor>::visit_item
  45:     0x7fb104d55895 - <rustc_middle[eaf6378de1cdbfa8]::hir::map::Map>::visit_item_likes_in_module::<rustc_hir_analysis[7035f0189d3c093a]::collect::CollectItemTypesVisitor>
  46:     0x7fb104d557ac - rustc_hir_analysis[7035f0189d3c093a]::collect::collect_mod_item_types
  47:     0x7fb105c561c5 - rustc_query_system[3b264ab6e948b942]::query::plumbing::try_execute_query::<rustc_query_impl[1cc93b35ef872c79]::queries::collect_mod_item_types, rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt>
  48:     0x7fb105c55dc3 - <rustc_query_impl[1cc93b35ef872c79]::Queries as rustc_middle[eaf6378de1cdbfa8]::ty::query::QueryEngine>::collect_mod_item_types
  49:     0x7fb104952f63 - <rustc_session[8656a7a78cf578e4]::session::Session>::track_errors::<rustc_hir_analysis[7035f0189d3c093a]::check_crate::{closure#0}, ()>
  50:     0x7fb10494f832 - rustc_hir_analysis[7035f0189d3c093a]::check_crate
  51:     0x7fb104946742 - rustc_interface[dde792dfc5bb5edd]::passes::analysis
  52:     0x7fb105e11aec - rustc_query_system[3b264ab6e948b942]::query::plumbing::try_execute_query::<rustc_query_impl[1cc93b35ef872c79]::queries::analysis, rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt>
  53:     0x7fb105e117e0 - <rustc_query_impl[1cc93b35ef872c79]::Queries as rustc_middle[eaf6378de1cdbfa8]::ty::query::QueryEngine>::analysis
  54:     0x7fb105c6e109 - <rustc_middle[eaf6378de1cdbfa8]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>
  55:     0x7fb1057f852d - <rustc_interface[dde792dfc5bb5edd]::interface::Compiler>::enter::<rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}::{closure#2}, core[9847d4a2e8a02df2]::result::Result<core[9847d4a2e8a02df2]::option::Option<rustc_interface[dde792dfc5bb5edd]::queries::Linker>, rustc_span[4d522547309d7b79]::ErrorGuaranteed>>
  56:     0x7fb1057f6630 - rustc_span[4d522547309d7b79]::with_source_map::<core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>, rustc_interface[dde792dfc5bb5edd]::interface::run_compiler<core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>, rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  57:     0x7fb1057f5bd9 - std[b4247acdb72724ff]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[dde792dfc5bb5edd]::util::run_in_thread_pool_with_globals<rustc_interface[dde792dfc5bb5edd]::interface::run_compiler<core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>, rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}>::{closure#0}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>
  58:     0x7fb105ee6afa - <<std[b4247acdb72724ff]::thread::Builder>::spawn_unchecked_<rustc_interface[dde792dfc5bb5edd]::util::run_in_thread_pool_with_globals<rustc_interface[dde792dfc5bb5edd]::interface::run_compiler<core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>, rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}>::{closure#0}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>::{closure#1} as core[9847d4a2e8a02df2]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  59:     0x7fb1033745f3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h51bca2043facf7d3
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:1988:9
  60:     0x7fb1033745f3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h365da710d54db7ab
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:1988:9
  61:     0x7fb1033745f3 - std::sys::unix::thread::Thread::new::thread_start::hb322f3a535acf0fe
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys/unix/thread.rs:108:17
  62:     0x7fb103106bb5 - <unknown>
  63:     0x7fb103188d90 - <unknown>
  64:                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 (13afbdaa0 2023-03-17) running on x86_64-unknown-linux-gnu

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

query stack during panic:
#0 [type_of] computing type of `B::U::T`
#1 [type_of] computing type of `f::{constant#0}`
#2 [explicit_predicates_of] computing explicit predicates of `f`
#3 [predicates_defined_on] computing predicates of `f`
#4 [predicates_of] computing predicates of `f`
#5 [collect_mod_item_types] collecting item types in top-level module
#6 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 4 previous errors; 2 warnings emitted

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

@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. F-generic_const_exprs `#![feature(generic_const_exprs)]` labels Mar 18, 2023
@Noratrieb Noratrieb added requires-nightly This issue requires a nightly compiler in some way. requires-incomplete-features This issue requires the use of incomplete features. labels Mar 18, 2023
@matthiaskrgr

This comment was marked as outdated.

@matthiaskrgr
Copy link
Member Author

aaah shit, the commit only modified the backtrace 😆 so "panicked at" no longer triggers before that..

@matthiaskrgr
Copy link
Member Author

********************************************************************************
Regression in nightly-2022-09-30
********************************************************************************

fetching https://static.rust-lang.org/dist/2022-09-29/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2022-09-29: 40 B / 40 B [============================================================================================] 100.00 % 514.57 KB/s converted 2022-09-29 to ce7f0f1aa0f02c45cad0749e63f3086234b1f422
fetching https://static.rust-lang.org/dist/2022-09-30/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2022-09-30: 40 B / 40 B [==============================================================================================] 100.00 % 1.09 MB/s converted 2022-09-30 to 9c56d9d6fec6262bbb1549cfe466a812ae2c6523
looking for regression commit between 2022-09-29 and 2022-09-30
opening existing repository at "rust.git"
Found origin remote under name `origin`
refreshing repository at "rust.git"
fetching (via local git) commits from ce7f0f1aa0f02c45cad0749e63f3086234b1f422 to 9c56d9d6fec6262bbb1549cfe466a812ae2c6523
opening existing repository at "rust.git"
Found origin remote under name `origin`
refreshing repository at "rust.git"
looking up first commit
looking up second commit
checking that commits are by bors and thus have ci artifacts...
finding bors merge commits
found 9 bors merge commits in the specified range
  commit[0] 2022-09-28UTC: Auto merge of #100719 - CohenArthur:rust-safe-intrinsic-attribute, r=wesleywiser
  commit[1] 2022-09-28UTC: Auto merge of #102384 - camelid:extrainfo, r=GuillaumeGomez
  commit[2] 2022-09-29UTC: Auto merge of #101833 - jyn514:cross-compile-compiler-builtins, r=Mark-Simulacrum
  commit[3] 2022-09-29UTC: Auto merge of #102450 - JohnTitor:rollup-ahleg93, r=JohnTitor
  commit[4] 2022-09-29UTC: Auto merge of #102328 - cuviper:ibm-stack-probes, r=nagisa
  commit[5] 2022-09-29UTC: Auto merge of #102461 - oli-obk:split_collect_rs, r=lcnr
  commit[6] 2022-09-29UTC: Auto merge of #102471 - Dylan-DPC:rollup-ij3okjt, r=Dylan-DPC
  commit[7] 2022-09-29UTC: Auto merge of #101893 - oli-obk:lift_derive, r=lcnr
  commit[8] 2022-09-29UTC: Auto merge of #102482 - notriddle:rollup-fjm618g, r=notriddle
ERROR: no CI builds available between ce7f0f1aa0f02c45cad0749e63f3086234b1f422 and 9c56d9d6fec6262bbb1549cfe466a812ae2c6523 within last 167 days

@BoxyUwU
Copy link
Member

BoxyUwU commented Mar 19, 2023

maybe #102336 @compiler-errors

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-generic_const_exprs `#![feature(generic_const_exprs)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features This issue requires the use of incomplete features. 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