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: None in compiler/rustc_middle/src/ty/sty.rs #129209

Open
matthiaskrgr opened this issue Aug 17, 2024 · 2 comments
Open

ICE: None in compiler/rustc_middle/src/ty/sty.rs #129209

matthiaskrgr opened this issue Aug 17, 2024 · 2 comments
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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

auto-reduced (treereduce-rust):

impl<
        const N: usize = {
            const {
                static || {
                    let first = Foo([0; FOO_SIZE]);
                    yield;

                    yield;

                    yield;
                }
            }
        },
    > PartialEq<FixedI8<FRAC_RHS>> for True
{
}

original:

#![feature(generic_const_exprs)]

pub trait True {}

impl<const N: usize = { const {
    static || {
        let first = Foo([0; FOO_SIZE]);
        yield;
        let second = first;
        yield;
        let second = first;
        yield;
    }
} }> PartialEq<FixedI8<FRAC_RHS>> for v0<FRAC_LHS> where
    If<{}>: True
{
}
#![feature(generic_const_exprs)]

pub trait True {}

impl<const pointer_like_trait: usize = { const { InvariantRef::<'a>::NEW } }> PartialEq<FixedI8<FRAC_RHS>> for FixedI8<FRAC_LHS> where
    If<{}>: True {}

Version information

rustc 1.82.0-nightly (0f26ee4fd 2024-08-17)
binary: rustc
commit-hash: 0f26ee4fd95a1c046582dfb18892f520788e2c2c
commit-date: 2024-08-17
host: x86_64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 19.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0412]: cannot find type `FixedI8` in this scope
  --> /tmp/icemaker_global_tempdir.xxLsOJeDobON/rustc_testrunner_tmpdir_reporting.EW3ZNLfKk1Q3/mvce.rs:14:17
   |
14 |     > PartialEq<FixedI8<FRAC_RHS>> for True
   |                 ^^^^^^^ not found in this scope

error[E0412]: cannot find type `FRAC_RHS` in this scope
  --> /tmp/icemaker_global_tempdir.xxLsOJeDobON/rustc_testrunner_tmpdir_reporting.EW3ZNLfKk1Q3/mvce.rs:14:25
   |
14 |     > PartialEq<FixedI8<FRAC_RHS>> for True
   |                         ^^^^^^^^ not found in this scope
   |
help: you might be missing a type parameter
   |
13 |         }, FRAC_RHS,
   |          ++++++++++

error[E0412]: cannot find type `True` in this scope
  --> /tmp/icemaker_global_tempdir.xxLsOJeDobON/rustc_testrunner_tmpdir_reporting.EW3ZNLfKk1Q3/mvce.rs:14:40
   |
14 |     > PartialEq<FixedI8<FRAC_RHS>> for True
   |                                        ^^^^ not found in this scope
   |
help: you may want to use a bool value instead
   |
14 |     > PartialEq<FixedI8<FRAC_RHS>> for true
   |                                        ~~~~

error[E0425]: cannot find value `FOO_SIZE` in this scope
 --> /tmp/icemaker_global_tempdir.xxLsOJeDobON/rustc_testrunner_tmpdir_reporting.EW3ZNLfKk1Q3/mvce.rs:5:41
  |
5 |                     let first = Foo([0; FOO_SIZE]);
  |                                         ^^^^^^^^ not found in this scope

error[E0658]: yield syntax is experimental
 --> /tmp/icemaker_global_tempdir.xxLsOJeDobON/rustc_testrunner_tmpdir_reporting.EW3ZNLfKk1Q3/mvce.rs:6:21
  |
6 |                     yield;
  |                     ^^^^^
  |
  = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
  = help: add `#![feature(coroutines)]` to the crate attributes to enable
  = note: this compiler was built on 2024-08-17; consider upgrading it if it is out of date

error[E0658]: yield syntax is experimental
 --> /tmp/icemaker_global_tempdir.xxLsOJeDobON/rustc_testrunner_tmpdir_reporting.EW3ZNLfKk1Q3/mvce.rs:8:21
  |
8 |                     yield;
  |                     ^^^^^
  |
  = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
  = help: add `#![feature(coroutines)]` to the crate attributes to enable
  = note: this compiler was built on 2024-08-17; consider upgrading it if it is out of date

error[E0658]: yield syntax is experimental
  --> /tmp/icemaker_global_tempdir.xxLsOJeDobON/rustc_testrunner_tmpdir_reporting.EW3ZNLfKk1Q3/mvce.rs:10:21
   |
10 |                     yield;
   |                     ^^^^^
   |
   = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
   = help: add `#![feature(coroutines)]` to the crate attributes to enable
   = note: this compiler was built on 2024-08-17; consider upgrading it if it is out of date

error[E0658]: yield syntax is experimental
 --> /tmp/icemaker_global_tempdir.xxLsOJeDobON/rustc_testrunner_tmpdir_reporting.EW3ZNLfKk1Q3/mvce.rs:6:21
  |
6 |                     yield;
  |                     ^^^^^
  |
  = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
  = help: add `#![feature(coroutines)]` to the crate attributes to enable
  = note: this compiler was built on 2024-08-17; consider upgrading it if it is out of date

error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks
 --> /tmp/icemaker_global_tempdir.xxLsOJeDobON/rustc_testrunner_tmpdir_reporting.EW3ZNLfKk1Q3/mvce.rs:6:21
  |
6 |                     yield;
  |                     ^^^^^
  |
help: use `#[coroutine]` to make this closure a coroutine
  |
4 |                 #[coroutine] static || {
  |                 ++++++++++++

error[E0658]: yield syntax is experimental
 --> /tmp/icemaker_global_tempdir.xxLsOJeDobON/rustc_testrunner_tmpdir_reporting.EW3ZNLfKk1Q3/mvce.rs:8:21
  |
8 |                     yield;
  |                     ^^^^^
  |
  = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
  = help: add `#![feature(coroutines)]` to the crate attributes to enable
  = note: this compiler was built on 2024-08-17; consider upgrading it if it is out of date

error[E0658]: yield syntax is experimental
  --> /tmp/icemaker_global_tempdir.xxLsOJeDobON/rustc_testrunner_tmpdir_reporting.EW3ZNLfKk1Q3/mvce.rs:10:21
   |
10 |                     yield;
   |                     ^^^^^
   |
   = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
   = help: add `#![feature(coroutines)]` to the crate attributes to enable
   = note: this compiler was built on 2024-08-17; consider upgrading it if it is out of date

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.xxLsOJeDobON/rustc_testrunner_tmpdir_reporting.EW3ZNLfKk1Q3/mvce.rs:16:2
   |
