Skip to content

Commit

Permalink
Test showing previous behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Aug 13, 2024
1 parent e08b80c commit 4b4cc9e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/mir-opt/build_correct_coerce.main.built.after.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// MIR for `main` after built

fn main() -> () {
let mut _0: ();
let _1: for<'a> fn(&'a (), &'a ());
scope 1 {
debug x => _1;
}

bb0: {
StorageLive(_1);
_1 = foo as for<'a, 'b> fn(&'a (), &'b ()) (PointerCoercion(ReifyFnPointer));
FakeRead(ForLet(None), _1);
_0 = const ();
StorageDead(_1);
return;
}
}
12 changes: 12 additions & 0 deletions tests/mir-opt/build_correct_coerce.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// skip-filecheck

// Validate that we record the type of the local for `x` as `for<'a> fn(&'a (), &'a ())`,
// and not `for<'a, 'b>(&'a (), &'b ())`. We previously did the latter due to a bug in
// the code that records adjustments in HIR typeck.

fn foo<'a, 'b>(_: &'a (), _: &'b ()) {}

// EMIT_MIR build_correct_coerce.main.built.after.mir
fn main() {
let x = foo as for<'a> fn(&'a (), &'a ());
}

0 comments on commit 4b4cc9e

Please sign in to comment.