Skip to content

Commit 31ee840

Browse files
committed
Add ui test func-pointer-issue-140491
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
1 parent 105354d commit 31ee840

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
fn my_fn(event: &Event<'_>) {}
2+
3+
struct Event<'a>(&'a ());
4+
5+
fn main() {
6+
const ptr: &fn(&Event<'_>) = &my_fn as _; //~ ERROR non-primitive cast: `&for<'a, 'b> fn(&'a Event<'b>) {my_fn}` as `&for<'a, 'b> fn(&'a Event<'b>)` [E0605]
7+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0605]: non-primitive cast: `&for<'a, 'b> fn(&'a Event<'b>) {my_fn}` as `&for<'a, 'b> fn(&'a Event<'b>)`
2+
--> $DIR/func-pointer-issue-140491.rs:6:34
3+
|
4+
LL | ..._>) = &my_fn as _;
5+
| ^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
6+
7+
error: aborting due to 1 previous error
8+
9+
For more information about this error, try `rustc --explain E0605`.

0 commit comments

Comments
 (0)