Skip to content

Lang item invalid code compiles #32033

Closed
Closed
@GuillaumeGomez

Description

@GuillaumeGomez

The following code compiles whereas it shouldn't:

#![feature(lang_items)]

#[lang = "cookie"]
fn cookie() -> ! {
    loop {}
}

#[lang = "cookie"]
fn cookie2() -> ! {
//~^ ERROR: Duplicate lang item found: `cookie`.
//~| NOTE First definition of `cookie` here.
    loop {}
}

fn main() {}

cc @brson
#31957

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-langRelevant to the language team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions