about summary refs log tree commit diff
path: root/tests/ui/parser/attribute
AgeCommit message (Collapse)AuthorLines
2025-08-22Updated uitests for new parserJonathan Brouwer-8/+63
2025-04-03Use `cfg(false)` in UI testsclubby789-125/+125
2025-04-03compiletest: Require `//~` annotations even if `error-pattern` is specifiedVadim Petrochenkov-8/+4
2025-03-26expand: Leave traces when expanding `cfg` attributesVadim Petrochenkov-24/+2
2025-02-28Remove `NtMeta`.Nicholas Nethercote-6/+6
Note: there was an existing code path involving `Interpolated` in `MetaItem::from_tokens` that was dead. This commit transfers that to the new form, but puts an `unreachable!` call inside it.
2025-02-03Do not allow attributes on struct field rest patternsJack Rickard-0/+18
This removes support for attributes on struct field rest patterns (the `..`) from the parser. Previously they were being parsed but dropped from the AST, so didn't work and were deleted by rustfmt.
2024-08-04don't suggest turning crate-level attributes into outer styleyukang-20/+0
2024-07-12Make parse error suggestions verbose and fix spansEsteban Küber-19/+74
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-19Move `parse_or_use_outer_attributes` out of `parse_expr_prefix_range`.Nicholas Nethercote-6/+6
This eliminates another `Option<AttrWrapper>` argument and changes one obscure error message.
2024-06-06Revert "Rollup merge of #124099 - voidc:disallow-ambiguous-expr-attrs, ↵Rémy Rakic-76/+0
r=davidtwco" This reverts commit 57dad1d75e562ff73051c1c43b07eaf65c7dbd74, reversing changes made to 36316df9fe6c3e246153fe6e78967643cf08c148.
2024-05-10Fix parse error message for meta itemsLeón Orell Valerian Liehr-30/+51
2024-05-04compiletest: add enable-by-default check-cfgUrgau-2/+6
2024-04-18Disallow ambiguous attributes on expressionsDominik Stolz-0/+76
2024-04-07Unify all the always-false cfgs under the `FALSE` cfgUrgau-9/+9
2024-03-21Rewrite `parse_meta_item`.Nicholas Nethercote-0/+37
It can't use `maybe_whole`, but it can match `maybe_whole` more closely. Also add a test for a case that wasn't previously covered.
2024-02-26Properly emit `expected ;` on `#[attr] expr`Lieselotte-2/+43
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-6/+6
2024-01-26Properly recover from trailing attr in bodyEsteban Küber-0/+36
When encountering an attribute in a body, we try to recover from an attribute on an expression (as opposed to a statement). We need to properly clean up when the attribute is at the end of the body where a tail expression would be. Fix #118164.
2024-01-12Suggest quoting unquoted idents in attrssjwang05-0/+54
2023-12-28Don't expect bodyless arms if the pattern can never be a never patternLieselotte-9/+9
2023-12-03Parse a pattern with no armNadrieril-9/+9
2023-11-24Show number in error message even for one errorNilstrieb-10/+10
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-16Handle attempts to have multiple `cfg`d tail expressionsEsteban Küber-0/+73
When encountering code that seems like it might be trying to have multiple tail expressions depending on `cfg` information, suggest alternatives that will success to parse. ```rust fn foo() -> String { #[cfg(feature = "validation")] [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() #[cfg(not(feature = "validation"))] String::new() } ``` ``` error: expected `;`, found `#` --> $DIR/multiple-tail-expr-behind-cfg.rs:5:64 | LL | #[cfg(feature = "validation")] | ------------------------------ only `;` terminated statements or tail expressions are allowed after this attribute LL | [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() | ^ expected `;` here LL | #[cfg(not(feature = "validation"))] | - unexpected token | help: add `;` here | LL | [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>(); | + help: alternatively, consider surrounding the expression with a block | LL | { [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() } | + + help: it seems like you are trying to provide different expressions depending on `cfg`, consider using `if cfg!(..)` | LL ~ if cfg!(feature = "validation") { LL ~ [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() LL ~ } else if cfg!(not(feature = "validation")) { LL ~ String::new() LL + } | ``` Fix #106020.
2023-10-09Move some tests aroundEsteban Küber-0/+696