]> git.proxmox.com Git - rustc.git/blob - tests/ui/const-generics/adt_const_params/const_param_ty_bad.rs
New upstream version 1.74.1+dfsg1
[rustc.git] / tests / ui / const-generics / adt_const_params / const_param_ty_bad.rs
1 #![allow(incomplete_features)]
2 #![feature(adt_const_params)]
3
4 fn check(_: impl std::marker::ConstParamTy) {}
5
6 fn main() {
7 check(main); //~ error: `fn() {main}` can't be used as a const parameter type
8 check(|| {}); //~ error: `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}` can't be used as a const parameter type
9 check(main as fn()); //~ error: `fn()` can't be used as a const parameter type
10 check(&mut ()); //~ error: `&mut ()` can't be used as a const parameter type
11 check(&mut () as *mut ()); //~ error: `*mut ()` can't be used as a const parameter type
12 check(&() as *const ()); //~ error: `*const ()` can't be used as a const parameter type
13 }