Skip to content

false positive: unstable const fn #5995

Closed
@Nugine

Description

@Nugine

I tried this code:

#![deny(clippy::missing_const_for_fn)]

/*
error: this could be a `const fn`
*/

fn is_ascii_digit(byte: u8) -> bool {
    byte.is_ascii_digit()
}

/*
error: `core::num::<impl u8>::is_ascii_digit` is not yet stable as a const fn
*/

// const fn is_ascii_digit(byte: u8) -> bool {
//     byte.is_ascii_digit()
// }

fn main() {
    dbg!(is_ascii_digit(b'1'));
}

Meta

  • cargo clippy -V: clippy 0.0.212 (04488af 2020-08-24)
  • rustc -Vv:
    rustc 1.46.0 (04488afe3 2020-08-24)
    binary: rustc
    commit-hash: 04488afe34512aa4c33566eb16d8c912a3ae04f9
    commit-date: 2020-08-24
    host: x86_64-unknown-linux-gnu
    release: 1.46.0
    LLVM version: 10.0
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.I-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when applied

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions