diff options
author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-02-01 05:54:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-01 05:54:40 +0100 |
commit | f41f154dfbe2aa943e35a21c0e2a8de002443424 (patch) | |
tree | d1d9ed4c985d189742536f71c18fe239180b32a8 /tests/rustdoc-js-std/parser-errors.js | |
parent | a37a59f45e40434cff2b5a23402b0bec42cce848 (diff) | |
parent | 362c4fa755a52891f79b00a0bac53b6a597f2b72 (diff) | |
download | rust-f41f154dfbe2aa943e35a21c0e2a8de002443424.tar.gz |
Rollup merge of #107533 - pnkfelix:distinguish-generator-state-in-print-type-sizes, r=compiler-errors
Extend `-Z print-type-sizes` to distinguish generator upvars+locals from "normal" fields.
For example, for this code:
```rust
async fn wait() {}
async fn test(arg: [u8; 8192]) {
wait().await;
drop(arg);
}
async fn test_ideal(_rg: [u8; 8192]) {
wait().await;
// drop(arg);
}
fn main() {
let gen_t = test([0; 8192]);
let gen_i = test_ideal([0; 8192]);
println!("expect {}, got: {}",
std::mem::size_of_val(&gen_i),
std::mem::size_of_val(&gen_t));
}
```
the `-Z print-type-sizes` output used to start with:
```
print-type-size type: `[async fn body@issue-62958-a.rs:3:32: 6: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 type: `std::mem::ManuallyDrop<[u8; 8192]>`: 8192 bytes, alignment: 1 bytes
print-type-size field `.value`: 8192 bytes
...
```
but with this change, it now instead prints:
```
print-type-size type: `[async fn body@issue-62958-a.rs:3:32: 6:2]`: 16386 bytes, alignment: 1 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Suspend0`: 16385 bytes
print-type-size upvar `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes
print-type-size local `.arg`: 8192 bytes
print-type-size local `.__awaitee`: 1 bytes
...
print-type-size type: `std::mem::ManuallyDrop<[u8; 8192]>`: 8192 bytes, alignment: 1 bytes
print-type-size field `.value`: 8192 bytes
```
(spawned off of investigation of https://github.com/rust-lang/rust/issues/62958 )
Diffstat (limited to 'tests/rustdoc-js-std/parser-errors.js')
0 files changed, 0 insertions, 0 deletions