diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces-without-turbofish.rs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces-without-turbofish.rs b/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces-without-turbofish.rs new file mode 100644 index 000000000..fac3777cf --- /dev/null +++ b/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces-without-turbofish.rs @@ -0,0 +1,47 @@ +fn foo<const C: usize>() {} + +const BAR: usize = 42; + +fn a() { + foo<BAR + 3>(); //~ ERROR comparison operators cannot be chained +} +fn b() { + foo<BAR + BAR>(); //~ ERROR comparison operators cannot be chained +} +fn c() { + foo<3 + 3>(); //~ ERROR comparison operators cannot be chained +} +fn d() { + foo<BAR - 3>(); //~ ERROR comparison operators cannot be chained +} +fn e() { + foo<BAR - BAR>(); //~ ERROR comparison operators cannot be chained +} +fn f() { + foo<100 - BAR>(); //~ ERROR comparison operators cannot be chained +} +fn g() { + foo<bar<i32>()>(); //~ ERROR comparison operators cannot be chained + //~^ ERROR expected one of `;` or `}`, found `>` +} +fn h() { + foo<bar::<i32>()>(); //~ ERROR comparison operators cannot be chained +} +fn i() { + foo<bar::<i32>() + BAR>(); //~ ERROR comparison operators cannot be chained +} +fn j() { + foo<bar::<i32>() - BAR>(); //~ ERROR comparison operators cannot be chained +} +fn k() { + foo<BAR - bar::<i32>()>(); //~ ERROR comparison operators cannot be chained +} +fn l() { + foo<BAR - bar::<i32>()>(); //~ ERROR comparison operators cannot be chained +} + +const fn bar<const C: usize>() -> usize { + C +} + +fn main() {} |