Skip to content

Commit 850bcbd

Browse files
Test showing previous behavior
1 parent e08b80c commit 850bcbd

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// MIR for `main` after built
2+
3+
fn main() -> () {
4+
let mut _0: ();
5+
let _1: for<'a> fn(&'a (), &'a ());
6+
scope 1 {
7+
debug x => _1;
8+
}
9+
10+
bb0: {
11+
StorageLive(_1);
12+
_1 = foo as for<'a, 'b> fn(&'a (), &'b ()) (PointerCoercion(ReifyFnPointer));
13+
FakeRead(ForLet(None), _1);
14+
_0 = const ();
15+
StorageDead(_1);
16+
return;
17+
}
18+
}

Diff for: tests/mir-opt/build_correct_coerce.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// skip-filecheck
2+
3+
// Validate that we record the target for the `as` coercion as `for<'a> fn(&'a (), &'a ())`,
4+
// and not `for<'a, 'b>(&'a (), &'b ())`. We previously did the latter due to a bug in
5+
// the code that records adjustments in HIR typeck.
6+
7+
fn foo<'a, 'b>(_: &'a (), _: &'b ()) {}
8+
9+
// EMIT_MIR build_correct_coerce.main.built.after.mir
10+
fn main() {
11+
let x = foo as for<'a> fn(&'a (), &'a ());
12+
}

0 commit comments

Comments
 (0)