Rollup merge of #104019 - compiler-errors:print-generator-sizes, r=wesleywiser
Compute generator sizes with `-Zprint_type_sizes` Fixes #103887 r? `@pnkfelix`
This commit is contained in:
commit
0f5d3ba30f
10 changed files with 286 additions and 104 deletions
19
src/test/ui/print_type_sizes/async.rs
Normal file
19
src/test/ui/print_type_sizes/async.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// compile-flags: -Z print-type-sizes
|
||||
// edition:2021
|
||||
// build-pass
|
||||
// ignore-pass
|
||||
|
||||
#![feature(start)]
|
||||
|
||||
async fn wait() {}
|
||||
|
||||
async fn test(arg: [u8; 8192]) {
|
||||
wait().await;
|
||||
drop(arg);
|
||||
}
|
||||
|
||||
#[start]
|
||||
fn start(_: isize, _: *const *const u8) -> isize {
|
||||
let _ = test([0; 8192]);
|
||||
0
|
||||
}
|
||||
34
src/test/ui/print_type_sizes/async.stdout
Normal file
34
src/test/ui/print_type_sizes/async.stdout
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
print-type-size type: `[async fn body@$DIR/async.rs:10:32: 13:2]`: 16386 bytes, alignment: 1 bytes
|
||||
print-type-size discriminant: 1 bytes
|
||||
print-type-size variant `Suspend0`: 16385 bytes
|
||||
print-type-size field `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes
|
||||
print-type-size field `.arg`: 8192 bytes
|
||||
print-type-size field `.__awaitee`: 1 bytes
|
||||
print-type-size variant `Unresumed`: 8192 bytes
|
||||
print-type-size field `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes
|
||||
print-type-size variant `Returned`: 8192 bytes
|
||||
print-type-size field `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes
|
||||
print-type-size variant `Panicked`: 8192 bytes
|
||||
print-type-size field `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes
|
||||
print-type-size type: `std::mem::ManuallyDrop<[u8; 8192]>`: 8192 bytes, alignment: 1 bytes
|
||||
print-type-size field `.value`: 8192 bytes
|
||||
print-type-size type: `std::mem::MaybeUninit<[u8; 8192]>`: 8192 bytes, alignment: 1 bytes
|
||||
print-type-size variant `MaybeUninit`: 8192 bytes
|
||||
print-type-size field `.uninit`: 0 bytes
|
||||
print-type-size field `.value`: 8192 bytes
|
||||
print-type-size type: `[async fn body@$DIR/async.rs:8:17: 8:19]`: 1 bytes, alignment: 1 bytes
|
||||
print-type-size discriminant: 1 bytes
|
||||
print-type-size variant `Unresumed`: 0 bytes
|
||||
print-type-size variant `Returned`: 0 bytes
|
||||
print-type-size variant `Panicked`: 0 bytes
|
||||
print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/async.rs:8:17: 8:19]>`: 1 bytes, alignment: 1 bytes
|
||||
print-type-size field `.value`: 1 bytes
|
||||
print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/async.rs:8:17: 8:19]>`: 1 bytes, alignment: 1 bytes
|
||||
print-type-size variant `MaybeUninit`: 1 bytes
|
||||
print-type-size field `.uninit`: 0 bytes
|
||||
print-type-size field `.value`: 1 bytes
|
||||
print-type-size type: `std::task::Poll<()>`: 1 bytes, alignment: 1 bytes
|
||||
print-type-size discriminant: 1 bytes
|
||||
print-type-size variant `Ready`: 0 bytes
|
||||
print-type-size field `.0`: 0 bytes
|
||||
print-type-size variant `Pending`: 0 bytes
|
||||
20
src/test/ui/print_type_sizes/generator.rs
Normal file
20
src/test/ui/print_type_sizes/generator.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// compile-flags: -Z print-type-sizes
|
||||
// build-pass
|
||||
// ignore-pass
|
||||
|
||||
#![feature(start, generators, generator_trait)]
|
||||
|
||||
use std::ops::Generator;
|
||||
|
||||
fn generator<const C: usize>(array: [u8; C]) -> impl Generator<Yield = (), Return = ()> {
|
||||
move |()| {
|
||||
yield ();
|
||||
let _ = array;
|
||||
}
|
||||
}
|
||||
|
||||
#[start]
|
||||
fn start(_: isize, _: *const *const u8) -> isize {
|
||||
let _ = generator([0; 8192]);
|
||||
0
|
||||
}
|
||||
10
src/test/ui/print_type_sizes/generator.stdout
Normal file
10
src/test/ui/print_type_sizes/generator.stdout
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
print-type-size type: `[generator@$DIR/generator.rs:10:5: 10:14]`: 8193 bytes, alignment: 1 bytes
|
||||
print-type-size discriminant: 1 bytes
|
||||
print-type-size variant `Unresumed`: 8192 bytes
|
||||
print-type-size field `.array`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes
|
||||
print-type-size variant `Returned`: 8192 bytes
|
||||
print-type-size field `.array`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes
|
||||
print-type-size variant `Panicked`: 8192 bytes
|
||||
print-type-size field `.array`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes
|
||||
print-type-size variant `Suspend0`: 8192 bytes
|
||||
print-type-size field `.array`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes
|
||||
Loading…
Add table
Add a link
Reference in a new issue