Unimplement unsized_locals

This commit is contained in:
mejrs 2025-06-13 01:16:36 +02:00
parent 507183d438
commit 88d298317f
2 changed files with 5 additions and 11 deletions

View file

@ -1,8 +1,7 @@
//@ normalize-stderr-test: "\b10000(08|16|32)\b" -> "100$$PTR"
//@ normalize-stderr-test: "\b2500(060|120)\b" -> "250$$PTR"
#![allow(unused, incomplete_features)]
#![allow(unused)]
#![warn(clippy::large_stack_frames)]
#![feature(unsized_locals)]
use std::hint::black_box;
@ -11,11 +10,6 @@ fn generic<T: Default>() {
black_box(&x);
}
fn unsized_local() {
let x: dyn std::fmt::Display = *(Box::new(1) as Box<dyn std::fmt::Display>);
black_box(&x);
}
struct ArrayDefault<const N: usize>([u8; N]);
impl<const N: usize> Default for ArrayDefault<N> {

View file

@ -1,5 +1,5 @@
error: this function may allocate 250$PTR bytes on the stack
--> tests/ui/large_stack_frames.rs:27:4
--> tests/ui/large_stack_frames.rs:21:4
|
LL | fn many_small_arrays() {
| ^^^^^^^^^^^^^^^^^
@ -13,7 +13,7 @@ LL | let x5 = [0u8; 500_000];
= help: to override `-D warnings` add `#[allow(clippy::large_stack_frames)]`
error: this function may allocate 1000000 bytes on the stack
--> tests/ui/large_stack_frames.rs:38:4
--> tests/ui/large_stack_frames.rs:32:4
|
LL | fn large_return_value() -> ArrayDefault<1_000_000> {
| ^^^^^^^^^^^^^^^^^^ ----------------------- this is the largest part, at 1000000 bytes for type `ArrayDefault<1000000>`
@ -21,7 +21,7 @@ LL | fn large_return_value() -> ArrayDefault<1_000_000> {
= note: 1000000 bytes is larger than Clippy's configured `stack-size-threshold` of 512000
error: this function may allocate 100$PTR bytes on the stack
--> tests/ui/large_stack_frames.rs:44:4
--> tests/ui/large_stack_frames.rs:38:4
|
LL | fn large_fn_arg(x: ArrayDefault<1_000_000>) {
| ^^^^^^^^^^^^ - `x` is the largest part, at 1000000 bytes for type `ArrayDefault<1000000>`
@ -29,7 +29,7 @@ LL | fn large_fn_arg(x: ArrayDefault<1_000_000>) {
= note: 100$PTR bytes is larger than Clippy's configured `stack-size-threshold` of 512000
error: this function may allocate 100$PTR bytes on the stack
--> tests/ui/large_stack_frames.rs:51:13
--> tests/ui/large_stack_frames.rs:45:13
|
LL | let f = || black_box(&[0u8; 1_000_000]);
| ^^^^^^^^^^^^^^----------------^