about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
AgeCommit message (Collapse)AuthorLines
2025-08-09Auto merge of #145146 - fee1-dead-contrib:push-zmqrkurlzrxy, r=nnethercotebors-258/+269
remove `P` Previous work: rust-lang/rust#141603 MCP: https://github.com/rust-lang/compiler-team/issues/878 cc `@nnethercote`
2025-08-09remove `P`Deadbeef-258/+269
2025-08-08Recover for PAT = EXPR {}Michael Goulet-0/+2
2025-08-06Rollup merge of #144956 - fmease:gate-const-trait-syntax, r=BoxyUwUGuillaume Gomez-0/+3
Gate const trait syntax Missed this during my review of rust-lang/rust#143879, huge apologies! Fixes [after beta backport] https://github.com/rust-lang/rust/issues/144958. cc ``@fee1-dead`` r? ``@BoxyUwU`` or anyone
2025-08-06Rollup merge of #144195 - Kivooeo:bad-attr, r=fmease,compiler-errorsGuillaume Gomez-7/+52
Parser: Recover from attributes applied to types and generic args r? compiler Add clearer error messages for invalid attribute usage in types or generic types fixes rust-lang/rust#135017 fixes rust-lang/rust#144132
2025-08-05Gate const trait syntaxLeón Orell Valerian Liehr-0/+3
2025-08-05Added checks for attribute in type caseKivooeo-7/+52
2025-08-04Include whitespace in "remove `|`" suggestion and make it hiddenEsteban Küber-8/+10
2025-07-31Consider operator's span when computing binop expr spanMichael Goulet-5/+8
2025-07-29Rollup merge of #144589 - compiler-errors:postfix-yield-after-cast, ↵Stuart Cook-1/+5
r=petrochenkov Account for `.yield` in illegal postfix operator message Fixes rust-lang/rust#144527
2025-07-28feat: Right align line numbersScott Schafer-24/+24
2025-07-28Account for .yield in illegal postfix operator messageMichael Goulet-1/+5
2025-07-28use let chains in mir, resolve, targetKivooeo-27/+25
2025-07-17parse `const trait Trait`Deadbeef-7/+21
2025-07-15Rollup merge of #143941 - folkertdev:cfg-select-docs, r=traviscrossSamuel Tardieu-4/+6
update `cfg_select!` documentation tracking issue: https://github.com/rust-lang/rust/issues/115585 After rust-lang/rust#143461, and with an eye on a soon(ish) stabilization, I think the docs need some work. The existing text read more like a motivation for the feature existing to me, so I've tried to now be a bit more descriptive. Still, suggestions are very welcome. I also added a test for an empty `select! {}` because it's just the sort of thing that might break. r? ``@traviscross``
2025-07-15Rollup merge of #143905 - xizheyin:143828, r=compiler-errorsSamuel Tardieu-2/+57
Recover and suggest to use `;` to construct array type Fixes rust-lang/rust#143828 r? compiler
2025-07-15Recover and suggest use `;` to construct array typexizheyin-2/+57
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-14update `cfg_select!` documentationFolkert de Vries-4/+6
and make internal terminology consistent Co-authored-by: Travis Cross <tc@traviscross.com>
2025-07-13Auto merge of #143461 - folkertdev:cfg-select-builtin-macro, r=petrochenkovbors-1/+78
make `cfg_select` a builtin macro tracking issue: https://github.com/rust-lang/rust/issues/115585 This parses mostly the same as the `macro cfg_select` version, except: 1. wrapping in double brackets is no longer supported (or needed): `cfg_select {{ /* ... */ }}` is now rejected. 2. in an expression context, the rhs is no longer wrapped in a block, so that this now works: ```rust fn main() { println!(cfg_select! { unix => { "foo" } _ => { "bar" } }); } ``` 3. a single wildcard rule is now supported: `cfg_select { _ => 1 }` now works I've also added an error if none of the rules evaluate to true, and warnings for any arms that follow the `_` wildcard rule. cc `@traviscross` if I'm missing any feature that should/should not be included r? `@petrochenkov` for the macro logic details
2025-07-13make `cfg_select` a builtin macroFolkert de Vries-1/+78
2025-07-10Remove uncessary parens in closure body with unused lintyukang-1/+1
2025-07-08Rollup merge of #143589 - RalfJung:const-pat, r=compiler-errorsMatthias Krüger-2/+4
const-block-as-pattern: do not refer to no-longer-existing nightly feature Surely everyone who used this nightly feature has fixed their code by now. So let's not confused people on stable that try to use a const block as a pattern by referring to some dead nightly feature.
2025-07-07const-block-as-pattern: do not refer to no-longer-existing nightly featureRalf Jung-2/+4
2025-07-06compiler: rename {ast,hir}::BareFn* to FnPtr*Jubilee Young-7/+7
Fix some comments and related types and locals where it is obvious, e.g. - bare_fn -> fn_ptr - LifetimeBinderKind::BareFnType -> LifetimeBinderKind::FnPtrType Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
2025-07-03Replace kw_span by full span.Camille GILLOT-2/+12
2025-07-02Auto merge of #143338 - matthiaskrgr:rollup-ykaxh04, r=matthiaskrgrbors-16/+37
Rollup of 11 pull requests Successful merges: - rust-lang/rust#131923 (Derive `Copy` and `Hash` for `IntErrorKind`) - rust-lang/rust#138340 (Remove some unsized tuple impls now that we don't support unsizing tuples anymore) - rust-lang/rust#141219 (Change `{Box,Arc,Rc,Weak}::into_raw` to only work with `A = Global`) - rust-lang/rust#142212 (bootstrap: validate `rust.codegen-backends` & `target.<triple>.codegen-backends`) - rust-lang/rust#142237 (Detect more cases of unused_parens around types) - rust-lang/rust#142964 (Attribute rework: a parser for single attributes without arguments) - rust-lang/rust#143070 (Rewrite `macro_rules!` parser to not use the MBE engine itself) - rust-lang/rust#143235 (Assemble const bounds via normal item bounds in old solver too) - rust-lang/rust#143261 (Feed `explicit_predicates_of` instead of `predicates_of`) - rust-lang/rust#143276 (loop match: handle opaque patterns) - rust-lang/rust#143306 (Add `track_caller` attributes to trace origin of Clippy lints) r? `@ghost` `@rustbot` modify labels: rollup try-job: aarch64-apple try-job: x86_64-msvc-1 try-job: x86_64-gnu try-job: dist-i586-gnu-i586-i686-musl try-job: test-various
2025-07-02Rollup merge of #142237 - benschulz:unused-parens-fn, r=fee1-deadMatthias Krüger-16/+37
Detect more cases of unused_parens around types With this change, more unused parentheses around bounds and types nested within bounds are detected.
2025-07-02Auto merge of #143214 - camsteffen:remove-let-chains-feature, r=est31bors-1/+1
Remove let_chains unstable feature Per https://github.com/rust-lang/rust/issues/53667#issuecomment-3016742982 (but then I also noticed rust-lang/rust#140722) This replaces the feature gate with a parser error that says let chains require 2024. A lot of tests were using the unstable feature. I either added edition:2024 to the test or split out the parts that require 2024.
2025-07-01Remove support for dyn*Michael Goulet-8/+2
2025-07-01Detect more cases of unused_parens around typesBenjamin Schulz-16/+37
2025-06-30Remove let_chains featureCameron Steffen-1/+1
2025-06-29Fix the span of trait bound modifier `[const]`León Orell Valerian Liehr-1/+1
2025-06-27Rollup merge of #139858 - oli-obk:new-const-traits-syntax, r=fee1-deadMatthias Krüger-16/+34
New const traits syntax This PR only affects the AST and doesn't actually change anything semantically. All occurrences of `~const` outside of libcore have been replaced by `[const]`. Within libcore we have to wait for rustfmt to be bumped in the bootstrap compiler. This will happen "automatically" (when rustfmt is run) during the bootstrap bump, as rustfmt converts `~const` into `[const]`. After this we can remove the `~const` support from the parser Caveat discovered during impl: there is no legacy bare trait object recovery for `[const] Trait` as that snippet in type position goes down the slice /array parsing code and will error r? ``@fee1-dead`` cc ``@nikomatsakis`` ``@traviscross`` ``@compiler-errors``
2025-06-26Better recoveryMichael Goulet-0/+14
2025-06-26Make recovery for enum with struct field a bit more accurateMichael Goulet-1/+2
2025-06-26Add Ident::is_non_reserved_identMichael Goulet-10/+7
2025-06-26Change const trait bound syntax from ~const to [const]Oli Scherer-5/+19
2025-06-25Extract const boundness parsing out into a methodOli Scherer-12/+16
2025-06-24Rollup merge of #135731 - frank-king:feature/pin-borrow, r=eholk,traviscrossJubilee-1/+6
Implement parsing of pinned borrows This PR implements part of #130494. EDIT: It introduces `&pin mut $place` and `&pin const $place` as sugars for `std::pin::pin!($place)` and its shared reference equivalent, except that `$place` will not be moved when borrowing. The borrow check will be in charge of enforcing places cannot be moved or mutably borrowed since being pinned till dropped. ### Implementation steps: - [x] parse the `&pin mut $place` and `&pin const $place` syntaxes - [ ] borrowck of `&pin mut|const` - [ ] support autoref of `&pin mut|const` when needed
2025-06-22Rollup merge of #142798 - camsteffen:recover-semi, r=compiler-errorsGuillaume Gomez-30/+21
Don't fail to parse a struct if a semicolon is used to separate fields The first commit is a small refactor.
2025-06-20Recover from semicolon field separatorCameron Steffen-15/+18
2025-06-20Factor out seen_comma variableCameron Steffen-15/+3
2025-06-19Extract Translator structCameron Steffen-3/+3
2025-06-17Rollup merge of #142371 - fee1-dead-contrib:push-xqlkumzurkus, r=petrochenkovJacob Pratt-2/+2
avoid `&mut P<T>` in `visit_expr` etc methods trying a different way than rust-lang/rust#141636 r? ghost
2025-06-16Rollup merge of #142341 - xizheyin:142311, r=fee1-deadJakub Beránek-17/+28
Don't suggest converting `///` to `//` when expecting `,` Fixes rust-lang/rust#142311
2025-06-16Dont suggest converting `///` to regular comment when it appears after ↵xizheyin-17/+28
missing `,` in list Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-06-15use `if let` guards where possibleDeadbeef-16/+11
2025-06-15Implement pinned borrows, part of `pin_ergonomics`Frank King-1/+6
2025-06-13Rework how the disallowed qualifier lints are generatedJonathan Brouwer-61/+85
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-12avoid `&mut P<T>` in `visit_expr` etc methodsDeadbeef-2/+2