From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/const-generics/fn-const-param-infer.rs | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/test/ui/const-generics/fn-const-param-infer.rs (limited to 'src/test/ui/const-generics/fn-const-param-infer.rs') diff --git a/src/test/ui/const-generics/fn-const-param-infer.rs b/src/test/ui/const-generics/fn-const-param-infer.rs new file mode 100644 index 000000000..22f5f529c --- /dev/null +++ b/src/test/ui/const-generics/fn-const-param-infer.rs @@ -0,0 +1,29 @@ +// revisions: full min + +#![cfg_attr(full, feature(adt_const_params))] +#![cfg_attr(full, allow(incomplete_features))] + +struct Checked bool>; +//~^ ERROR: using function pointers as const generic parameters + +fn not_one(val: usize) -> bool { val != 1 } +fn not_two(val: usize) -> bool { val != 2 } + +fn generic_arg(val: T) -> bool { true } + +fn generic(val: usize) -> bool { val != 1 } + +fn main() { + let _: Option> = None; + let _: Checked = Checked::; + let _: Checked = Checked::; + + let _ = Checked::; + let _ = Checked::<{generic_arg::}>; + let _ = Checked::<{generic_arg::}>; + + let _ = Checked::; + let _ = Checked::<{generic::}>; + let _: Checked<{generic::}> = Checked::<{generic::}>; + let _: Checked<{generic::}> = Checked::<{generic::}>; +} -- cgit v1.2.3