Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9678cec
std: rewrite SGX thread parker
joboet Jun 22, 2022
633d46d
std: reimplement SGX thread joining to use `Parker`
joboet Jun 22, 2022
a40d300
std: clarify semantics of SGX parker
joboet Sep 5, 2022
ac67262
Set `download-ci-llvm = "if-available"` by default when `channel = "d…
jyn514 Nov 17, 2022
7700595
Implement masking in FileType comparison on Unix
krtab Nov 25, 2022
6259028
Add test for regression for FileType equality
krtab Nov 30, 2022
4198d29
Implement masking in FileType hashing on Unix
krtab Dec 6, 2022
b45b948
Compute generator sizes with -Zprint_type_sizes
compiler-errors Nov 5, 2022
b0dcadf
Move closure/generator type info methods to TyCtxt
compiler-errors Dec 7, 2022
57b7226
Properly print generator interior type sizes
compiler-errors Dec 7, 2022
7d23e29
Pull out logic into distinct functions
compiler-errors Dec 7, 2022
ecf8127
Fix Async Generator ABI
Swatinem Nov 29, 2022
65698ae
Add LLVM KCFI support to the Rust compiler
rcvalle Nov 22, 2022
e1741ba
Add documentation for LLVM KCFI support
rcvalle Dec 1, 2022
24cd863
Replace hand-made masking by call to masked() method in FileType
krtab Dec 9, 2022
84a4635
Don't warn about unused parens when they are used by yeet expr
WaffleLapkin Dec 9, 2022
b9da55a
Introduce `Span::is_visible`
estebank Dec 9, 2022
ac90c9b
Update cargo
weihanglo Dec 10, 2022
f069e71
Correct wrong note for short circuiting operators
est31 Dec 10, 2022
ae8794c
Rollup merge of #98391 - joboet:sgx_parker, r=m-ou-se
matthiaskrgr Dec 10, 2022
0f5d3ba
Rollup merge of #104019 - compiler-errors:print-generator-sizes, r=we…
matthiaskrgr Dec 10, 2022
1ce18d2
Rollup merge of #104512 - jyn514:download-ci-llvm-default, r=Mark-Sim…
matthiaskrgr Dec 10, 2022
eb1159c
Rollup merge of #104901 - krtab:filetype_compare, r=the8472
matthiaskrgr Dec 10, 2022
020d7af
Rollup merge of #105082 - Swatinem:async-abi, r=compiler-errors
matthiaskrgr Dec 10, 2022
947fe7e
Rollup merge of #105109 - rcvalle:rust-kcfi, r=bjorn3
matthiaskrgr Dec 10, 2022
9e87dd9
Rollup merge of #105505 - WaffleLapkin:yeet_unused_parens_lint, r=fee…
matthiaskrgr Dec 10, 2022
cf84006
Rollup merge of #105514 - estebank:is_visible, r=oli-obk
matthiaskrgr Dec 10, 2022
6d7e3df
Rollup merge of #105516 - weihanglo:update-cargo, r=weihanglo
matthiaskrgr Dec 10, 2022
f6c2add
Rollup merge of #105522 - est31:remove_or_and_note, r=scottmcm
matthiaskrgr Dec 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Compute generator sizes with -Zprint_type_sizes
  • Loading branch information
compiler-errors committed Dec 7, 2022
commit b45b9489bb3fb918fbe267154f8dcf4fee61854d
3 changes: 2 additions & 1 deletion compiler/rustc_session/src/code_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub enum DataTypeKind {
Union,
Enum,
Closure,
Generator,
}

#[derive(PartialEq, Eq, Hash, Debug)]
Expand Down Expand Up @@ -113,7 +114,7 @@ impl CodeStats {
let mut max_variant_size = discr_size;

let struct_like = match kind {
DataTypeKind::Struct | DataTypeKind::Closure => true,
DataTypeKind::Struct | DataTypeKind::Closure | DataTypeKind::Generator => true,
DataTypeKind::Enum | DataTypeKind::Union => false,
};
for (i, variant_info) in variants.into_iter().enumerate() {
Expand Down
6 changes: 6 additions & 0 deletions compiler/rustc_ty_utils/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,12 @@ fn record_layout_for_printing_outlined<'tcx>(
return;
}

ty::Generator(..) => {
debug!("print-type-size t: `{:?}` record generator", layout.ty);
record(DataTypeKind::Generator, false, None, vec![]);
return;
}

_ => {
debug!("print-type-size t: `{:?}` skip non-nominal", layout.ty);
return;
Expand Down
19 changes: 19 additions & 0 deletions src/test/ui/print_type_sizes/async.rs
Original file line number Diff line number Diff line change
@@ -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
}
25 changes: 25 additions & 0 deletions src/test/ui/print_type_sizes/async.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
print-type-size type: `[static generator@$DIR/async.rs:10:32: 13:2]`: 16386 bytes, alignment: 1 bytes
print-type-size end padding: 16386 bytes
print-type-size type: `std::future::from_generator::GenFuture<[static generator@$DIR/async.rs:10:32: 13:2]>`: 16386 bytes, alignment: 1 bytes
print-type-size field `.0`: 16386 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: `[static generator@$DIR/async.rs:8:17: 8:19]`: 1 bytes, alignment: 1 bytes
print-type-size end padding: 1 bytes
print-type-size type: `std::future::from_generator::GenFuture<[static generator@$DIR/async.rs:8:17: 8:19]>`: 1 bytes, alignment: 1 bytes
print-type-size field `.0`: 1 bytes
print-type-size type: `std::mem::ManuallyDrop<std::future::from_generator::GenFuture<[static generator@$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<std::future::from_generator::GenFuture<[static generator@$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 changes: 20 additions & 0 deletions src/test/ui/print_type_sizes/generator.rs
Original file line number Diff line number Diff line change
@@ -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
}
2 changes: 2 additions & 0 deletions src/test/ui/print_type_sizes/generator.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
print-type-size type: `[generator@$DIR/generator.rs:10:5: 10:14]`: 8193 bytes, alignment: 1 bytes
print-type-size end padding: 8193 bytes