Skip to content

Commit 7e4c1c4

Browse files
committed
Fix diagnostics to invalid metavar exprs
Suggesting to remove the entire thing makes no sense, especially not as MachineApplicable.
1 parent a60a9e5 commit 7e4c1c4

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

compiler/rustc_expand/src/mbe/metavar_expr.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,8 @@ impl MetaVarExpr {
9898
_ => {
9999
let err_msg = "unrecognized meta-variable expression";
100100
let mut err = psess.dcx().struct_span_err(ident.span, err_msg);
101-
err.span_suggestion(
102-
ident.span,
101+
err.help(
103102
"supported expressions are count, ignore, index and len",
104-
"",
105-
Applicability::MachineApplicable,
106103
);
107104
return Err(err);
108105
}

tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ error: unrecognized meta-variable expression
188188
--> $DIR/syntax-errors.rs:140:33
189189
|
190190
LL | ( $( $i:ident ),* ) => { ${ aaaaaaaaaaaaaa(i) } };
191-
| ^^^^^^^^^^^^^^ help: supported expressions are count, ignore, index and len
191+
| ^^^^^^^^^^^^^^
192+
|
193+
= help: supported expressions are count, ignore, index and len
192194

193195
error: expected identifier or string literal
194196
--> $DIR/syntax-errors.rs:118:33

0 commit comments

Comments
 (0)