about summary refs log tree commit diff
path: root/tests/ui/parser
AgeCommit message (Collapse)AuthorLines
2025-07-18Rollup merge of #142693 - fmease:unbound-bettering, r=compiler-errorsMatthias Krüger-17/+7
More robustly deal with relaxed bounds and improve their diagnostics Scaffolding for https://github.com/rust-lang/rust/issues/135229 (CC https://github.com/rust-lang/rust/pull/135331) Fixes https://github.com/rust-lang/rust/issues/136944 (6th commit). Fixes https://github.com/rust-lang/rust/issues/142718 (8th commit).
2025-07-18Rollup merge of #138554 - xizheyin:issue-138401, r=chenyukangMatthias Krüger-55/+45
Distinguish delim kind to decide whether to emit unexpected closing delimiter Fixes #138401
2025-07-18Deduplicate `unmatched_delims` in `rustc_parse` to reduce confusionxizheyin-69/+33
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-18Reword diagnostics about relaxed bounds in invalid contextsLeón Orell Valerian Liehr-17/+7
2025-07-16Rollup merge of #143921 - oli-obk:const-index, r=fee1-deadSamuel Tardieu-26/+15
Constify `Index` traits tracking issue: rust-lang/rust#143775 the `SliceIndex` trait cannot be implemented by users as it is sealed. While it would be useful for the `get` method on slices, it seems weird to have a feature gate for that that isn't also gating index syntax at the same time, so I put them under the same feature gate. r? ```````@fee1-dead```````
2025-07-15Rollup merge of #143905 - xizheyin:143828, r=compiler-errorsSamuel Tardieu-9/+160
Recover and suggest to use `;` to construct array type Fixes rust-lang/rust#143828 r? compiler
2025-07-15constify `Index` trait and its slice implsOli Scherer-26/+15
2025-07-15Recover and suggest use `;` to construct array typexizheyin-47/+124
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-14Add test array-type-no-semi.rsxizheyin-0/+74
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-13cleaned up some testsKivooeo-0/+8
Additionally, remove unused `tests/ui/auxiliary/svh-*` crates that are duplicates of `tests/ui/svh/auxiliary/svh-*`.
2025-07-13moved testsKivooeo-0/+34
2025-07-11Rollup merge of #143302 - Kivooeo:tf27, r=tgross35Matthias Krüger-0/+15
`tests/ui`: A New Order [27/N] > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895. r? ``@tgross35``
2025-07-10cleaned up some testsKivooeo-1/+5
2025-07-10Rollup merge of #143298 - Kivooeo:tf23, r=tgross35Trevor Gross-0/+59
`tests/ui`: A New Order [23/N] > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895. r? ``@tgross35``
2025-07-07Add ui test unnessary-error-issue-138401.rsxizheyin-0/+26
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
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/+0
The `macro` directory contains most of the macro tests, but not all of them; move the remainder into `macro`.
2025-07-04Rollup merge of #143299 - Kivooeo:tf24, r=tgross35Jubilee-0/+13
`tests/ui`: A New Order [24/N] > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895. r? `@tgross35`
2025-07-04Rollup merge of #143202 - Kivooeo:tf18, r=tgross35Jubilee-0/+34
`tests/ui`: A New Order [18/N] > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895. r? `@tgross35`
2025-07-05cleaned up some testsKivooeo-8/+14
2025-07-05cleaned up some testsKivooeo-3/+7
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-07-02Rollup merge of #143070 - joshtriplett:macro-rules-parse, r=petrochenkovMatthias Krüger-6/+6
Rewrite `macro_rules!` parser to not use the MBE engine itself The `macro_rules!` parser was written to match the series of rules using the macros-by-example (MBE) engine and a hand-written equivalent of the left-hand side of a MBE macro. This was complex to read, difficult to extend, and produced confusing error messages. Because it was using the MBE engine, any parse failure would be reported as if some macro was being applied to the `macro_rules!` invocation itself; for instance, errors would talk about "macro invocation", "macro arguments", and "macro call", when they were actually about the macro *definition*. And in practice, the `macro_rules!` parser only used the MBE engine to extract the left-hand side and right-hand side of each rule as a token tree, and then parsed the rest using a separate parser. Rewrite it to parse the series of rules using a simple loop, instead. This makes it more extensible in the future, and improves error messages. For instance, omitting a semicolon between rules will result in "expected `;`" and "unexpected token", rather than the confusing "no rules expected this token in macro call". This work was greatly aided by pair programming with Vincenzo Palazzo (`@vincenzopalazzo)` and Eric Holk (`@eholk).` For review, I recommend reading the two commits separately.
2025-07-01Auto merge of #143036 - compiler-errors:no-dyn-star, r=oli-obkbors-3/+3
Remove support for `dyn*` from the compiler This PR removes support for `dyn*` (https://github.com/rust-lang/rust/issues/102425), which are a currently un-RFC'd experiment that was opened a few years ago to explore a component that we thought was necessary for AFIDT (async fn in dyn trait). It doesn't seem like we are going to need `dyn*` types -- even in an not-exposed-to-the-user way[^1] -- for us to implement AFIDT. Given that AFIDT was the original motivating purpose of `dyn*` types, I don't really see a compelling reason to have to maintain their implementation in the compiler. [^1]: Compared to, e.g., generators whih are an unstable building block we use to implement stable syntax like `async {}`. We've learned quite a lot from `dyn*`, but I think at this point its current behavior leads to more questions than answers. For example, `dyn*` support today remains somewhat fragile; it ICEs in many cases where the current "normal" `dyn Trait` types rely on their unsizedness for their vtable-based implementation to be sound I wouldn't be surprised if it's unsound in other ways, though I didn't play around with it too much. See the examples below. ```rust #![feature(dyn_star)] trait Foo { fn hello(self); } impl Foo for usize { fn hello(self) { println!("hello, world"); } } fn main() { let x: dyn* Foo = 1usize; x.hello(); } ``` And: ```rust #![feature(dyn_star)] trait Trait { type Out where Self: Sized; } fn main() { let x: <dyn* Trait as Trait>::Out; } ``` ...and probably many more problems having to do with the intersection of dyn-compatibility and `Self: Sized` bounds that I was too lazy to look into like: * GATs * Methods with invalid signatures * Associated consts Generally, `dyn*` types also end up getting in the way of working with [normal `dyn` types](https://github.com/rust-lang/rust/issues/102425#issuecomment-1712604409) to an extent that IMO outweighs the benefit of experimentation. I recognize that there are probably other, more creative usages of `dyn*` that are orthogonal to AFIDT. However, I think any work along those lines should first have to think through some of the more fundamental interactions between `dyn*` and dyn-compatibility before we think about reimplementing them in the type system. --- I'm planning on removing the `DynKind` enum and the `PointerLike` built-in trait from the compiler after this PR lands. Closes rust-lang/rust#102425. cc `@eholk` `@rust-lang/lang` `@rust-lang/types` Closes rust-lang/rust#116979. Closes rust-lang/rust#119694. Closes rust-lang/rust#134591. Closes rust-lang/rust#104800.
2025-07-01Remove support for dyn*Michael Goulet-3/+3
2025-07-01moved testsKivooeo-0/+11
2025-07-01Rollup merge of #143210 - Kivooeo:tf19, r=tgross35Guillaume Gomez-0/+20
`tests/ui`: A New Order [19/N] > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895. r? `@tgross35`
2025-07-01Fix duplicate errors for `link_section`, ↵Jonathan Brouwer-2/+12
`rustc_layout_scalar_valid_range_start` and `rustc_layout_scalar_valid_range_end`
2025-07-01Fix `#[must_use = 1]` not giving an errorJonathan Brouwer-10/+19
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01moved testsKivooeo-0/+9
2025-07-01cleaned up some testsKivooeo-2/+25
2025-07-01moved test filesKivooeo-0/+11
2025-07-01Auto merge of #142921 - JonathanBrouwer:rustc_attributes_parser, r=oli-obkbors-1/+12
Port `#[rustc_layout_scalar_valid_range_start/end]` to the new attrib… Ports `rustc_layout_scalar_valid_range_start` and `rustc_layout_scalar_valid_range_end` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197 r? `@jdonszelmann`
2025-07-01moved testsKivooeo-0/+53
2025-06-30Rollup merge of #143195 - Kivooeo:tf17, r=tgross35dianqk-0/+19
`tests/ui`: A New Order [17/N] > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895. r? `@tgross35`
2025-06-30cleaned up some testsKivooeo-0/+6
2025-06-30cleaned up some testsKivooeo-4/+10
2025-06-29moved & deleted some testsKivooeo-0/+14
2025-06-29moved testsKivooeo-0/+13
2025-06-29Rollup merge of #142214 - Kivooeo:tf9, r=jieyouxuGuillaume Gomez-0/+37
`tests/ui`: A New Order [9/N] Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895.
2025-06-29Fix the span of trait bound modifier `[const]`León Orell Valerian Liehr-2/+2
2025-06-28cleaned up some testsKivooeo-0/+37
2025-06-27Rollup merge of #139858 - oli-obk:new-const-traits-syntax, r=fee1-deadMatthias Krüger-16/+16
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-27Port `#[rustc_layout_scalar_valid_range_start/end]` to the new attribute ↵Jonathan Brouwer-1/+12
parsing infrastructure Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-26Rewrite `macro_rules!` parser to not use the MBE engine itselfJosh Triplett-6/+6
The `macro_rules!` parser was written to match the series of rules using the macros-by-example (MBE) engine and a hand-written equivalent of the left-hand side of a MBE macro. This was complex to read, difficult to extend, and produced confusing error messages. Because it was using the MBE engine, any parse failure would be reported as if some macro was being applied to the `macro_rules!` invocation itself; for instance, errors would talk about "macro invocation", "macro arguments", and "macro call", when they were actually about the macro *definition*. And in practice, the `macro_rules!` parser only used the MBE engine to extract the left-hand side and right-hand side of each rule as a token tree, and then parsed the rest using a separate parser. Rewrite it to parse the series of rules using a simple loop, instead. This makes it more extensible in the future, and improves error messages. For instance, omitting a semicolon between rules will result in "expected `;`" and "unexpected token", rather than the confusing "no rules expected this token in macro call". This work was greatly aided by pair programming with Vincenzo Palazzo and Eric Holk.
2025-06-26Change const trait bound syntax from ~const to [const]Oli Scherer-16/+16
2025-06-24Rollup merge of #142657 - tgross35:nonoptional-fragment-specifiers-cleanup, ↵Matthias Krüger-9/+17
r=petrochenkov mbe: Clean up code with non-optional `NonterminalKind` Since [rust-lang/rust#128425], 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. [rust-lang/rust#128425]: https://github.com/rust-lang/rust/pull/128425
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-22Rollup merge of #142798 - camsteffen:recover-semi, r=compiler-errorsGuillaume Gomez-9/+9
Don't fail to parse a struct if a semicolon is used to separate fields The first commit is a small refactor.
2025-06-22Port `#[must_use]` to new attribute parsing infrastructureJonathan Brouwer-19/+3
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>