- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.8k
Open
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Description
Summary
I'm guessing it is also running on the automatic main() function for test,
which is good, but i would expect this to be silenceable
with #[allow(clippy::large_stack_frames)] on the mod test.
Lint Name
large_stack_frames
Reproducer
I tried this code:
Cargo.toml:
[package]
name = "repro"
version = "0.1.0"
edition = "2024"
[lints.clippy]
large_stack_frames = { level = "warn", priority = 0 }
[dependencies]
clippy.toml:
stack-size-threshold = 0
main.rs:
#[allow(clippy::large_stack_frames)]
fn main() {
    println!("Hello, world!");
}
#[cfg(test)]
#[allow(clippy::large_stack_frames)]
mod test {
    #[test]
    fn main_test() {}
}I saw this happen:
$ cargo clippy --all-targets --all-features 
warning: this function may allocate 216 bytes on the stack
   |
   = note: 216 bytes is larger than Clippy's configured `stack-size-threshold` of 0
   = note: allocating large amounts of stack space can overflow the stack and cause the program to abort
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#large_stack_frames
   = note: requested on the command line with `-W clippy::large-stack-frames`
warning: `repro` (bin "repro" test) generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.00s
What is "this" function?
I expected to see this happen:
No diagnostic should be outputted.
Version
rustc 1.87.0 (17067e9ac 2025-05-09)
binary: rustc
commit-hash: 17067e9ac6d7ecb70e50f92c1944e545188d2359
commit-date: 2025-05-09
host: x86_64-unknown-linux-gnu
release: 1.87.0
LLVM version: 20.1.1
Additional Labels
No response
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have