Skip to content

Commit d08cc4d

Browse files
Add test
1 parent b5c6566 commit d08cc4d

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Minimized test for <https://github.com/rust-lang/rust/issues/123461>.
2+
3+
struct Unconstrained<T>(T);
4+
5+
fn main() {
6+
unsafe { std::mem::transmute::<_, ()>(|o_b: Unconstrained<_>| {}) };
7+
//~^ ERROR type annotations needed
8+
// We unfortunately don't check `Wf(Unconstrained<_>)`, so we won't
9+
// hit an ambiguity error before checking the transmute. That means
10+
// we still may have inference variables in our transmute src.
11+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0282]: type annotations needed
2+
--> $DIR/ambiguity-in-closure-arg.rs:6:44
3+
|
4+
LL | unsafe { std::mem::transmute::<_, ()>(|o_b: Unconstrained<_>| {}) };
5+
| ^^^^^^^^^^^^^^^^^^^^^ cannot infer type
6+
7+
error: aborting due to 1 previous error
8+
9+
For more information about this error, try `rustc --explain E0282`.

0 commit comments

Comments
 (0)