Skip to content

llvm lint: "unreachable immediately preceded by instruction without side effects" #48228

Open
@matthiaskrgr

Description

@matthiaskrgr

reduced from https://github.com/alexcrichton/rustc-demangle/

pub fn demangle(inner: &str) {
    inner.chars().peekable().by_ref().take(0).count();
}
$ RUSTFLAGS="-C passes=lint"  cargo build 

   Compiling rustc-demangle v0.1.5 (file:///tmp/rustc-demangle)
Unusual: unreachable immediately preceded by instruction without side effects
  unreachable, !dbg !33
    Finished dev [unoptimized + debuginfo] target(s) in 0.31 secs

//cc #7463

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler 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