Skip to content

ICE: effects / infer: assertion failed: bool == str  #118520

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

pub const fn hmm<T, #[rustc_host] const host: str = true>() -> usize {}

const _: () = {
    let x = hmm::<()>();
};

original:

// check-pass

// gate-test-effects
// ^ effects doesn't have a gate so we will trick tidy into thinking this is a gate test

#![feature(const_trait_impl, effects, rustc_attrs)]

// ensure we are passing in the correct host effect in always const contexts.

pub const fn hmm<T, #[rustc_host] const host: str = true>() -> usize {
    if Tr {
        1
    } else {
        0
    }
}

const _: () = {
    let x = hmm::<()>();
    assert!(0 == x);
};

pub const fn uwu(x: [u8; hmm::<()>()]) {
    let [] = x;
}

fn main() {}

Version information

rustc 1.76.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.76.0-dev
LLVM version: 17.0.5

Command:
/home/matthias/.rustup/toolchains/local-debug-assertions/bin/rustc

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-effects`#![feature(effects)]`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 wayrequires-internal-featuresThis issue requires the use of internal features.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions