forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#77502 - varkor:const-generics-suggest-enclosi…
…ng-braces, r=petrochenkov Suggest that expressions that look like const generic arguments should be enclosed in brackets I pulled out the changes for const expressions from rust-lang#71592 (without the trait object diagnostic changes) and made some small changes; the implementation is `@estebank's.` We're also going to want to make some changes separately to account for trait objects (they result in poor diagnostics, as is evident from one of the test cases here), such as an adaption of rust-lang#72273. Fixes rust-lang#70753. r? `@petrochenkov`
- Loading branch information
Showing
19 changed files
with
782 additions
and
35 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 | ||
|
Oops, something went wrong.