16 | }
   |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.xxLsOJeDobON/rustc_testrunner_tmpdir_reporting.EW3ZNLfKk1Q3/mvce.rs`

error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
  --> /tmp/icemaker_global_tempdir.xxLsOJeDobON/rustc_testrunner_tmpdir_reporting.EW3ZNLfKk1Q3/mvce.rs:2:9
   |
2  | /         const N: usize = {
3  | |             const {
4  | |                 static || {
5  | |                     let first = Foo([0; FOO_SIZE]);
...  |
12 | |             }
13 | |         },
   | |_________^

error[E0425]: cannot find function, tuple struct or tuple variant `Foo` in this scope
 --> /tmp/icemaker_global_tempdir.xxLsOJeDobON/rustc_testrunner_tmpdir_reporting.EW3ZNLfKk1Q3/mvce.rs:5:33
  |
5 |                     let first = Foo([0; FOO_SIZE]);
  |                                 ^^^ not found in this scope

thread 'rustc' panicked at compiler/rustc_middle/src/ty/sty.rs:362:36:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x7b29de7c429d - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hce35dec2bed7e8e1
   1:     0x7b29df005297 - core::fmt::write::haaf8a728f3019c12
   2:     0x7b29e02bbd91 - std::io::Write::write_fmt::hb0dc5188703aea0d
   3:     0x7b29de7c697b - std::panicking::default_hook::{{closure}}::h35c501ae74c82675
   4:     0x7b29de7c65ee - std::panicking::default_hook::hc1ddd62643c4c855
   5:     0x7b29dd958729 - std[54b021f941472252]::panicking::update_hook::<alloc[8840b3d3a55bb7af]::boxed::Box<rustc_driver_impl[ec4d44b725e7aa11]::install_ice_hook::{closure#0}>>::{closure#0}
   6:     0x7b29de7c7297 - std::panicking::rust_panic_with_hook::h7960ad04eaeb646d
   7:     0x7b29de7c6f23 - std::panicking::begin_panic_handler::{{closure}}::had964436d76b60a3
   8:     0x7b29de7c4759 - std::sys::backtrace::__rust_end_short_backtrace::h287862de25ceaa43
   9:     0x7b29de7c6c24 - rust_begin_unwind
  10:     0x7b29db6b1253 - core::panicking::panic_fmt::hb93ba995a275cef9
  11:     0x7b29db87fa9c - core::panicking::panic::he4e48426481834b3
  12:     0x7b29dbd05839 - core::option::unwrap_failed::h850f2e87e5e16379
  13:     0x7b29e0a8af3c - <rustc_middle[10ec7aec7d9fdda3]::ty::sty::ParamConst>::find_ty_from_env.cold
  14:     0x7b29db67b97b - <rustc_trait_selection[78ffaaaa71d4a69f]::traits::fulfill::FulfillProcessor as rustc_data_structures[de25bd5cf5c038d2]::obligation_forest::ObligationProcessor>::process_obligation
  15:     0x7b29df008777 - <rustc_data_structures[de25bd5cf5c038d2]::obligation_forest::ObligationForest<rustc_trait_selection[78ffaaaa71d4a69f]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[78ffaaaa71d4a69f]::traits::fulfill::FulfillProcessor>
  16:     0x7b29df0cf344 - <rustc_hir_typeck[cd6451a3b3fe12c4]::fn_ctxt::FnCtxt>::demand_coerce_diag
  17:     0x7b29dfafeae0 - <rustc_hir_typeck[cd6451a3b3fe12c4]::fn_ctxt::FnCtxt>::check_decl
  18:     0x7b29dfafbd41 - <rustc_hir_typeck[cd6451a3b3fe12c4]::fn_ctxt::FnCtxt>::check_block_with_expected
  19:     0x7b29dfb02247 - <rustc_hir_typeck[cd6451a3b3fe12c4]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  20:     0x7b29df243661 - rustc_hir_typeck[cd6451a3b3fe12c4]::check::check_fn
  21:     0x7b29df985eea - <rustc_hir_typeck[cd6451a3b3fe12c4]::fn_ctxt::FnCtxt>::check_expr_closure
  22:     0x7b29dfb0614a - <rustc_hir_typeck[cd6451a3b3fe12c4]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  23:     0x7b29dfafae56 - <rustc_hir_typeck[cd6451a3b3fe12c4]::fn_ctxt::FnCtxt>::check_block_with_expected
  24:     0x7b29dfb02247 - <rustc_hir_typeck[cd6451a3b3fe12c4]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  25:     0x7b29dfb0a87f - <rustc_hir_typeck[cd6451a3b3fe12c4]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  26:     0x7b29dfafae56 - <rustc_hir_typeck[cd6451a3b3fe12c4]::fn_ctxt::FnCtxt>::check_block_with_expected
  27:     0x7b29dfb02247 - <rustc_hir_typeck[cd6451a3b3fe12c4]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  28:     0x7b29df7fe24b - rustc_hir_typeck[cd6451a3b3fe12c4]::typeck
  29:     0x7b29df7fb975 - rustc_query_impl[69287ea093d06d1d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[69287ea093d06d1d]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[10ec7aec7d9fdda3]::query::erase::Erased<[u8; 8usize]>>
  30:     0x7b29df2d4bf9 - rustc_query_system[1449707d44461b06]::query::plumbing::try_execute_query::<rustc_query_impl[69287ea093d06d1d]::DynamicConfig<rustc_query_system[1449707d44461b06]::query::caches::VecCache<rustc_span[a5a4c6b08f7cf6f]::def_id::LocalDefId, rustc_middle[10ec7aec7d9fdda3]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[69287ea093d06d1d]::plumbing::QueryCtxt, false>
  31:     0x7b29df2d3e15 - rustc_query_impl[69287ea093d06d1d]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7b29df2420f5 - rustc_middle[10ec7aec7d9fdda3]::query::plumbing::query_get_at::<rustc_query_system[1449707d44461b06]::query::caches::VecCache<rustc_span[a5a4c6b08f7cf6f]::def_id::LocalDefId, rustc_middle[10ec7aec7d9fdda3]::query::erase::Erased<[u8; 8usize]>>>
  33:     0x7b29df7fcdb5 - rustc_hir_typeck[cd6451a3b3fe12c4]::typeck
  34:     0x7b29df7fb975 - rustc_query_impl[69287ea093d06d1d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[69287ea093d06d1d]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[10ec7aec7d9fdda3]::query::erase::Erased<[u8; 8usize]>>
  35:     0x7b29df2d4bf9 - rustc_query_system[1449707d44461b06]::query::plumbing::try_execute_query::<rustc_query_impl[69287ea093d06d1d]::DynamicConfig<rustc_query_system[1449707d44461b06]::query::caches::VecCache<rustc_span[a5a4c6b08f7cf6f]::def_id::LocalDefId, rustc_middle[10ec7aec7d9fdda3]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[69287ea093d06d1d]::plumbing::QueryCtxt, false>
  36:     0x7b29df2d3e15 - rustc_query_impl[69287ea093d06d1d]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  37:     0x7b29df2d3a9b - <rustc_middle[10ec7aec7d9fdda3]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[c0d9d1e917b71b24]::check_crate::{closure#4}>::{closure#0}
  38:     0x7b29df2d17e4 - rustc_hir_analysis[c0d9d1e917b71b24]::check_crate
  39:     0x7b29df784cbf - rustc_interface[f40e7651e6b02ea1]::passes::run_required_analyses
  40:     0x7b29dfb5c49e - rustc_interface[f40e7651e6b02ea1]::passes::analysis
  41:     0x7b29dfb5c471 - rustc_query_impl[69287ea093d06d1d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[69287ea093d06d1d]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[10ec7aec7d9fdda3]::query::erase::Erased<[u8; 1usize]>>
  42:     0x7b29dff867ee - rustc_query_system[1449707d44461b06]::query::plumbing::try_execute_query::<rustc_query_impl[69287ea093d06d1d]::DynamicConfig<rustc_query_system[1449707d44461b06]::query::caches::SingleCache<rustc_middle[10ec7aec7d9fdda3]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[69287ea093d06d1d]::plumbing::QueryCtxt, false>
  43:     0x7b29dff8654f - rustc_query_impl[69287ea093d06d1d]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  44:     0x7b29dfdd38ea - rustc_interface[f40e7651e6b02ea1]::interface::run_compiler::<core[5070cb7ec77c977]::result::Result<(), rustc_span[a5a4c6b08f7cf6f]::ErrorGuaranteed>, rustc_driver_impl[ec4d44b725e7aa11]::run_compiler::{closure#0}>::{closure#1}
  45:     0x7b29dfdb3210 - std[54b021f941472252]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[f40e7651e6b02ea1]::util::run_in_thread_with_globals<rustc_interface[f40e7651e6b02ea1]::util::run_in_thread_pool_with_globals<rustc_interface[f40e7651e6b02ea1]::interface::run_compiler<core[5070cb7ec77c977]::result::Result<(), rustc_span[a5a4c6b08f7cf6f]::ErrorGuaranteed>, rustc_driver_impl[ec4d44b725e7aa11]::run_compiler::{closure#0}>::{closure#1}, core[5070cb7ec77c977]::result::Result<(), rustc_span[a5a4c6b08f7cf6f]::ErrorGuaranteed>>::{closure#0}, core[5070cb7ec77c977]::result::Result<(), rustc_span[a5a4c6b08f7cf6f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5070cb7ec77c977]::result::Result<(), rustc_span[a5a4c6b08f7cf6f]::ErrorGuaranteed>>
  46:     0x7b29dfdb387a - <<std[54b021f941472252]::thread::Builder>::spawn_unchecked_<rustc_interface[f40e7651e6b02ea1]::util::run_in_thread_with_globals<rustc_interface[f40e7651e6b02ea1]::util::run_in_thread_pool_with_globals<rustc_interface[f40e7651e6b02ea1]::interface::run_compiler<core[5070cb7ec77c977]::result::Result<(), rustc_span[a5a4c6b08f7cf6f]::ErrorGuaranteed>, rustc_driver_impl[ec4d44b725e7aa11]::run_compiler::{closure#0}>::{closure#1}, core[5070cb7ec77c977]::result::Result<(), rustc_span[a5a4c6b08f7cf6f]::ErrorGuaranteed>>::{closure#0}, core[5070cb7ec77c977]::result::Result<(), rustc_span[a5a4c6b08f7cf6f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5070cb7ec77c977]::result::Result<(), rustc_span[a5a4c6b08f7cf6f]::ErrorGuaranteed>>::{closure#1} as core[5070cb7ec77c977]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  47:     0x7b29dfdb3beb - std::sys::pal::unix::thread::Thread::new::thread_start::he8fde62ed04f9a93
  48:     0x7b29e152339d - <unknown>
  49:     0x7b29e15a849c - <unknown>
  50:                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: please make sure that you have updated to the latest nightly

note: rustc 1.82.0-nightly (0f26ee4fd 2024-08-17) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `<impl at /tmp/icemaker_global_tempdir.xxLsOJeDobON/rustc_testrunner_tmpdir_reporting.EW3ZNLfKk1Q3/mvce.rs:1:1: 14:44>::{constant#0}`
#1 [typeck] type-checking `<impl at /tmp/icemaker_global_tempdir.xxLsOJeDobON/rustc_testrunner_tmpdir_reporting.EW3ZNLfKk1Q3/mvce.rs:1:1: 14:44>::{constant#0}::{constant#0}`
end of query stack
error: aborting due to 14 previous errors

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

@rustbot label +F-generic_const_exprs +F-generic_const_exprs

@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 Aug 17, 2024
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. F-generic_const_exprs `#![feature(generic_const_exprs)]` labels Aug 17, 2024
@matthiaskrgr
Copy link
Member Author

smaller

impl<
        const N: usize = {
            static || {
                Foo([0; X]);
            }
        },
    > PartialEq for True
{
}

@BoxyUwU BoxyUwU added A-const-generics Area: const generics (parameters and arguments) and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. F-generic_const_exprs `#![feature(generic_const_exprs)]` labels Aug 17, 2024
@matthiaskrgr
Copy link
Member Author

also bisects to #125958

@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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

3 participants