Skip to content

Reference to const that is a reference implicitly flattens #22481

Description

@sfackler
fn foo() -> &'static i32 {
    const F: &'static i32 = &3;
    &F
}

fn main() {
    println!("{}", foo());
}

This compiles and prints the right value, as does the same program with the & in front of F removed.

cc @eddyb probably related to the const rvalue promotions change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions