Add test for issue-71382

This commit is contained in:
Yuki Okushi 2020-06-27 20:34:04 +09:00
parent 88fe556db8
commit 99884bd879
No known key found for this signature in database
GPG key ID: B0986C85C0E2DAA1
2 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,24 @@
#![feature(const_generics)]
#![allow(incomplete_features)]
struct Test();
fn pass() {
println!("Hello, world!");
}
impl Test {
pub fn call_me(&self) {
self.test::<pass>();
}
fn test<const FN: fn()>(&self) {
//~^ ERROR: using function pointers as const generic parameters is forbidden
FN();
}
}
fn main() {
let x = Test();
x.call_me()
}

View file

@ -0,0 +1,8 @@
error: using function pointers as const generic parameters is forbidden
--> $DIR/issue-71382.rs:15:23
|
LL | fn test<const FN: fn()>(&self) {
| ^^^^
error: aborting due to previous error