Skip to content

Dead code should consider lang items live #11440

Closed
@huonw

Description

@huonw

They don't get used in the AST directly, so the dead code lint can't detect them.

#[no_std];
#[no_main];

#[no_mangle]
pub fn main(_: i32, _: **u8) -> i32 {
    1 / 1
}

#[lang="fail_"]
fn fail(_: *u8, _: *u8, _: uint) -> ! { loop {} }
$ rustc lang-dead.rs
lang-dead.rs:10:1: 10:50 warning: code is never used: `fail`, #[warn(dead_code)] on by default
lang-dead.rs:10 fn fail(_: *u8, _: *u8, _: uint) -> ! { loop {} }
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[... linking errors ...]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions