Skip to content

Miri comparison sanity check is wrong #70804

Closed
@RalfJung

Description

@RalfJung

The following ICEs (example by @eddyb):

#![feature(const_fn)]

const fn nested(x: (for<'a> fn(&'a ()), String)) -> (fn(&'static ()), String) {
    x
}

pub const TEST: (fn(&'static ()), String) = nested((|_x| (), String::new()));

fn main() {}

shows

thread 'rustc' panicked at 'type mismatch when copying!
src: (for<'r> fn(&'r ()), std::string::String),
dest: (fn(&()), std::string::String)', /rustc/853c4774e26ea97b45fe74de9a6f68e526784323/src/libstd/macros.rs:16:9

This means that the check here is wrong. It might be possible to also trigger this without nightly features through const_prop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)A-miriArea: The miri toolC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions