Skip to content

Commit 252a6dd

Browse files
authored
Rollup merge of rust-lang#141811 - mejrs:bye_locals, r=compiler-errors
Unimplement unsized_locals Implements rust-lang/compiler-team#630 Tracking issue here: rust-lang#111942 Note that this just removes the feature, not the implementation, and does not touch `unsized_fn_params`. This is because it is required to support `Box<dyn FnOnce()>: FnOnce()`. There may be more that should be removed (possibly in follow up prs) - the `forget_unsized` function and `forget` intrinsic. - the `unsized_locals` test directory; I've just fixed up the tests for now - various codegen support for unsized values and allocas cc ``@JakobDegen`` ``@oli-obk`` ``@Noratrieb`` ``@programmerjake`` ``@bjorn3`` ``@rustbot`` label F-unsized_locals Fixes rust-lang#79409
2 parents 81f9f08 + 88d2983 commit 252a6dd

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

tests/ui/large_stack_frames.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
//@ normalize-stderr-test: "\b10000(08|16|32)\b" -> "100$$PTR"
22
//@ normalize-stderr-test: "\b2500(060|120)\b" -> "250$$PTR"
3-
#![allow(unused, incomplete_features)]
3+
#![allow(unused)]
44
#![warn(clippy::large_stack_frames)]
5-
#![feature(unsized_locals)]
65

76
use std::hint::black_box;
87

@@ -11,11 +10,6 @@ fn generic<T: Default>() {
1110
black_box(&x);
1211
}
1312

14-
fn unsized_local() {
15-
let x: dyn std::fmt::Display = *(Box::new(1) as Box<dyn std::fmt::Display>);
16-
black_box(&x);
17-
}
18-
1913
struct ArrayDefault<const N: usize>([u8; N]);
2014

2115
impl<const N: usize> Default for ArrayDefault<N> {

tests/ui/large_stack_frames.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: this function may allocate 250$PTR bytes on the stack
2-
--> tests/ui/large_stack_frames.rs:27:4
2+
--> tests/ui/large_stack_frames.rs:21:4
33
|
44
LL | fn many_small_arrays() {
55
| ^^^^^^^^^^^^^^^^^
@@ -13,23 +13,23 @@ LL | let x5 = [0u8; 500_000];
1313
= help: to override `-D warnings` add `#[allow(clippy::large_stack_frames)]`
1414

1515
error: this function may allocate 1000000 bytes on the stack
16-
--> tests/ui/large_stack_frames.rs:38:4
16+
--> tests/ui/large_stack_frames.rs:32:4
1717
|
1818
LL | fn large_return_value() -> ArrayDefault<1_000_000> {
1919
| ^^^^^^^^^^^^^^^^^^ ----------------------- this is the largest part, at 1000000 bytes for type `ArrayDefault<1000000>`
2020
|
2121
= note: 1000000 bytes is larger than Clippy's configured `stack-size-threshold` of 512000
2222

2323
error: this function may allocate 100$PTR bytes on the stack
24-
--> tests/ui/large_stack_frames.rs:44:4
24+
--> tests/ui/large_stack_frames.rs:38:4
2525
|
2626
LL | fn large_fn_arg(x: ArrayDefault<1_000_000>) {
2727
| ^^^^^^^^^^^^ - `x` is the largest part, at 1000000 bytes for type `ArrayDefault<1000000>`
2828
|
2929
= note: 100$PTR bytes is larger than Clippy's configured `stack-size-threshold` of 512000
3030

3131
error: this function may allocate 100$PTR bytes on the stack
32-
--> tests/ui/large_stack_frames.rs:51:13
32+
--> tests/ui/large_stack_frames.rs:45:13
3333
|
3434
LL | let f = || black_box(&[0u8; 1_000_000]);
3535
| ^^^^^^^^^^^^^^----------------^

0 commit comments

Comments
 (0)