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 gce after unsilencing followup errors #119824

Open
matthiaskrgr opened this issue Jan 10, 2024 · 1 comment
Open

ice gce after unsilencing followup errors #119824

matthiaskrgr opened this issue Jan 10, 2024 · 1 comment
Labels
C-bug Category: This is a bug. F-generic_const_exprs `#![feature(generic_const_exprs)]` 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. S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

#![feature(generic_const_exprs)]

const fn t<const N: usize>() -> u8 {
    N as u8
}

#[repr(u8)]
enum T<const N: u8 = { T::<0>::A as u8 + T::<0>::B as u8 }>
where
    [(); N as usize]:
{
    A = t::<N>() as u8, B
}

before #117449

error: generic parameters may not be used in enum discriminant values
  --> a.rs:12:13
   |
12 |     A = t::<N>() as u8, B
   |             ^ cannot perform const operation using `N`
   |
   = note: const parameters may not be used in enum discriminant values

warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
 --> a.rs:1:12
  |
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 `a`
  --> a.rs:13:2
   |
13 | }
   |  ^ consider adding a `main` function to `a.rs`

error[E0747]: unresolved item provided when a constant was expected
  --> a.rs:12:13
   |
12 |     A = t::<N>() as u8, B
   |             ^
   |
help: if this generic argument was intended as a const parameter, surround it with braces
   |
12 |     A = t::<{ N }>() as u8, B
   |             +   +

error: aborting due to 3 previous errors; 1 warning emitted

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

after #117449

error: generic parameters may not be used in enum discriminant values
  --> a.rs:12:13
   |
12 |     A = t::<N>() as u8, B
   |             ^ cannot perform const operation using `N`
   |
   = note: const parameters may not be used in enum discriminant values

warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
 --> a.rs:1:12
  |
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 `a`
  --> a.rs:13:2
   |
13 | }
   |  ^ consider adding a `main` function to `a.rs`

error[E0747]: unresolved item provided when a constant was expected
  --> a.rs:12:13
   |
12 |     A = t::<N>() as u8, B
   |             ^
   |
help: if this generic argument was intended as a const parameter, surround it with braces
   |
12 |     A = t::<{ N }>() as u8, B
   |             +   +

