Skip to content

False positive large_include_file with a small #[doc = include_str("../README.md")] #13670

@Veetaha

Description

@Veetaha

Summary

The lint large_include_file suddenly started showing false-positive warnings on my CI on the latest nightly.

Reproducer

I tried this code:

#![doc = include_str!("doc.md")]

where doc.md is an empty file, or a file containing just a couple of characters (doesn't matter).

I expected that no lint warning would be triggered.

Instead, the lint large_include_file suddenly warns that doc.md is more than 1MB in size.

warning: attempted to include a large file
 --> crates/sandbox/src/main.rs:1:1
  |
1 | #![doc = include_str!("doc.md")]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: the configuration allows a maximum size of 1000000 bytes
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#large_include_file
  = note: requested on the command line with `-W clippy::large-include-file`

Version

rustc 1.84.0-nightly (59cec72a5 2024-11-08)
binary: rustc
commit-hash: 59cec72a57af178767a7b8e7f624b06cc50f1087
commit-date: 2024-11-08
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions