Skip to content

Commit 8359f60

Browse files
committed
Perform KnownPanicsLint inside coroutines.
1 parent 83a31ce commit 8359f60

File tree

5 files changed

+29
-7
lines changed

5 files changed

+29
-7
lines changed

compiler/rustc_mir_transform/src/known_panics_lint.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,6 @@ impl<'tcx> crate::MirLint<'tcx> for KnownPanicsLint {
4444
return;
4545
}
4646

47-
// FIXME(welseywiser) const prop doesn't work on coroutines because of query cycles
48-
// computing their layout.
49-
if tcx.is_coroutine(def_id.to_def_id()) {
50-
trace!("KnownPanicsLint skipped for coroutine {:?}", def_id);
51-
return;
52-
}
53-
5447
trace!("KnownPanicsLint starting for {:?}", def_id);
5548

5649
let mut linter = ConstPropagator::new(body, tcx);

tests/ui/async-await/future-sizes/async-awaiting-fut.stdout

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ print-type-size variant `Returned`: 1024 bytes
4848
print-type-size upvar `.arg`: 1024 bytes
4949
print-type-size variant `Panicked`: 1024 bytes
5050
print-type-size upvar `.arg`: 1024 bytes
51+
print-type-size type: `std::pin::Pin<&mut {async fn body of big_fut()}>`: 8 bytes, alignment: 8 bytes
52+
print-type-size field `.pointer`: 8 bytes
53+
print-type-size type: `std::pin::Pin<&mut {async fn body of calls_fut<{async fn body of big_fut()}>()}>`: 8 bytes, alignment: 8 bytes
54+
print-type-size field `.pointer`: 8 bytes
55+
print-type-size type: `std::pin::Pin<&mut {async fn body of test()}>`: 8 bytes, alignment: 8 bytes
56+
print-type-size field `.pointer`: 8 bytes
57+
print-type-size type: `std::pin::Pin<&mut {async fn body of wait()}>`: 8 bytes, alignment: 8 bytes
58+
print-type-size field `.pointer`: 8 bytes
5159
print-type-size type: `std::mem::ManuallyDrop<bool>`: 1 bytes, alignment: 1 bytes
5260
print-type-size field `.value`: 1 bytes
5361
print-type-size type: `std::mem::ManuallyDrop<{async fn body of wait()}>`: 1 bytes, alignment: 1 bytes

tests/ui/async-await/future-sizes/large-arg.stdout

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,12 @@ print-type-size variant `Returned`: 1024 bytes
5858
print-type-size upvar `.t`: 1024 bytes
5959
print-type-size variant `Panicked`: 1024 bytes
6060
print-type-size upvar `.t`: 1024 bytes
61+
print-type-size type: `std::pin::Pin<&mut {async fn body of a<[u8; 1024]>()}>`: 8 bytes, alignment: 8 bytes
62+
print-type-size field `.pointer`: 8 bytes
63+
print-type-size type: `std::pin::Pin<&mut {async fn body of test()}>`: 8 bytes, alignment: 8 bytes
64+
print-type-size field `.pointer`: 8 bytes
65+
print-type-size type: `std::task::Poll<()>`: 1 bytes, alignment: 1 bytes
66+
print-type-size discriminant: 1 bytes
67+
print-type-size variant `Ready`: 0 bytes
68+
print-type-size field `.0`: 0 bytes
69+
print-type-size variant `Pending`: 0 bytes

tests/ui/print_type_sizes/async.stdout

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ print-type-size type: `std::mem::MaybeUninit<[u8; 8192]>`: 8192 bytes, alignment
1616
print-type-size variant `MaybeUninit`: 8192 bytes
1717
print-type-size field `.uninit`: 0 bytes
1818
print-type-size field `.value`: 8192 bytes
19+
print-type-size type: `std::pin::Pin<&mut {async fn body of test()}>`: 8 bytes, alignment: 8 bytes
20+
print-type-size field `.pointer`: 8 bytes
21+
print-type-size type: `std::pin::Pin<&mut {async fn body of wait()}>`: 8 bytes, alignment: 8 bytes
22+
print-type-size field `.pointer`: 8 bytes
1923
print-type-size type: `std::mem::ManuallyDrop<{async fn body of wait()}>`: 1 bytes, alignment: 1 bytes
2024
print-type-size field `.value`: 1 bytes
2125
print-type-size type: `std::mem::MaybeUninit<{async fn body of wait()}>`: 1 bytes, alignment: 1 bytes

tests/ui/print_type_sizes/coroutine_discr_placement.stdout

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
print-type-size type: `std::pin::Pin<&mut {coroutine@$DIR/coroutine_discr_placement.rs:13:5: 13:7}>`: 8 bytes, alignment: 8 bytes
2+
print-type-size field `.pointer`: 8 bytes
13
print-type-size type: `{coroutine@$DIR/coroutine_discr_placement.rs:13:5: 13:7}`: 8 bytes, alignment: 4 bytes
24
print-type-size discriminant: 1 bytes
35
print-type-size variant `Unresumed`: 0 bytes
@@ -15,3 +17,9 @@ print-type-size type: `std::mem::MaybeUninit<i32>`: 4 bytes, alignment: 4 bytes
1517
print-type-size variant `MaybeUninit`: 4 bytes
1618
print-type-size field `.uninit`: 0 bytes
1719
print-type-size field `.value`: 4 bytes
20+
print-type-size type: `std::ops::CoroutineState<(), ()>`: 1 bytes, alignment: 1 bytes
21+
print-type-size discriminant: 1 bytes
22+
print-type-size variant `Yielded`: 0 bytes
23+
print-type-size field `.0`: 0 bytes
24+
print-type-size variant `Complete`: 0 bytes
25+
print-type-size field `.0`: 0 bytes

0 commit comments

Comments
 (0)