about summary refs log tree commit diff
path: root/tests/ui/parser
AgeCommit message (Collapse)AuthorLines
2024-07-10Reorder modifiers and polarity to be *after* binder in trait boundsMichael Goulet-1/+1
2024-07-10Auto merge of #127419 - trevyn:issue-125446, r=fee1-deadbors-4/+129
Add suggestions for possible missing `fn`, `struct`, or `enum` keywords Closes #125446 Closes #65381
2024-07-08Add suggestions for possible missing `fn`, `struct`, or `enum` keywordstrevyn-4/+129
2024-07-08Auto merge of #113128 - WaffleLapkin:become_trully_unuwuable, r=oli-obk,RalfJungbors-22/+9
Support tail calls in mir via `TerminatorKind::TailCall` This is one of the interesting bits in tail call implementation — MIR support. This adds a new `TerminatorKind` which represents a tail call: ```rust TailCall { func: Operand<'tcx>, args: Vec<Operand<'tcx>>, fn_span: Span, }, ``` *Structurally* this is very similar to a normal `Call` but is missing a few fields: - `destination` — tail calls don't write to destination, instead they pass caller's destination to the callee (such that eventual `return` will write to the caller of the function that used tail call) - `target` — similarly to `destination` tail calls pass the caller's return address to the callee, so there is nothing to do - `unwind` — I _think_ this is applicable too, although it's a bit confusing - `call_source` — `become` forbids operators and is not created as a lowering of something else; tail calls always come from HIR (at least for now) It might be helpful to read the interpreter implementation to understand what `TailCall` means exactly, although I've tried documenting it too. ----- There are a few `FIXME`-questions still left, ideally we'd be able to answer them during review ':) ----- r? `@oli-obk` cc `@scottmcm` `@DrMeepster` `@JakobDegen`
2024-07-07Support tail calls in mir via `TerminatorKind::TailCall`Maybe Waffle-22/+9
2024-07-05Rollup merge of #127107 - mu001999-contrib:dead/enhance-2, r=pnkfelixMichael Goulet-1/+3
Improve dead code analysis Fixes #120770 1. check impl items later if self ty is private although the trait method is public, cause we must use the ty firstly if it's private 2. mark the adt live if it appears in pattern, like generic argument, this implies the use of the adt 3. based on the above, we can handle the case that private adts impl Default, so that we don't need adding rustc_trivial_field_reads on Default, and the logic in should_ignore_item r? ``@pnkfelix``
2024-07-04Update TestsVeera-0/+92
2024-07-04Improve dead code analysismu001999-1/+3
2024-06-30Migrate tests to use `-Znext-solver`Deadbeef-12/+3
2024-06-29Avoid suggesting to add unsafe when the extern block is already unsafeSantiago Pastorino-5/+0
2024-06-28Add feature diagnostic for unsafe_extern_blocksSantiago Pastorino-0/+8
2024-06-26Fix bad replacement for unsafe extern block suggestionyukang-12/+20
2024-06-22compiler: Mention C-unwind in C-variadic errorJubilee Young-42/+42
2024-06-22Rollup merge of #126552 - fee1-dead-contrib:rmfx, r=compiler-errorsMatthias Krüger-1/+12
Remove use of const traits (and `feature(effects)`) from stdlib The current uses are already unsound because they are using non-const impls in const contexts. We can reintroduce them by reverting the commit in this PR, after #120639 lands. Also, make `effects` an incomplete feature. cc `@rust-lang/project-const-traits` r? `@compiler-errors`
2024-06-22Make `effects` an incomplete featureDeadbeef-1/+12
2024-06-22Rollup merge of #126723 - estebank:dot-dot-dot, r=NadrierilGuillaume Gomez-1/+1
Fix `...` in multline code-skips in suggestions When we have long code skips, we write `...` in the line number gutter. For suggestions, we were "centering" the `...` with the line, but that was inconsistent with what we do in every other case *and* off-center.
2024-06-21Rollup merge of #126811 - compiler-errors:tidy-ftl, r=estebankJubilee-1/+1
Add a tidy rule to check that fluent messages and attrs don't end in `.` This adds a new dependency on `fluent-parse` to `tidy` -- we already rely on it in rustc so I feel like it's not that big of a deal. This PR also adjusts many error messages that currently end in `.`; not all of them since I added an `ALLOWLIST`, excluded `rustc_codegen_*` ftl files, and `.teach_note` attributes. r? ``@estebank`` ``@oli-obk``
2024-06-21Fix remaining casesMichael Goulet-1/+1
2024-06-21Do not allow safe usafe on static and fn itemsSantiago Pastorino-15/+15
2024-06-21Rollup merge of #126125 - dev-ardi:conflict-markers, r=estebankMatthias Krüger-82/+151
Improve conflict marker recovery <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r​? <reviewer name> --> closes #113826 r? ```@estebank``` since you reviewed #115413 cc: ```@rben01``` since you opened up the issue in the first place
2024-06-20Fix `...` in multline code-skips in suggestionsEsteban Küber-1/+1
When we have long code skips, we write `...` in the line number gutter. For suggestions, we were "centering" the `...` with the line, but that was consistent with what we do in every other case.
2024-06-19Auto merge of #126678 - nnethercote:fix-duplicated-attrs-on-nt-expr, ↵bors-6/+6
r=petrochenkov Fix duplicated attributes on nonterminal expressions This PR fixes a long-standing bug (#86055) whereby expression attributes can be duplicated when expanded through declarative macros. First, consider how items are parsed in declarative macros: ``` Items: - parse_nonterminal - parse_item(ForceCollect::Yes) - parse_item_ - attrs = parse_outer_attributes - parse_item_common(attrs) - maybe_whole! - collect_tokens_trailing_token ``` The important thing is that the parsing of outer attributes is outside token collection, so the item's tokens don't include the attributes. This is how it's supposed to be. Now consider how expression are parsed in declarative macros: ``` Exprs: - parse_nonterminal - parse_expr_force_collect - collect_tokens_no_attrs - collect_tokens_trailing_token - parse_expr - parse_expr_res(None) - parse_expr_assoc_with - parse_expr_prefix - parse_or_use_outer_attributes - parse_expr_dot_or_call ``` The important thing is that the parsing of outer attributes is inside token collection, so the the expr's tokens do include the attributes, i.e. in `AttributesData::tokens`. This PR fixes the bug by rearranging expression parsing to that outer attribute parsing happens outside of token collection. This requires a number of small refactorings because expression parsing is somewhat complicated. While doing so the PR makes the code a bit cleaner and simpler, by eliminating `parse_or_use_outer_attributes` and `Option<AttrWrapper>` arguments (in favour of the simpler `parse_outer_attributes` and `AttrWrapper` arguments), and simplifying `LhsExpr`. r? `@petrochenkov`
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-19Improve conflict marker recoveryardi-82/+151
2024-06-17Rework precise capturing syntaxMichael Goulet-3/+3
2024-06-11Rollup merge of #125913 - fmease:early-lints-spruce-up-some-diags, r=Nadrieril许杰友 Jieyou Xu (Joe)-2/+2
Spruce up the diagnostics of some early lints Implement the various "*(note to myself) in a follow-up PR we should turn parts of this message into a subdiagnostic (help msg or even struct sugg)*" drive-by comments I left in #124417 during my review. For context, before #124417, only a few early lints touched/decorated/customized their diagnostic because the former API made it a bit awkward. Likely because of that, things that should've been subdiagnostics were just crammed into the primary message. This PR rectifies this.
2024-06-07Rollup merge of #125572 - mu001999-contrib:dead/enhance, r=pnkfelixMatthias Krüger-7/+9
Detect pub structs never constructed and unused associated constants <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r​? <reviewer name> --> Lints never constructed public structs. If we don't provide public methods to construct public structs with private fields, and don't construct them in the local crate. They would be never constructed. So that we can detect such public structs. --- Update: Also lints unused associated constants in traits.
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-06-06Auto merge of #124482 - spastorino:unsafe-extern-blocks, r=oli-obkbors-49/+50
Unsafe extern blocks This implements RFC 3484. Tracking issue #123743 and RFC https://github.com/rust-lang/rfcs/pull/3484 This is better reviewed commit by commit.
2024-06-05Detect pub structs never constructed and unused associated constants in traitsr0cky-7/+9
2024-06-05Add unsafe_extern_blocks feature flagSantiago Pastorino-4/+29
2024-06-04Fail when using safe/unsafe items inside unadorned extern blocksSantiago Pastorino-3/+32
2024-06-04Handle safety keyword for extern block inner itemsSantiago Pastorino-28/+28
2024-06-04Allow using unsafe on functions inside extern blocksSantiago Pastorino-44/+6
2024-06-04Allow unsafe extern on all editionsSantiago Pastorino-23/+8
2024-06-04Auto merge of #123536 - compiler-errors:simplify-int-float, r=lcnrbors-9/+0
Simplify `IntVarValue`/`FloatVarValue` r? `@ghost`
2024-06-04Rollup merge of #125667 - oli-obk:taintify, r=TaKO8KiMichael Goulet-3/+15
Silence follow-up errors directly based on error types and regions During type_of, we used to just return an error type if there were any errors encountered. This is problematic, because it means a struct declared as `struct Foo<'static>` will end up not finding any inherent or trait impls because those impl blocks' `Self` type will be `{type error}` instead of `Foo<'re_error>`. Now it's the latter, silencing nonsensical follow-up errors about `Foo` not having any methods. Unfortunately that now allows for new follow-up errors, because borrowck treats `'re_error` as `'static`, causing nonsensical errors about non-error lifetimes not outliving `'static`. So what I also did was to just strip all outlives bounds that borrowck found, thus never letting it check them. There are probably more nuanced ways to do this, but I worried there would be other nonsensical errors if some outlives bounds were missing. Also from the test changes, it looked like an improvement everywhere.
2024-06-03Spruce up the diagnostics of some early lintsLeón Orell Valerian Liehr-2/+2
2024-06-01Auto merge of #125863 - fmease:rej-CVarArgs-in-parse_ty_for_where_clause, ↵bors-2/+23
r=compiler-errors Reject `CVarArgs` in `parse_ty_for_where_clause` Fixes #125847. This regressed in #77035 where the `parse_ty` inside `parse_ty_where_predicate` was replaced with the at the time new `parse_ty_for_where_clause` which incorrectly stated it would permit CVarArgs (maybe a copy/paste error). r? parser
2024-06-01Reject CVarArgs in parse_ty_for_where_clauseLeón Orell Valerian Liehr-2/+23
2024-06-01Simplify IntVarValue/FloatVarValueMichael Goulet-9/+0
2024-05-28Allow type_of to return partially non-error types if the type was already ↵Oli Scherer-3/+15
tainted
2024-05-26Rollup merge of #124048 - veera-sivarajan:bugfix-123773-c23-variadics, ↵Jubilee-85/+35
r=compiler-errors Support C23's Variadics Without a Named Parameter Fixes #123773 This PR removes the static check that disallowed extern functions with ellipsis (varargs) as the only parameter since this is now valid in C23. This will not break any existing code as mentioned in the proposal document: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2975.pdf. Also, adds a doc comment for `check_decl_cvariadic_pos()` and fixes the name of the function (`varadic` -> `variadic`).
2024-04-16Update TestsVeera-85/+35
2024-04-12Rollup merge of #123847 - eggyal:issue-123844, r=fmeaseMatthias Krüger-36/+0
Suppress `let else` suggestion for uninitialized refutable `let`s Fixes #123844 r? `@CAD97`
2024-04-12Suppress erroneous suggestionAlan Egerton-36/+0
The suggestion to use `let else` with an uninitialized refutable `let` statement was erroneous: `let else` cannot be used with deferred initialization.
2024-04-12Rollup merge of #123841 - Kohei316:remove_qualifier_sugg, r=wesleywiserMatthias Krüger-6/+6
Improve diagnostic by suggesting to remove visibility qualifier Resolves #123529 This PR improve diagnostic by suggesting to remove visibility qualifier.
2024-04-12Improve diagnostic by suggesting to remove visibility qualifiermorine0122-6/+6
2024-04-07Remove useless configs in testsUrgau-30/+0
Since they are never set and don't have impact on the test. Or for the cfg-panic tests are already tested with check-cfg.
2024-04-07Unify all the always-false cfgs under the `FALSE` cfgUrgau-9/+9