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 --- .../const-expression-suggest-missing-braces.rs | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tests/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.rs (limited to 'tests/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.rs') diff --git a/tests/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.rs b/tests/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.rs new file mode 100644 index 000000000..e12e07a28 --- /dev/null +++ b/tests/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.rs @@ -0,0 +1,51 @@ +fn foo() {} + +const BAR: usize = 42; + +fn a() { + foo::(); //~ ERROR expected one of +} +fn b() { + // FIXME(const_generics): these diagnostics are awful, because trait objects without `dyn` were + // a terrible mistake. + foo::(); + //~^ ERROR expected trait, found constant `BAR` + //~| ERROR expected trait, found constant `BAR` + //~| ERROR type provided when a constant was expected +} +fn c() { + foo::<3 + 3>(); //~ ERROR expressions must be enclosed in braces +} +fn d() { + foo::(); //~ ERROR expected one of +} +fn e() { + foo::(); //~ ERROR expected one of +} +fn f() { + foo::<100 - BAR>(); //~ ERROR expressions must be enclosed in braces +} +fn g() { + foo::()>(); //~ ERROR expected one of +} +fn h() { + foo::()>(); //~ ERROR expected one of +} +fn i() { + foo::() + BAR>(); //~ ERROR expected one of +} +fn j() { + foo::() - BAR>(); //~ ERROR expected one of +} +fn k() { + foo::()>(); //~ ERROR expected one of +} +fn l() { + foo::()>(); //~ ERROR expected one of +} + +const fn bar() -> usize { + C +} + +fn main() {} -- cgit v1.2.3