Skip to content

llvm lint: "Return statement in function with noreturn attribute" caused by .count() ? #48227

Closed
@matthiaskrgr

Description

@matthiaskrgr

This was reduced from diff.rs https://github.com/utkarshkukreti/diff.rs

pub fn lines<'a>(left: &'a str) {
    iter(left.lines());
}

fn iter<I, T>(left: I)
where
    I: Clone + Iterator<Item = T> + DoubleEndedIterator,
    T: PartialEq,
{
    let _left_count = left.clone().count();
}
RUSTFLAGS="-C passes=lint"  cargo build  --release
   Compiling diff v0.1.11 (file:///tmp/diff.rs)
Unusual: Return statement in function with noreturn attribute
  ret void
    Finished release [optimized] target(s) in 0.30 secs

The lint warning vanishes when I remove the .count().

rustc 1.25.0-nightly (3ec5a99aa 2018-02-14)
binary: rustc
commit-hash: 3ec5a99aaa0084d97a9e845b34fdf03d1462c475
commit-date: 2018-02-14
host: x86_64-unknown-linux-gnu
release: 1.25.0-nightly
LLVM version: 6.0

EDIT: //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