Skip to content

Commit 99884bd

Browse files
committed
Add test for issue-71382
1 parent 88fe556 commit 99884bd

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#![feature(const_generics)]
2+
#![allow(incomplete_features)]
3+
4+
struct Test();
5+
6+
fn pass() {
7+
println!("Hello, world!");
8+
}
9+
10+
impl Test {
11+
pub fn call_me(&self) {
12+
self.test::<pass>();
13+
}
14+
15+
fn test<const FN: fn()>(&self) {
16+
//~^ ERROR: using function pointers as const generic parameters is forbidden
17+
FN();
18+
}
19+
}
20+
21+
fn main() {
22+
let x = Test();
23+
x.call_me()
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: using function pointers as const generic parameters is forbidden
2+
--> $DIR/issue-71382.rs:15:23
3+
|
4+
LL | fn test<const FN: fn()>(&self) {
5+
| ^^^^
6+
7+
error: aborting due to previous error
8+

0 commit comments

Comments
 (0)