Skip to content

Commit 0cab476

Browse files
compiler: do not write const _: () backwards
Co-authored-by: Christopher Serr <christopher.serr@gmail.com>
1 parent 0c3adfb commit 0cab476

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler/rustc_parse/src/parser/item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl<'a> Parser<'a> {
8484
} else if self.parse_const_block(span, false).is_ok() {
8585
err.span_label(
8686
span,
87-
"if you meant to create an anonymous const, use `const (): _ = {};` instead"
87+
"if you meant to create an anonymous const, use `const _: () = {};` instead"
8888
);
8989
} else {
9090
err.span_label(span, "expected item")

tests/ui/inline-const/expr-in-item-context.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: expected item, found keyword `const`
22
--> $DIR/expr-in-item-context.rs:9:1
33
|
44
LL | const { assert!(size_of::<u32>() <= size_of::<usize>()) };
5-
| ^^^^^ if you meant to create an anonymous const, use `const (): _ = {};` instead
5+
| ^^^^^ if you meant to create an anonymous const, use `const _: () = {};` instead
66

77
error: aborting due to 1 previous error
88

0 commit comments

Comments
 (0)