error: internal compiler error: compiler/rustc_middle/src/ty/generic_args.rs:940:9: const parameter `N/#0` (N/#0: u8/0) out of range when substituting args=[]

thread 'rustc' panicked at /rustc/94807670a6a3834cc9b71b0b803d49d307c9ba5d/compiler/rustc_errors/src/lib.rs:937:30:
Box<dyn Any>
stack backtrace:
   0:     0x7f3378b8c7e6 - std::backtrace_rs::backtrace::libunwind::trace::h0c9ea26daee6c947
                               at /rustc/94807670a6a3834cc9b71b0b803d49d307c9ba5d/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f3378b8c7e6 - std::backtrace_rs::backtrace::trace_unsynchronized::hb1bc1aeb5f61b551
                               at /rustc/94807670a6a3834cc9b71b0b803d49d307c9ba5d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f3378b8c7e6 - std::sys_common::backtrace::_print_fmt::h094aad19be8ebe6d
                               at /rustc/94807670a6a3834cc9b71b0b803d49d307c9ba5d/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f3378b8c7e6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc6874234e7762746
                               at /rustc/94807670a6a3834cc9b71b0b803d49d307c9ba5d/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f3378bdeec0 - core::fmt::rt::Argument::fmt::hdf2968bdc2925a9e
                               at /rustc/94807670a6a3834cc9b71b0b803d49d307c9ba5d/library/core/src/fmt/rt.rs:142:9
   5:     0x7f3378bdeec0 - core::fmt::write::h8664bf9edaaf2694
                               at /rustc/94807670a6a3834cc9b71b0b803d49d307c9ba5d/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f3378b8014f - std::io::Write::write_fmt::h0eaa39fdf46de86b
                               at /rustc/94807670a6a3834cc9b71b0b803d49d307c9ba5d/library/std/src/io/mod.rs:1810:15
   7:     0x7f3378b8c5c4 - std::sys_common::backtrace::_print::hbef740e19ca9f8df
                               at /rustc/94807670a6a3834cc9b71b0b803d49d307c9ba5d/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f3378b8c5c4 - std::sys_common::backtrace::print::h632ce963033ff6b9
                               at /rustc/94807670a6a3834cc9b71b0b803d49d307c9ba5d/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f3378b8f357 - std::panicking::default_hook::{{closure}}::h60c33aff8a33c9d6
  10:     0x7f3378b8f0b9 - std::panicking::default_hook::h5afa325d341c9143
                               at /rustc/94807670a6a3834cc9b71b0b803d49d307c9ba5d/library/std/src/panicking.rs:292:9
  11:     0x7f337b958d7c - std[999b1d78adc0d845]::panicking::update_hook::<alloc[69c273dd4ce48d0d]::boxed::Box<rustc_driver_impl[dbdcdc7d37d3e64f]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f3378b8faa6 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h16a7189283919a61
                               at /rustc/94807670a6a3834cc9b71b0b803d49d307c9ba5d/library/alloc/src/boxed.rs:2030:9
  13:     0x7f3378b8faa6 - std::panicking::rust_panic_with_hook::hca001e421e65617b
                               at /rustc/94807670a6a3834cc9b71b0b803d49d307c9ba5d/library/std/src/panicking.rs:785:13
  14:     0x7f337b98add4 - std[999b1d78adc0d845]::panicking::begin_panic::<rustc_errors[d7e4352a7b753d34]::ExplicitBug>::{closure#0}
  15:     0x7f337b9876c6 - std[999b1d78adc0d845]::sys_common::backtrace::__rust_end_short_backtrace::<std[999b1d78adc0d845]::panicking::begin_panic<rustc_errors[d7e4352a7b753d34]::ExplicitBug>::{closure#0}, !>
  16:     0x7f337b987336 - std[999b1d78adc0d845]::panicking::begin_panic::<rustc_errors[d7e4352a7b753d34]::ExplicitBug>
  17:     0x7f337b995d21 - <rustc_errors[d7e4352a7b753d34]::diagnostic_builder::BugAbort as rustc_errors[d7e4352a7b753d34]::diagnostic_builder::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7f337bd5d59e - <rustc_errors[d7e4352a7b753d34]::DiagCtxt>::bug::<alloc[69c273dd4ce48d0d]::string::String>
  19:     0x7f337bdf5f8b - rustc_middle[c0a27e9ee4b37138]::util::bug::opt_span_bug_fmt::<rustc_span[1a57749618183ecc]::span_encoding::Span>::{closure#0}
  20:     0x7f337bddeb7a - rustc_middle[c0a27e9ee4b37138]::ty::context::tls::with_opt::<rustc_middle[c0a27e9ee4b37138]::util::bug::opt_span_bug_fmt<rustc_span[1a57749618183ecc]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f337bddea18 - rustc_middle[c0a27e9ee4b37138]::ty::context::tls::with_context_opt::<rustc_middle[c0a27e9ee4b37138]::ty::context::tls::with_opt<rustc_middle[c0a27e9ee4b37138]::util::bug::opt_span_bug_fmt<rustc_span[1a57749618183ecc]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f3379d8d1c0 - rustc_middle[c0a27e9ee4b37138]::util::bug::bug_fmt
  23:     0x7f337bdec246 - <rustc_middle[c0a27e9ee4b37138]::ty::generic_args::ArgFolder>::const_param_out_of_range
  24:     0x7f337cc35b76 - <rustc_middle[c0a27e9ee4b37138]::ty::generic_args::ArgFolder as rustc_type_ir[4c7c7cd896c28536]::fold::TypeFolder<rustc_middle[c0a27e9ee4b37138]::ty::context::TyCtxt>>::fold_const
  25:     0x7f337d0619c7 - <&rustc_middle[c0a27e9ee4b37138]::ty::list::List<rustc_middle[c0a27e9ee4b37138]::ty::generic_args::GenericArg> as rustc_type_ir[4c7c7cd896c28536]::fold::TypeFoldable<rustc_middle[c0a27e9ee4b37138]::ty::context::TyCtxt>>::try_fold_with::<rustc_middle[c0a27e9ee4b37138]::ty::generic_args::ArgFolder>
  26:     0x7f337cc35a77 - <rustc_middle[c0a27e9ee4b37138]::ty::generic_args::ArgFolder as rustc_type_ir[4c7c7cd896c28536]::fold::TypeFolder<rustc_middle[c0a27e9ee4b37138]::ty::context::TyCtxt>>::fold_const
  27:     0x7f337cc05af0 - <rustc_middle[c0a27e9ee4b37138]::ty::generic_args::ArgFolder as rustc_type_ir[4c7c7cd896c28536]::fold::TypeFolder<rustc_middle[c0a27e9ee4b37138]::ty::context::TyCtxt>>::fold_ty
  28:     0x7f337cc02364 - <rustc_middle[c0a27e9ee4b37138]::ty::generic_args::GenericArg as rustc_type_ir[4c7c7cd896c28536]::fold::TypeFoldable<rustc_middle[c0a27e9ee4b37138]::ty::context::TyCtxt>>::try_fold_with::<rustc_middle[c0a27e9ee4b37138]::ty::generic_args::ArgFolder>
  29:     0x7f337cc35565 - <rustc_middle[c0a27e9ee4b37138]::ty::Clause as rustc_type_ir[4c7c7cd896c28536]::fold::TypeFoldable<rustc_middle[c0a27e9ee4b37138]::ty::context::TyCtxt>>::try_fold_with::<rustc_middle[c0a27e9ee4b37138]::ty::generic_args::ArgFolder>
  30:     0x7f337cc334ba - <rustc_middle[c0a27e9ee4b37138]::ty::generics::GenericPredicates>::instantiate_into
  31:     0x7f337cdd76ba - <rustc_trait_selection[eaa2cb578abf01d8]::traits::wf::WfPredicates>::nominal_obligations
  32:     0x7f337ce771d0 - <rustc_trait_selection[eaa2cb578abf01d8]::traits::wf::WfPredicates>::compute
  33:     0x7f3379c6b9a2 - <rustc_trait_selection[eaa2cb578abf01d8]::traits::fulfill::FulfillProcessor as rustc_data_structures[b1e775e348ad0e62]::obligation_forest::ObligationProcessor>::process_obligation
  34:     0x7f337cc1517b - <rustc_data_structures[b1e775e348ad0e62]::obligation_forest::ObligationForest<rustc_trait_selection[eaa2cb578abf01d8]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[eaa2cb578abf01d8]::traits::fulfill::FulfillProcessor>
  35:     0x7f337d2b3ca8 - <rustc_trait_selection[eaa2cb578abf01d8]::traits::engine::ObligationCtxt>::select_all_or_error
  36:     0x7f337cd62b44 - rustc_hir_analysis[f99769aaf9fbe3be]::check::wfcheck::check_type_defn
  37:     0x7f337d30030b - rustc_hir_analysis[f99769aaf9fbe3be]::check::wfcheck::check_well_formed
  38:     0x7f337d2fefb3 - rustc_query_impl[57fa99c9f9bc5eb5]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[57fa99c9f9bc5eb5]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c0a27e9ee4b37138]::query::erase::Erased<[u8; 1usize]>>
  39:     0x7f337d2fe6b1 - rustc_query_system[a4bae605c4fc5fe8]::query::plumbing::try_execute_query::<rustc_query_impl[57fa99c9f9bc5eb5]::DynamicConfig<rustc_query_system[a4bae605c4fc5fe8]::query::caches::VecCache<rustc_hir[ec81b7385329ac7f]::hir_id::OwnerId, rustc_middle[c0a27e9ee4b37138]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[57fa99c9f9bc5eb5]::plumbing::QueryCtxt, false>
  40:     0x7f337d2fe41b - rustc_query_impl[57fa99c9f9bc5eb5]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  41:     0x7f337d2fbdb7 - rustc_hir_analysis[f99769aaf9fbe3be]::check::wfcheck::check_mod_type_wf
  42:     0x7f337d2fbcfb - rustc_query_impl[57fa99c9f9bc5eb5]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[57fa99c9f9bc5eb5]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c0a27e9ee4b37138]::query::erase::Erased<[u8; 1usize]>>
  43:     0x7f337d2faebb - rustc_query_system[a4bae605c4fc5fe8]::query::plumbing::try_execute_query::<rustc_query_impl[57fa99c9f9bc5eb5]::DynamicConfig<rustc_query_system[a4bae605c4fc5fe8]::query::caches::DefaultCache<rustc_span[1a57749618183ecc]::def_id::LocalModDefId, rustc_middle[c0a27e9ee4b37138]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[57fa99c9f9bc5eb5]::plumbing::QueryCtxt, false>
  44:     0x7f337d2fac53 - rustc_query_impl[57fa99c9f9bc5eb5]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  45:     0x7f337d0e331a - <rustc_middle[c0a27e9ee4b37138]::hir::map::Map>::try_par_for_each_module::<rustc_hir_analysis[f99769aaf9fbe3be]::check_crate::{closure#4}::{closure#0}>::{closure#0}
  46:     0x7f337d0e3b50 - rustc_hir_analysis[f99769aaf9fbe3be]::check_crate
  47:     0x7f337d615619 - rustc_interface[8630123b344ba534]::passes::analysis
  48:     0x7f337d61525f - rustc_query_impl[57fa99c9f9bc5eb5]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[57fa99c9f9bc5eb5]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c0a27e9ee4b37138]::query::erase::Erased<[u8; 1usize]>>
  49:     0x7f337dbc9524 - rustc_query_system[a4bae605c4fc5fe8]::query::plumbing::try_execute_query::<rustc_query_impl[57fa99c9f9bc5eb5]::DynamicConfig<rustc_query_system[a4bae605c4fc5fe8]::query::caches::SingleCache<rustc_middle[c0a27e9ee4b37138]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[57fa99c9f9bc5eb5]::plumbing::QueryCtxt, false>
  50:     0x7f337dbc9315 - rustc_query_impl[57fa99c9f9bc5eb5]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  51:     0x7f337d950008 - rustc_interface[8630123b344ba534]::interface::run_compiler::<core[1ecfc9c7dbf148b3]::result::Result<(), rustc_span[1a57749618183ecc]::ErrorGuaranteed>, rustc_driver_impl[dbdcdc7d37d3e64f]::run_compiler::{closure#0}>::{closure#0}
  52:     0x7f337dbee746 - std[999b1d78adc0d845]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[8630123b344ba534]::util::run_in_thread_with_globals<rustc_interface[8630123b344ba534]::util::run_in_thread_pool_with_globals<rustc_interface[8630123b344ba534]::interface::run_compiler<core[1ecfc9c7dbf148b3]::result::Result<(), rustc_span[1a57749618183ecc]::ErrorGuaranteed>, rustc_driver_impl[dbdcdc7d37d3e64f]::run_compiler::{closure#0}>::{closure#0}, core[1ecfc9c7dbf148b3]::result::Result<(), rustc_span[1a57749618183ecc]::ErrorGuaranteed>>::{closure#0}, core[1ecfc9c7dbf148b3]::result::Result<(), rustc_span[1a57749618183ecc]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1ecfc9c7dbf148b3]::result::Result<(), rustc_span[1a57749618183ecc]::ErrorGuaranteed>>
  53:     0x7f337dbee573 - <<std[999b1d78adc0d845]::thread::Builder>::spawn_unchecked_<rustc_interface[8630123b344ba534]::util::run_in_thread_with_globals<rustc_interface[8630123b344ba534]::util::run_in_thread_pool_with_globals<rustc_interface[8630123b344ba534]::interface::run_compiler<core[1ecfc9c7dbf148b3]::result::Result<(), rustc_span[1a57749618183ecc]::ErrorGuaranteed>, rustc_driver_impl[dbdcdc7d37d3e64f]::run_compiler::{closure#0}>::{closure#0}, core[1ecfc9c7dbf148b3]::result::Result<(), rustc_span[1a57749618183ecc]::ErrorGuaranteed>>::{closure#0}, core[1ecfc9c7dbf148b3]::result::Result<(), rustc_span[1a57749618183ecc]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1ecfc9c7dbf148b3]::result::Result<(), rustc_span[1a57749618183ecc]::ErrorGuaranteed>>::{closure#1} as core[1ecfc9c7dbf148b3]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  54:     0x7f3378b999d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h75905edabd5878b2
                               at /rustc/94807670a6a3834cc9b71b0b803d49d307c9ba5d/library/alloc/src/boxed.rs:2016:9
  55:     0x7f3378b999d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hbed8035343ffa301
                               at /rustc/94807670a6a3834cc9b71b0b803d49d307c9ba5d/library/alloc/src/boxed.rs:2016:9
  56:     0x7f3378b999d5 - std::sys::unix::thread::Thread::new::thread_start::hde523d9576990e45
                               at /rustc/94807670a6a3834cc9b71b0b803d49d307c9ba5d/library/std/src/sys/unix/thread.rs:108:17
  57:     0x7f33789459eb - <unknown>
  58:     0x7f33789c97cc - <unknown>
  59:                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: please attach the file at `/tmp/im/rustc-ice-2024-01-10T17_44_55-3921591.txt` to your bug report

query stack during panic:
#0 [check_well_formed] checking that `T` 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: aborting due to 4 previous errors; 1 warning emitted

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

cc @oli-obk

@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 Jan 10, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 10, 2024
@oli-obk oli-obk added requires-nightly This issue requires a nightly compiler in some way. F-generic_const_exprs `#![feature(generic_const_exprs)]` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 10, 2024
@compiler-errors
Copy link
Member

compiler-errors commented Jan 10, 2024

This is just another manifestation of the "default param can't reference generics/associated types form the same item". I don't think this needs fixing as long as GCE remains super broken.

@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Apr 15, 2024
@workingjubilee workingjubilee added the requires-incomplete-features This issue requires the use of incomplete features. label Jun 6, 2024
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)]` 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. S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants