-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #105623 - compiler-errors:generator-type-size-fix, r=…
…Nilstrieb Fix `-Z print-type-sizes` for generators with discriminant field ordered first Fixes #105589 Fixes #105591
- Loading branch information
Showing
17 changed files
with
89 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,11 @@ | ||
// compile-flags: -Z print-type-sizes | ||
// compile-flags: -Z print-type-sizes --crate-type lib | ||
// edition:2021 | ||
// build-pass | ||
// ignore-pass | ||
|
||
#![feature(start)] | ||
|
||
async fn wait() {} | ||
|
||
async fn test(arg: [u8; 8192]) { | ||
pub async fn test(arg: [u8; 8192]) { | ||
wait().await; | ||
drop(arg); | ||
} | ||
|
||
#[start] | ||
fn start(_: isize, _: *const *const u8) -> isize { | ||
let _ = test([0; 8192]); | ||
0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// compile-flags: -Z print-type-sizes --crate-type lib | ||
// build-pass | ||
// ignore-pass | ||
|
||
// Tests a generator that has its discriminant as the *final* field. | ||
|
||
// Avoid emitting panic handlers, like the rest of these tests... | ||
#![feature(generators)] | ||
|
||
pub fn foo() { | ||
let a = || { | ||
{ | ||
let w: i32 = 4; | ||
yield; | ||
drop(w); | ||
} | ||
{ | ||
let z: i32 = 7; | ||
yield; | ||
drop(z); | ||
} | ||
}; | ||
} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/print_type_sizes/generator_discr_placement.stdout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
print-type-size type: `[generator@$DIR/generator_discr_placement.rs:11:13: 11:15]`: 8 bytes, alignment: 4 bytes | ||
print-type-size discriminant: 1 bytes | ||
print-type-size variant `Suspend0`: 7 bytes | ||
print-type-size padding: 3 bytes | ||
print-type-size field `.w`: 4 bytes, alignment: 4 bytes | ||
print-type-size variant `Suspend1`: 7 bytes | ||
print-type-size padding: 3 bytes | ||
print-type-size field `.z`: 4 bytes, alignment: 4 bytes | ||
print-type-size variant `Unresumed`: 0 bytes | ||
print-type-size variant `Returned`: 0 bytes | ||
print-type-size variant `Panicked`: 0 bytes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,13 @@ | ||
// compile-flags: -Z print-type-sizes | ||
// compile-flags: -Z print-type-sizes --crate-type=lib | ||
// build-pass | ||
|
||
// This file illustrates that when multiple structural types occur in | ||
// a function, every one of them is included in the output. | ||
|
||
#![feature(start)] | ||
|
||
pub struct SevenBytes([u8; 7]); | ||
pub struct FiftyBytes([u8; 50]); | ||
|
||
pub enum Enum { | ||
Small(SevenBytes), | ||
Large(FiftyBytes), | ||
} | ||
|
||
#[start] | ||
fn start(_: isize, _: *const *const u8) -> isize { | ||
let _e: Enum; | ||
let _f: FiftyBytes; | ||
let _s: SevenBytes; | ||
0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.