Add test for issue-71382
This commit is contained in:
parent
88fe556db8
commit
99884bd879
2 changed files with 32 additions and 0 deletions
24
src/test/ui/const-generics/issues/issue-71382.rs
Normal file
24
src/test/ui/const-generics/issues/issue-71382.rs
Normal 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()
|
||||
}
|
||||
8
src/test/ui/const-generics/issues/issue-71382.stderr
Normal file
8
src/test/ui/const-generics/issues/issue-71382.stderr
Normal 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
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue