about summary refs log tree commit diff
path: root/tests/ui/parser/macro
AgeCommit message (Collapse)AuthorLines
2025-10-01mbe: Add parsing tests for `unsafe` macro rulesJosh Triplett-9/+45
2025-09-26Ignore more failing ui tests for GCC backendGuillaume Gomez-5/+6
2025-08-14mbe: Parse macro `derive` rulesJosh Triplett-6/+139
This handles various kinds of errors, but does not allow applying the derive yet. This adds the feature gate `macro_derive`.
2025-08-08mbe: Add parser test for macro attribute recoveryJosh Triplett-0/+50
2025-08-08mbe: Parse macro attribute rulesJosh Triplett-0/+112
This handles various kinds of errors, but does not allow applying the attributes yet. This adds the feature gate `macro_attr`.
2025-07-05Rename tests named with `mbe` to use `macro` insteadJosh Triplett-1/+1
Most macro tests use `macro` in the name, making it easy to find and run tests relevant to macros. However, a few use `mbe` instead. Rename those to say `macro`.
2025-07-05Move macro tests in `parser` into `macro` directoryJosh Triplett-0/+499
The `macro` directory contains most of the macro tests, but not all of them; move the remainder into `macro`.
2025-07-03mbe: Gracefully handle macro rules that end after `=>`Josh Triplett-0/+78
Add a test for various cases of invalid macro definitions. Closes: https://github.com/rust-lang/rust/issues/143351
2025-06-24mbe: Clean up code with non-optional `NonterminalKind`Trevor Gross-9/+17
Since [1], the fragment specifier is unconditionally required in all editions. This means `NonTerminalKind` no longer needs to be optional, as we can reject this code during the expansion of `macro_rules!` rather than handling it throughout the code. Do this cleanup here. [1]: https://github.com/rust-lang/rust/pull/128425
2025-06-12Make `missing_fragment_specifier` an unconditional errorTrevor Gross-17/+8
This was attempted in [1] then reverted in [2] because of fallout. Recently, this was made an edition-dependent error in [3]. Make missing fragment specifiers an unconditional error again. [1]: https://github.com/rust-lang/rust/pull/75516 [2]: https://github.com/rust-lang/rust/pull/80210 [3]: https://github.com/rust-lang/rust/pull/128006
2025-05-27Report text_direction_codepoint_in_literal when parsingMatthew Jasper-0/+125
- The lint is now reported in code that gets removed/modified/duplicated by macro expansion. - Spans are more accurate - Fixes #140281
2025-04-15Improve parse errors for lifetimes in type positionLeón Orell Valerian Liehr-26/+57
2025-04-08UI tests: add missing diagnostic kinds where possibleVadim Petrochenkov-1/+1
2025-04-02Remove `NtExpr` and `NtLiteral`.Nicholas Nethercote-2/+2
Notes about tests: - tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs: some messages are now duplicated due to repeated parsing. - tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs: ditto. - `tests/ui/proc-macro/macro-rules-derive-cfg.rs`: the diff looks large but the only difference is the insertion of a single invisible-delimited group around a metavar. - `tests/ui/attributes/nonterminal-expansion.rs`: a slight span degradation, somehow related to the recent massive attr parsing rewrite (#135726). I couldn't work out exactly what is going wrong, but I don't think it's worth holding things up for a single slightly suboptimal error message.
2025-02-23Rollup merge of #137435 - estebank:match-arm-2, r=compiler-errorsJacob Pratt-1/+6
Fix "missing match arm body" suggestion involving `!` Include the match arm guard in the gated span, so that the suggestion to add a body is correct instead of inserting the body before the guard. Make the suggestion verbose. ``` error: `match` arm with no body --> $DIR/feature-gate-never_patterns.rs:43:9 | LL | Some(_) if false, | ^^^^^^^^^^^^^^^^ | help: add a body after the pattern | LL | Some(_) if false => { todo!() }, | ++++++++++++++ ``` r? `@compiler-errors`
2025-02-22Fix "missing match arm body" suggestion involving `!`Esteban Küber-1/+6
Include the match arm guard in the gated span, so that the suggestion to add a body is correct instead of inserting the body before the guard. Make the suggestion verbose. ``` error: `match` arm with no body --> $DIR/feature-gate-never_patterns.rs:43:9 | LL | Some(_) if false, | ^^^^^^^^^^^^^^^^ | help: add a body after the pattern | LL | Some(_) if false => { todo!() }, | ++++++++++++++ ```
2025-02-21Remove `NtTy`.Nicholas Nethercote-4/+13
Notes about tests: - tests/ui/parser/macro/trait-object-macro-matcher.rs: the syntax error is duplicated, because it occurs now when parsing the decl macro input, and also when parsing the expanded decl macro. But this won't show up for normal users due to error de-duplication. - tests/ui/associated-consts/issue-93835.rs: similar, plus there are some additional errors about this very broken code. - The changes to metavariable descriptions in #132629 are now visible in error message for several tests.
2024-10-28Tweak more warnings.Nicholas Nethercote-4/+4
Much like the previous commit. I think the removal of "the token" in each message is fine here. There are many more error messages that mention tokens without saying "the token" than those that do say it.
2024-10-28Tweak `expand_incomplete_parse` warning.Nicholas Nethercote-8/+8
By using `token_descr`, as is done for many other errors, we can get slightly better descriptions in error messages, e.g. "macro expansion ignores token `let` and any following" becomes "macro expansion ignores keyword `let` and any tokens following". This will be more important once invisible delimiters start being mentioned in error messages -- without this commit, that leads to error messages such as "error at ``" because invisible delimiters are pretty printed as an empty string.
2024-07-24Mark `missing_fragment_specifier` as `FutureReleaseErrorReportInDeps`Trevor Gross-0/+11
We are moving toward forbidding `missing_fragment_specifier` either in edition 2024 or unconditionally. Make a first step toward this by ensuring crates that rely on the old behavior are reported when used as dependencies. Tracking issue: <https://github.com/rust-lang/rust/issues/128143>
2024-07-12Make parse error suggestions verbose and fix spansEsteban Küber-1/+6
Go over all structured parser suggestions and make them verbose style. When suggesting to add or remove delimiters, turn them into multiple suggestion parts.
2024-06-03Spruce up the diagnostics of some early lintsLeón Orell Valerian Liehr-2/+2
2024-06-01Reject CVarArgs in parse_ty_for_where_clauseLeón Orell Valerian Liehr-0/+11
2024-05-11Add parser tests for statement boundary insertionDavid Tolnay-0/+104
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-3/+3
2023-12-27Introduce `const Trait` (always-const trait bounds)León Orell Valerian Liehr-0/+16
2023-12-03Disallow an arm without a body (except for never patterns)Nadrieril-1/+8
Parsing now accepts a match arm without a body, so we must make sure to only accept that if the pattern is a never pattern.
2023-12-03Detect attempts to expand a macro to a match arm againNadrieril-0/+2
Because a macro invocation can expand to a never pattern, we can't rule out a `arm!(),` arm at parse time. Instead we detect that case at expansion time, if the macro tries to output a pattern followed by `=>`.
2023-12-03Parse a pattern with no armNadrieril-7/+10
2023-11-24Show number in error message even for one errorNilstrieb-6/+6
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-10-05Add a note to duplicate diagnosticsAlex Macleod-0/+2
2023-08-21discard dummy field for macro invocation when parse structbohan-38/+44
2023-08-02Add test for enum with fieldsCatherine Flores-31/+53
2023-07-24Recover from some macrosCatherine Flores-86/+88
2023-07-24Specify macro is invalid in certain contextsCatherine-0/+148
2023-01-11Move /src/test to /testsAlbert Larsan-0/+393