Skip to content

ICE: debug_assert with -Zunstable-options #97725

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

code from ./src/test/ui/const-generics/occurs-check/unify-fixpoint.rs
you need a rustc build with debug assertions enable to reproduce this

// check-pass
#![feature(generic_const_exprs)] //~ WARN the feature `generic_const_exprs` is incomplete


fn bind<const N: usize>(value: [u8; N + 2]) -> [u8; N * 2] {
    todo!()
}

fn main() {
    let mut arr = Default::default();
    arr = bind::<2>(arr);
}

Meta

rustc --version --verbose:

9a74608543d499bcc7dd505e195e8bfab9447315 built with debug assertions

Error output

rustc -Zunstable-options unify-fixpoint.rs

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

warning: unused variable: `value`
 --> unify-fixpoint.rs:5:25
  |
5 | fn bind<const N: usize>(value: [u8; N + 2]) -> [u8; N * 2] {
  |                         ^^^^^ help: if this is intentional, prefix it with an underscore: `_value`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: value assigned to `arr` is never read
  --> unify-fixpoint.rs:11:5
   |
11 |     arr = bind::<2>(arr);
   |     ^^^
   |
   = note: `#[warn(unused_assignments)]` on by default
   = help: maybe it is overwritten before being read?

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `Binder(<[u8; _] as std::default::Default>, [])`,
 right: `Binder(<[u8; 4] as std::default::Default>, [])`', compiler/rustc_trait_selection/src/traits/codegen.rs:29:5
stack backtrace:

Metadata

Metadata

Assignees

No one assigned

    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.requires-debug-assertionsThis issue requires a build of rustc or tooling with debug-assertions in some way

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions