-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Suggest that expressions that look like const generic arguments should be enclosed in brackets #77502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bors
merged 1 commit into
rust-lang:master
from
varkor:const-generics-suggest-enclosing-braces
Oct 27, 2020
+782
−35
Merged
Suggest that expressions that look like const generic arguments should be enclosed in brackets #77502
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
error: expressions must be enclosed in braces to be used as const generic arguments | ||
--> $DIR/closing-args-token.rs:11:9 | ||
| | ||
LL | S::<5 + 2 >> 7>; | ||
| ^^^^^ | ||
| | ||
help: enclose the `const` expression in braces | ||
| | ||
LL | S::<{ 5 + 2 } >> 7>; | ||
| ^ ^ | ||
|
||
error: comparison operators cannot be chained | ||
--> $DIR/closing-args-token.rs:11:16 | ||
| | ||
LL | S::<5 + 2 >> 7>; | ||
| ^ ^ | ||
| | ||
help: split the comparison into two | ||
| | ||
LL | S::<5 + 2 >> 7 && 7>; | ||
| ^^^^ | ||
|
||
error: comparison operators cannot be chained | ||
--> $DIR/closing-args-token.rs:17:20 | ||
| | ||
LL | S::<{ 5 + 2 } >> 7>; | ||
| ^ ^ | ||
| | ||
help: split the comparison into two | ||
| | ||
LL | S::<{ 5 + 2 } >> 7 && 7>; | ||
| ^^^^ | ||
|
||
error: expected expression, found `;` | ||
--> $DIR/closing-args-token.rs:22:16 | ||
| | ||
LL | T::<0 >= 3>; | ||
| ^ expected expression | ||
|
||
error: comparison operators cannot be chained | ||
--> $DIR/closing-args-token.rs:28:12 | ||
| | ||
LL | T::<x >>= 2 > 0>; | ||
| ^^ ^ | ||
| | ||
help: split the comparison into two | ||
| | ||
LL | T::<x >>= 2 && 2 > 0>; | ||
| ^^^^ | ||
|
||
error: aborting due to 5 previous errors | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
error: expressions must be enclosed in braces to be used as const generic arguments | ||
--> $DIR/closing-args-token.rs:11:9 | ||
| | ||
LL | S::<5 + 2 >> 7>; | ||
| ^^^^^ | ||
| | ||
help: enclose the `const` expression in braces | ||
| | ||
LL | S::<{ 5 + 2 } >> 7>; | ||
| ^ ^ | ||
|
||
error: comparison operators cannot be chained | ||
--> $DIR/closing-args-token.rs:11:16 | ||
| | ||
LL | S::<5 + 2 >> 7>; | ||
| ^ ^ | ||
| | ||
help: split the comparison into two | ||
| | ||
LL | S::<5 + 2 >> 7 && 7>; | ||
| ^^^^ | ||
|
||
error: comparison operators cannot be chained | ||
--> $DIR/closing-args-token.rs:17:20 | ||
| | ||
LL | S::<{ 5 + 2 } >> 7>; | ||
| ^ ^ | ||
| | ||
help: split the comparison into two | ||
| | ||
LL | S::<{ 5 + 2 } >> 7 && 7>; | ||
| ^^^^ | ||
|
||
error: expected expression, found `;` | ||
--> $DIR/closing-args-token.rs:22:16 | ||
| | ||
LL | T::<0 >= 3>; | ||
| ^ expected expression | ||
|
||
error: comparison operators cannot be chained | ||
--> $DIR/closing-args-token.rs:28:12 | ||
| | ||
LL | T::<x >>= 2 > 0>; | ||
| ^^ ^ | ||
| | ||
help: split the comparison into two | ||
| | ||
LL | T::<x >>= 2 && 2 > 0>; | ||
| ^^^^ | ||
|
||
error: aborting due to 5 previous errors | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// revisions: full min | ||
|
||
#![cfg_attr(full, feature(const_generics))] | ||
#![cfg_attr(full, allow(incomplete_features))] | ||
#![cfg_attr(min, feature(min_const_generics))] | ||
|
||
struct S<const X: u32>; | ||
struct T<const X: bool>; | ||
|
||
fn bad_args_1() { | ||
S::<5 + 2 >> 7>; | ||
//~^ ERROR expressions must be enclosed in braces to be used as const generic arguments | ||
//~| ERROR comparison operators cannot be chained | ||
} | ||
|
||
fn bad_args_2() { | ||
S::<{ 5 + 2 } >> 7>; | ||
//~^ ERROR comparison operators cannot be chained | ||
} | ||
|
||
fn bad_args_3() { | ||
T::<0 >= 3>; | ||
//~^ ERROR expected expression, found `;` | ||
} | ||
|
||
fn bad_args_4() { | ||
let mut x = 0; | ||
T::<x >>= 2 > 0>; | ||
//~^ ERROR comparison operators cannot be chained | ||
} | ||
|
||
fn main() {} |
11 changes: 8 additions & 3 deletions
11
src/test/ui/const-generics/const-expression-parameter.full.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
error: expected one of `,` or `>`, found `+` | ||
--> $DIR/const-expression-parameter.rs:16:22 | ||
error: expressions must be enclosed in braces to be used as const generic arguments | ||
--> $DIR/const-expression-parameter.rs:16:20 | ||
| | ||
LL | i32_identity::<1 + 2>(); | ||
| ^ expected one of `,` or `>` | ||
| ^^^^^ | ||
| | ||
help: enclose the `const` expression in braces | ||
| | ||
LL | i32_identity::<{ 1 + 2 }>(); | ||
| ^ ^ | ||
|
||
error: aborting due to previous error | ||
|
11 changes: 8 additions & 3 deletions
11
src/test/ui/const-generics/const-expression-parameter.min.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
error: expected one of `,` or `>`, found `+` | ||
--> $DIR/const-expression-parameter.rs:16:22 | ||
error: expressions must be enclosed in braces to be used as const generic arguments | ||
--> $DIR/const-expression-parameter.rs:16:20 | ||
| | ||
LL | i32_identity::<1 + 2>(); | ||
| ^ expected one of `,` or `>` | ||
| ^^^^^ | ||
| | ||
help: enclose the `const` expression in braces | ||
| | ||
LL | i32_identity::<{ 1 + 2 }>(); | ||
| ^ ^ | ||
|
||
error: aborting due to previous error | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...-generics/min_const_generics/const-expression-suggest-missing-braces-without-turbofish.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#![feature(min_const_generics)] | ||
|
||
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 | ||
varkor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
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() {} |
140 changes: 140 additions & 0 deletions
140
...erics/min_const_generics/const-expression-suggest-missing-braces-without-turbofish.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
error: comparison operators cannot be chained | ||
--> $DIR/const-expression-suggest-missing-braces-without-turbofish.rs:8:8 | ||
| | ||
LL | foo<BAR + 3>(); | ||
| ^ ^ | ||
| | ||
help: use `::<...>` instead of `<...>` to specify type arguments | ||
| | ||
LL | foo::<BAR + 3>(); | ||
| ^^ | ||
|
||
error: comparison operators cannot be chained | ||
--> $DIR/const-expression-suggest-missing-braces-without-turbofish.rs:11:8 | ||
| | ||
LL | foo<BAR + BAR>(); | ||
| ^ ^ | ||
| | ||
help: use `::<...>` instead of `<...>` to specify type arguments | ||
| | ||
LL | foo::<BAR + BAR>(); | ||
| ^^ | ||
|
||
error: comparison operators cannot be chained | ||
--> $DIR/const-expression-suggest-missing-braces-without-turbofish.rs:14:8 | ||
| | ||
LL | foo<3 + 3>(); | ||
| ^ ^ | ||
| | ||
help: use `::<...>` instead of `<...>` to specify type arguments | ||
| | ||
LL | foo::<3 + 3>(); | ||
| ^^ | ||
|
||
error: comparison operators cannot be chained | ||
--> $DIR/const-expression-suggest-missing-braces-without-turbofish.rs:17:8 | ||
| | ||
LL | foo<BAR - 3>(); | ||
| ^ ^ | ||
| | ||
help: use `::<...>` instead of `<...>` to specify type arguments | ||
| | ||
LL | foo::<BAR - 3>(); | ||
| ^^ | ||
|
||
error: comparison operators cannot be chained | ||
--> $DIR/const-expression-suggest-missing-braces-without-turbofish.rs:20:8 | ||
| | ||
LL | foo<BAR - BAR>(); | ||
| ^ ^ | ||
| | ||
help: use `::<...>` instead of `<...>` to specify type arguments | ||
| | ||
LL | foo::<BAR - BAR>(); | ||
| ^^ | ||
|
||
error: comparison operators cannot be chained | ||
--> $DIR/const-expression-suggest-missing-braces-without-turbofish.rs:23:8 | ||
| | ||
LL | foo<100 - BAR>(); | ||
| ^ ^ | ||
| | ||
help: use `::<...>` instead of `<...>` to specify type arguments | ||
| | ||
LL | foo::<100 - BAR>(); | ||
| ^^ | ||
|
||
error: comparison operators cannot be chained | ||
--> $DIR/const-expression-suggest-missing-braces-without-turbofish.rs:26:8 | ||
| | ||
LL | foo<bar<i32>()>(); | ||
| ^ ^ | ||
| | ||
help: use `::<...>` instead of `<...>` to specify type arguments | ||
| | ||
LL | foo::<bar<i32>()>(); | ||
| ^^ | ||
|
||
error: expected one of `;` or `}`, found `>` | ||
--> $DIR/const-expression-suggest-missing-braces-without-turbofish.rs:26:19 | ||
| | ||
LL | foo<bar<i32>()>(); | ||
| ^ expected one of `;` or `}` | ||
|
||
error: comparison operators cannot be chained | ||
--> $DIR/const-expression-suggest-missing-braces-without-turbofish.rs:30:8 | ||
| | ||
LL | foo<bar::<i32>()>(); | ||
| ^ ^ | ||
| | ||
help: use `::<...>` instead of `<...>` to specify type arguments | ||
| | ||
LL | foo::<bar::<i32>()>(); | ||
| ^^ | ||
|
||
error: comparison operators cannot be chained | ||
--> $DIR/const-expression-suggest-missing-braces-without-turbofish.rs:33:8 | ||
| | ||
LL | foo<bar::<i32>() + BAR>(); | ||
| ^ ^ | ||
| | ||
help: use `::<...>` instead of `<...>` to specify type arguments | ||
| | ||
LL | foo::<bar::<i32>() + BAR>(); | ||
| ^^ | ||
|
||
error: comparison operators cannot be chained | ||
--> $DIR/const-expression-suggest-missing-braces-without-turbofish.rs:36:8 | ||
| | ||
LL | foo<bar::<i32>() - BAR>(); | ||
| ^ ^ | ||
| | ||
help: use `::<...>` instead of `<...>` to specify type arguments | ||
| | ||
LL | foo::<bar::<i32>() - BAR>(); | ||
| ^^ | ||
|
||
error: comparison operators cannot be chained | ||
--> $DIR/const-expression-suggest-missing-braces-without-turbofish.rs:39:8 | ||
| | ||
LL | foo<BAR - bar::<i32>()>(); | ||
| ^ ^ | ||
| | ||
help: use `::<...>` instead of `<...>` to specify type arguments | ||
| | ||
LL | foo::<BAR - bar::<i32>()>(); | ||
| ^^ | ||
|
||
error: comparison operators cannot be chained | ||
--> $DIR/const-expression-suggest-missing-braces-without-turbofish.rs:42:8 | ||
| | ||
LL | foo<BAR - bar::<i32>()>(); | ||
| ^ ^ | ||
| | ||
help: use `::<...>` instead of `<...>` to specify type arguments | ||
| | ||
LL | foo::<BAR - bar::<i32>()>(); | ||
| ^^ | ||
|
||
error: aborting due to 13 previous errors | ||
|
55 changes: 55 additions & 0 deletions
55
src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#![feature(min_const_generics)] | ||
estebank marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
fn foo<const C: usize>() {} | ||
|
||
const BAR: usize = 42; | ||
|
||
fn a() { | ||
foo::<BAR + 3>(); //~ ERROR expected one of | ||
} | ||
fn b() { | ||
// FIXME(const_generics): these diagnostics are awful, because trait objects without `dyn` were | ||
// a terrible mistake. | ||
foo::<BAR + BAR>(); | ||
//~^ ERROR expected trait, found constant `BAR` | ||
//~| ERROR expected trait, found constant `BAR` | ||
//~| ERROR wrong number of const arguments: expected 1, found 0 | ||
//~| ERROR wrong number of type arguments: expected 0, found 1 | ||
//~| WARN trait objects without an explicit `dyn` are deprecated | ||
varkor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
fn c() { | ||
foo::<3 + 3>(); //~ ERROR expressions must be enclosed in braces | ||
} | ||
fn d() { | ||
foo::<BAR - 3>(); //~ ERROR expected one of | ||
} | ||
fn e() { | ||
foo::<BAR - BAR>(); //~ ERROR expected one of | ||
} | ||
fn f() { | ||
foo::<100 - BAR>(); //~ ERROR expressions must be enclosed in braces | ||
} | ||
fn g() { | ||
foo::<bar<i32>()>(); //~ ERROR expected one of | ||
} | ||
fn h() { | ||
foo::<bar::<i32>()>(); //~ ERROR expected one of | ||
} | ||
fn i() { | ||
foo::<bar::<i32>() + BAR>(); //~ ERROR expected one of | ||
} | ||
fn j() { | ||
foo::<bar::<i32>() - BAR>(); //~ ERROR expected one of | ||
} | ||
fn k() { | ||
foo::<BAR - bar::<i32>()>(); //~ ERROR expected one of | ||
} | ||
fn l() { | ||
foo::<BAR - bar::<i32>()>(); //~ ERROR expected one of | ||
} | ||
|
||
const fn bar<const C: usize>() -> usize { | ||
C | ||
} | ||
|
||
fn main() {} |
157 changes: 157 additions & 0 deletions
157
src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
error: expected one of `,` or `>`, found `3` | ||
--> $DIR/const-expression-suggest-missing-braces.rs:8:17 | ||
| | ||
LL | foo::<BAR + 3>(); | ||
| ^ expected one of `,` or `>` | ||
| | ||
help: expressions must be enclosed in braces to be used as const generic arguments | ||
| | ||
LL | foo::<{ BAR + 3 }>(); | ||
| ^ ^ | ||
|
||
error: expressions must be enclosed in braces to be used as const generic arguments | ||
--> $DIR/const-expression-suggest-missing-braces.rs:21:11 | ||
| | ||
LL | foo::<3 + 3>(); | ||
| ^^^^^ | ||
| | ||
help: enclose the `const` expression in braces | ||
| | ||
LL | foo::<{ 3 + 3 }>(); | ||
| ^ ^ | ||
|
||
error: expected one of `,` or `>`, found `-` | ||
--> $DIR/const-expression-suggest-missing-braces.rs:24:15 | ||
| | ||
LL | foo::<BAR - 3>(); | ||
| ^ expected one of `,` or `>` | ||
| | ||
help: expressions must be enclosed in braces to be used as const generic arguments | ||
| | ||
LL | foo::<{ BAR - 3 }>(); | ||
| ^ ^ | ||
|
||
error: expected one of `,` or `>`, found `-` | ||
--> $DIR/const-expression-suggest-missing-braces.rs:27:15 | ||
| | ||
LL | foo::<BAR - BAR>(); | ||
| ^ expected one of `,` or `>` | ||
| | ||
help: expressions must be enclosed in braces to be used as const generic arguments | ||
| | ||
LL | foo::<{ BAR - BAR }>(); | ||
| ^ ^ | ||
|
||
error: expressions must be enclosed in braces to be used as const generic arguments | ||
--> $DIR/const-expression-suggest-missing-braces.rs:30:11 | ||
| | ||
LL | foo::<100 - BAR>(); | ||
| ^^^^^^^^^ | ||
| | ||
help: enclose the `const` expression in braces | ||
| | ||
LL | foo::<{ 100 - BAR }>(); | ||
| ^ ^ | ||
|
||
error: expected one of `,` or `>`, found `(` | ||
--> $DIR/const-expression-suggest-missing-braces.rs:33:19 | ||
| | ||
LL | foo::<bar<i32>()>(); | ||
| ^ expected one of `,` or `>` | ||
| | ||
help: expressions must be enclosed in braces to be used as const generic arguments | ||
| | ||
LL | foo::<{ bar<i32>() }>(); | ||
| ^ ^ | ||
|
||
error: expected one of `,` or `>`, found `(` | ||
--> $DIR/const-expression-suggest-missing-braces.rs:36:21 | ||
| | ||
LL | foo::<bar::<i32>()>(); | ||
| ^ expected one of `,` or `>` | ||
| | ||
help: expressions must be enclosed in braces to be used as const generic arguments | ||
| | ||
LL | foo::<{ bar::<i32>() }>(); | ||
| ^ ^ | ||
|
||
error: expected one of `,` or `>`, found `(` | ||
--> $DIR/const-expression-suggest-missing-braces.rs:39:21 | ||
| | ||
LL | foo::<bar::<i32>() + BAR>(); | ||
| ^ expected one of `,` or `>` | ||
| | ||
help: expressions must be enclosed in braces to be used as const generic arguments | ||
| | ||
LL | foo::<{ bar::<i32>() + BAR }>(); | ||
| ^ ^ | ||
|
||
error: expected one of `,` or `>`, found `(` | ||
--> $DIR/const-expression-suggest-missing-braces.rs:42:21 | ||
| | ||
LL | foo::<bar::<i32>() - BAR>(); | ||
| ^ expected one of `,` or `>` | ||
| | ||
help: expressions must be enclosed in braces to be used as const generic arguments | ||
| | ||
LL | foo::<{ bar::<i32>() - BAR }>(); | ||
| ^ ^ | ||
|
||
error: expected one of `,` or `>`, found `-` | ||
--> $DIR/const-expression-suggest-missing-braces.rs:45:15 | ||
| | ||
LL | foo::<BAR - bar::<i32>()>(); | ||
| ^ expected one of `,` or `>` | ||
| | ||
help: expressions must be enclosed in braces to be used as const generic arguments | ||
| | ||
LL | foo::<{ BAR - bar::<i32>() }>(); | ||
| ^ ^ | ||
|
||
error: expected one of `,` or `>`, found `-` | ||
--> $DIR/const-expression-suggest-missing-braces.rs:48:15 | ||
| | ||
LL | foo::<BAR - bar::<i32>()>(); | ||
| ^ expected one of `,` or `>` | ||
| | ||
help: expressions must be enclosed in braces to be used as const generic arguments | ||
| | ||
LL | foo::<{ BAR - bar::<i32>() }>(); | ||
| ^ ^ | ||
|
||
error[E0404]: expected trait, found constant `BAR` | ||
--> $DIR/const-expression-suggest-missing-braces.rs:13:11 | ||
| | ||
LL | foo::<BAR + BAR>(); | ||
| ^^^ not a trait | ||
|
||
error[E0404]: expected trait, found constant `BAR` | ||
--> $DIR/const-expression-suggest-missing-braces.rs:13:17 | ||
| | ||
LL | foo::<BAR + BAR>(); | ||
| ^^^ not a trait | ||
|
||
warning: trait objects without an explicit `dyn` are deprecated | ||
--> $DIR/const-expression-suggest-missing-braces.rs:13:11 | ||
| | ||
LL | foo::<BAR + BAR>(); | ||
| ^^^^^^^^^ help: use `dyn`: `dyn BAR + BAR` | ||
| | ||
= note: `#[warn(bare_trait_objects)]` on by default | ||
|
||
error[E0107]: wrong number of const arguments: expected 1, found 0 | ||
--> $DIR/const-expression-suggest-missing-braces.rs:13:5 | ||
| | ||
LL | foo::<BAR + BAR>(); | ||
| ^^^^^^^^^^^^^^^^ expected 1 const argument | ||
|
||
error[E0107]: wrong number of type arguments: expected 0, found 1 | ||
--> $DIR/const-expression-suggest-missing-braces.rs:13:11 | ||
| | ||
LL | foo::<BAR + BAR>(); | ||
| ^^^^^^^^^ unexpected type argument | ||
|
||
error: aborting due to 15 previous errors; 1 warning emitted | ||
|
||
Some errors have detailed explanations: E0107, E0404. | ||
For more information about an error, try `rustc --explain E0107`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.