Skip to content

Commit 3998ee9

Browse files
committed
Remove the interprter's check for project_downcast on unihabited variants
1 parent 21cce21 commit 3998ee9

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

compiler/rustc_const_eval/src/interpret/projection.rs

-5
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,6 @@ where
202202
// see https://github.com/rust-lang/rust/issues/93688#issuecomment-1032929496.)
203203
// So we just "offset" by 0.
204204
let layout = base.layout().for_variant(self, variant);
205-
if layout.abi.is_uninhabited() {
206-
// `read_discriminant` should have excluded uninhabited variants... but ConstProp calls
207-
// us on dead code.
208-
throw_inval!(ConstPropNonsense)
209-
}
210205
// This cannot be `transmute` as variants *can* have a smaller size than the entire enum.
211206
base.offset(Size::ZERO, layout, self)
212207
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#![feature(noop_waker)]
2+
use std::future::Future;
3+
4+
enum Runtime {}
5+
6+
async fn run(_: Runtime) {}
7+
8+
async fn apply_timeout() {
9+
let c = async {};
10+
match None::<Runtime> {
11+
None => {
12+
c.await;
13+
},
14+
Some(r) => {
15+
run(r).await;
16+
}
17+
}
18+
}
19+
20+
fn main() {
21+
let waker = std::task::Waker::noop();
22+
let mut ctx = std::task::Context::from_waker(&waker);
23+
let fut = std::pin::pin!(apply_timeout());
24+
let _ = fut.poll(&mut ctx);
25+
}

0 commit comments

Comments
 (0)