From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/const-generics/fn-const-param-infer.rs | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/ui/const-generics/fn-const-param-infer.rs (limited to 'tests/ui/const-generics/fn-const-param-infer.rs') diff --git a/tests/ui/const-generics/fn-const-param-infer.rs b/tests/ui/const-generics/fn-const-param-infer.rs new file mode 100644 index 000000000..22f5f529c --- /dev/null +++ b/tests/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