Skip to content

Compiler panic when calling map in a const expression #23828

Closed
@withoutboats

Description

@withoutboats

http://is.gd/zCNViG

const VV: Vec<&'static str> =
    vec!("A" , "B").drain().map(|s| s).collect::<Vec<&'static str>>();

Obviously it is intended that this code produce a compiler error, but it also causes the compiler to panic with this message:

thread 'rustc' panicked at 'assertion failed: self.mode == Mode::Var',
/home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc/middle/check_const.rs:232

Metadata

Metadata

Assignees

No one assigned

    Labels

    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