Skip to content

Commit 1a3a62c

Browse files
committed
Remove assert that checks type equality
1 parent c9228ae commit 1a3a62c

File tree

2 files changed

+49
-11
lines changed

2 files changed

+49
-11
lines changed

compiler/rustc_codegen_ssa/src/mir/locals.rs

+2-11
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,8 @@ impl<'tcx, V> Locals<'tcx, V> {
3636
impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
3737
pub(super) fn initialize_locals(&mut self, values: Vec<LocalRef<'tcx, Bx::Value>>) {
3838
assert!(self.locals.values.is_empty());
39-
40-
for (local, value) in values.into_iter().enumerate() {
41-
match value {
42-
LocalRef::Place(_) | LocalRef::UnsizedPlace(_) | LocalRef::PendingOperand => (),
43-
LocalRef::Operand(op) => {
44-
let local = mir::Local::from_usize(local);
45-
let expected_ty = self.monomorphize(self.mir.local_decls[local].ty);
46-
assert_eq!(expected_ty, op.layout.ty, "unexpected initial operand type");
47-
}
48-
}
49-
39+
// FIXME(#115215): After #115025 get's merged this might not be necessary
40+
for (_, value) in values.into_iter().enumerate() {
5041
self.locals.values.push(value);
5142
}
5243
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// run-pass
2+
// edition:2021
3+
use std::future::Future;
4+
use std::pin::Pin;
5+
6+
type BoxFuture<T> = Pin<Box<dyn Future<Output = T>>>;
7+
8+
fn main() {
9+
_ = wrapper_call(handler);
10+
}
11+
12+
async fn wrapper_call(handler: impl Handler) {
13+
handler.call().await;
14+
}
15+
async fn handler() {
16+
f(&()).await;
17+
}
18+
async fn f<'a>(db: impl Acquire<'a>) {
19+
db.acquire().await;
20+
}
21+
22+
trait Handler {
23+
type Future: Future;
24+
fn call(self) -> Self::Future;
25+
}
26+
27+
impl<Fut, F> Handler for F
28+
where
29+
F: Fn() -> Fut,
30+
Fut: Future,
31+
{
32+
type Future = Fut;
33+
fn call(self) -> Self::Future {
34+
loop {}
35+
}
36+
}
37+
38+
trait Acquire<'a> {
39+
type Connection;
40+
fn acquire(self) -> BoxFuture<Self::Connection>;
41+
}
42+
impl<'a> Acquire<'a> for &'a () {
43+
type Connection = Self;
44+
fn acquire(self) -> BoxFuture<Self> {
45+
loop {}
46+
}
47+
}

0 commit comments

Comments
 (0)