about summary refs log tree commit diff
path: root/tests/ui/parser
AgeCommit message (Collapse)AuthorLines
2025-10-03Rollup merge of #147245 - ↵Matthias Krüger-9/+6
karolzwolak:only-replace-intended-bar-not-all-in-pattern, r=lcnr only replace the intended comma in pattern suggestions Only suggest to replace the intended comma, not all bars in the pattern. Fixes rust-lang/rust#143330. This continues rust-lang/rust#143331, the credit for making the fix goes to `@A4-Tacks.` I just blessed tests and added a regression test.
2025-10-02bring back plural 'alternatives' in suggestion messageKarol Zwolak-2/+2
2025-10-02Rollup merge of #147004 - estebank:ascription-in-pat, r=fee1-deadMatthias Krüger-83/+37
Tweak handling of "struct like start" where a struct isn't supported This improves the case where someone tries to write a `match` expr where the patterns have type ascription syntax. Makes them less verbose, by giving up on the first encounter in the block, and makes them more accurate by only treating them as a struct literal if successfully parsed as such. Before, encountering something like `match a { b:` would confuse the parser and think everything after `match` *must* be a struct, and if it wasn't it would generate a cascade of unnecessary diagnostics.
2025-10-01mbe: Add parsing tests for `unsafe` macro rulesJosh Triplett-9/+45
2025-10-01bless testsKarol Zwolak-9/+6
2025-09-26Ignore more failing ui tests for GCC backendGuillaume Gomez-10/+13
2025-09-24Tweak handling of "struct like start" where a struct isn't supportedEsteban Küber-83/+37
This improves the case where someone tries to write a `match` expr where the patterns have type ascription syntax. Makes them less verbose, by giving up on the first encounter in the block, and makes them more accurate by only treating them as a struct literal if successfuly parsed as such.
2025-09-18Rollup merge of #146434 - folkertdev:c-variadic-inherent-methods, ↵Matthias Krüger-18/+36
r=workingjubilee c-variadic: allow c-variadic inherent and trait methods tracking issue: https://github.com/rust-lang/rust/issues/44930 Continuing the work of https://github.com/rust-lang/rust/pull/146342, allow inherent and trait methods to be c-variadic. However, a trait that contains a c-variadic method is no longer dyn-compatible. There is, presumably, some way to make c-variadic methods dyn-compatible. However currently, we don't have confidence that it'll work reliably: when methods from a `dyn` object are cast to a function pointer, a `ReifyShim` is created. If that shim is c-variadic, it would need to forward the C variable argument list. That does appear to work, because the `va_list` is not represented in MIR at all in this case, so the registers from the call site are untouched by the shim and can be read by the actual implementation. That just does not seem like a solid implementation. Also, intuitively, why would c-variadic function, primarily needed for FFI, need to be used with `dyn` objects at all? We can revisit this limitation if a need arises. r? `@workingjubilee`
2025-09-15Bump rustfix 0.8.1 -> 0.8.7Jynn Nelson-2/+2
This commit can be replicated by running `cargo update -p rustfix --precise 0.8.7 && x test ui --bless`. --- The reasons this affects UI tests is as follows: - The UI test suite runs rustc with `-Z deduplicate-diagnostics=no --error-format=json`, which means that rustc emits multiple errors containing identical suggestions. That caused the weird-looking code that had multiple `X: Copy` suggestions. - Those suggestions are interpreted not by rustc itself, but by the `rustfix` library, maintained by cargo but published as a separate crates.io library and used by compiletest. - Sometime between rustfix 0.8.1 and 0.8.7 (probably in cargo 14747, but it's hard to tell because rustfix's versioning doesn't match cargo's), rustfix got smarter and stopped applying duplicate suggestions. Update rustfix to match cargo's behavior. Ideally, we would always share a version of rustfix between cargo and rustc (perhaps with a path dependency?), to make sure we are testing the behavior we ship. But for now, just manually update it to match. Note that the latest version of rustfix published to crates.io is 0.9.1, not 0.8.7. But 0.9.1 is not the version used in cargo, which is 0.9.3. Rather than trying to match versions exactly, I just updated rustfix to the latest in the 0.8 branch.
2025-09-13Rollup merge of #145896 - Oneirical:uncountable-integer-10, r=jieyouxuJacob Pratt-0/+17
Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#3 of Batch #2] Part of rust-lang/rust#133895 Methodology: 1. Refer to the previously written `tests/ui/SUMMARY.md` 2. Find an appropriate category for the test, using the original issue thread and the test contents. 3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers) 4. Rename the tests to make their purpose clearer Inspired by the methodology that `@Kivooeo` was using. r? `@jieyouxu`
2025-09-12Add test batch 3Oneirical-0/+17
2025-09-11c-variadic: allow trait methods to be c-variadicFolkert de Vries-8/+16
but a C-variadic method makes a trait dyn-incompatible. That is because methods from dyn traits, when cast to a function pointer, create a shim. That shim can't really forward the c-variadic arguments.
2025-09-11c-variadic: allow inherent methods to be c-variadicFolkert de Vries-10/+20
2025-09-10Rollup merge of #146342 - folkertdev:c-variadic-errors-take-3, r=workingjubileeMatthias Krüger-64/+111
Improve C-variadic error messages: part 2 tracking issue: https://github.com/rust-lang/rust/issues/44930 a reimplementation of https://github.com/rust-lang/rust/pull/143546 that builds on https://github.com/rust-lang/rust/pull/146165. This PR - disallows coroutines (e.g. `async fn`) from having a `...` argument - disallows associated functions (both in traits and standard impl blocks) from having a `...` argument - splits up a generic "ill-formed C-variadic function" into specific errors about using an incorrect ABI, not specifying an ABI, or missing the unsafe keyword C-variadic coroutines probably don't make sense? C-variadic functions are for FFI purposes, combining that with async functions seems weird. For associated functions, we're just cutting scope. It's probably fine, but it's probably better to explicitly allow it. So for now, at least give a more targeted error message. Made to be reviewed commit-by-commit. cc `@workingjubilee` r? compiler
2025-09-09c-variadic: reject functions with unsupported extern ABIFolkert de Vries-31/+48
2025-09-09c-variadic: reject non-unsafe functionsFolkert de Vries-12/+42
2025-09-09Rollup merge of #145463 - jieyouxu:error-suffix, r=fmeaseMatthias Krüger-44/+304
Reject invalid literal suffixes in tuple indexing, tuple struct indexing, and struct field name position Tracking issue: rust-lang/rust#60210 Closes rust-lang/rust#60210 ## Summary Bump the ["suffixes on a tuple index are invalid" non-lint pseudo future-incompatibility warning (#60210)][issue-60210][^non-lint] to a **hard error** across all editions, rejecting the remaining carve outs from accidentally accepted invalid suffixes since Rust **1.27**. - We accidentally accepted invalid suffixes in tuple indexing positions in Rust **1.27**. Originally reported at https://github.com/rust-lang/rust/issues/59418. - We tried to hard reject all invalid suffixes in https://github.com/rust-lang/rust/pull/59421, but unfortunately it turns out there were proc macros accidentally relying on it: https://github.com/rust-lang/rust/issues/60138. - We temporarily accepted `{i,u}{32,size}` in https://github.com/rust-lang/rust/pull/60186 (the "*carve outs*") to mitigate *immediate* ecosystem impact, but it came with an FCW warning indicating that we wanted to reject it after a few Rust releases. - Now (1.89.0) is a few Rust releases later (1.35.0), thus I'm proposing to **also reject the carve outs**. - `std::mem::offset_of!` stabilized in Rust **1.77.0** happens to use the same "don't expect suffix" code path which has the carve outs, so it also accepted the carve out suffixes. I'm proposing to **reject this case as well**. ## What specifically breaks? Code that still relied on invalid `{i,u}{32,size}` suffixes being temporarily accepted by rust-lang/rust#60186 as an ecosystem impact mitigation measure (cf. rust-lang/rust#60138). Specifically, the following cases (particularly the construction of these forms in proc macros like reported in rust-lang/rust#60138): ### Position 1: Invalid `{i,u}{32,size}` suffixes in tuple indexing ```rs fn main() { let _x = (42,).0invalid; // Already error, already rejected by #59421 let _x = (42,).0i8; // Already error, not one of the #60186 carve outs. let _x = (42,).0usize; // warning: suffixes on a tuple index are invalid } ``` ### Position 2: Invalid `{i,u}{32,size}` suffixes in tuple struct indexing ```rs fn main() { struct X(i32); let _x = X(42); let _x = _x.0invalid; // Already error, already rejected by #59421 let _x = _x.0i8; // Already error, not one of the #60186 carve outs. let _x = _x.0usize; // warning: suffixes on a tuple index are invalid } ``` ### Position 3: Invalid `{i,u}{32,size}` suffixes in numeric struct field names ```rs fn main() { struct X(i32, i32, i32); let _x = X(1, 2, 3); let _y = X { 0usize: 42, 1: 42, 2: 42 }; // warning: suffixes on a tuple index are invalid match _x { X { 0usize: 1, 1: 2, 2: 3 } => todo!(), // warning: suffixes on a tuple index are invalid _ => {} } } ``` ### Position 4: Invalid `{i,u}{32,size}` suffixes in `std::mem::offset_of!` While investigating the warning, unfortunately I noticed `std::mem::offset_of!` also happens to use the "expect no suffix" code path which had the carve outs. So this was accepted since Rust **1.77.0** with the same FCW: ```rs fn main() { #[repr(C)] pub struct Struct<T>(u8, T); assert_eq!(std::mem::offset_of!(Struct<u32>, 0usize), 0); //~^ WARN suffixes on a tuple index are invalid } ``` ### The above forms in proc macros For instance, constructions like (see tracking issue rust-lang/rust#60210): ```rs let i = 0; quote! { foo.$i } ``` where the user needs to actually write ```rs let i = syn::Index::from(0); quote! { foo.$i } ``` ### Crater results Conducted a crater run (https://github.com/rust-lang/rust/pull/145463#issuecomment-3194920383). - https://github.com/AmlingPalantir/r4/tree/256af3c72f094b298cd442097ef7c571d8001f29: genuine regression; "invalid suffix `usize`" in derive macro. Has a ton of other build warnings, last updated 6 years ago. - Exactly the kind of intended breakage. Minimized down to https://github.com/AmlingPalantir/r4/blob/256af3c72f094b298cd442097ef7c571d8001f29/validates_derive/src/lib.rs#L71-L75, where when interpolation uses `quote`'s `ToTokens` on a `usize` index (i.e. on tuple struct `Tup(())`), the generated suffix becomes `.0usize` (cf. Position 2). - Notified crate author of breakage in https://github.com/AmlingPalantir/r4/issues/1. - Other failures are unrelated or spurious. ## Review remarks - Commits 1-3 expands the test coverage to better reflect the current situation before doing any functional changes. - Commit 4 is an intentional **breaking change**. We bump the non-lint "suffixes on a tuple index are invalid" warning into a hard error. Thus, this will need a crater run and a T-lang FCP. ## Tasks - [x] Run crater to check if anyone is still relying on this being not a hard error. Determine degree of ecosystem breakage. - [x] If degree of breakage seems acceptable, draft nomination report for T-lang for FCP. - [x] Determine hard error on Edition 2024+, or on all editions. ## Accompanying Reference update - https://github.com/rust-lang/reference/pull/1966 [^non-lint]: The FCW was implemented as a *non-lint* warning (meaning it has no associated lint name, and you can't `#![deny(..)]` it) because spans coming from proc macros could not be distinguished from regular field access. This warning was also intentionally impossible to silence. See https://github.com/rust-lang/rust/pull/60186#issuecomment-485581694. [issue-60210]: https://github.com/rust-lang/rust/issues/60210
2025-09-08c-variadic: reject non-extern functionsFolkert de Vries-4/+4
2025-09-08disallow c-variadic associated functions (for now)Folkert de Vries-18/+18
there is no reason this should not work, really, we're just cutting some scope for now
2025-09-08Auto merge of #146165 - folkertdev:c-variadic-errors-take-2, r=lcnrbors-67/+36
improve c-variadic error reporting tracking issue: https://github.com/rust-lang/rust/issues/44930 The parts of https://github.com/rust-lang/rust/pull/143546 that don't require any particular knowledge about c-variadic functions. This prepares the way for rejecting c-variadic functions that are also coroutines, safe functions, or associated functions.
2025-09-05Auto merge of #146044 - estebank:issue-88727, r=chenyukangbors-7/+270
Suggest parentheses when `match` or `if` expression in binop is parsed as statement ``` error[E0308]: mismatched types --> $DIR/expr-as-stmt.rs:81:5 | LL | match () { _ => true } && match () { _ => true }; | ^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `bool` | help: parentheses are required to parse this as an expression | LL | (match () { _ => true }) && match () { _ => true }; | + + ``` Address the common case from rust-lang/rust#88727. The original parse error is still outstanding, but the cases brought up in the thread are resolved.
2025-09-03simplify `check_c_variadic_type`Folkert de Vries-67/+36
2025-09-02Rollup merge of #144066 - RalfJung:extern-c-variadics, r=workingjubileeGuillaume Gomez-42/+42
stabilize c-style varargs for sysv64, win64, efiapi, aapcs This has been split up so the PR now only contains the extended_varargs_abi_support stabilization; "system" has been moved to https://github.com/rust-lang/rust/pull/145954. **Previous (combined) PR description:** This stabilizes extern block declarations of variadic functions with the system, sysv64, win64, efiapi, aapcs ABIs. This corresponds to the extended_varargs_abi_support and extern_system_varargs feature gates. The feature gates were split up since it seemed like there might be further discussion needed for what exactly "system" ABI variadic functions should do, but a [consensus](https://github.com/rust-lang/rust/issues/136946#issuecomment-2967847553) has meanwhile been reached: they shall behave like "C" functions. IOW, the ABI of a "system" function is (bold part is new in this PR): - "stdcall" for win32 targets **for non-variadic functions** - "C" for everything else This had been previously stabilized *without FCP* in https://github.com/rust-lang/rust/pull/116161, which got reverted in https://github.com/rust-lang/rust/pull/136897. There was also a "fun" race condition involved with the system ABI being [added](https://github.com/rust-lang/rust/pull/119587) to the list of variadic-supporting ABIs between the creation and merge of rust-lang/rust#116161. There was a question raised [here](https://github.com/rust-lang/rust/pull/116161#issuecomment-1983829513) whether t-lang even needs to be involved for a change like this. Not sure if that has meanwhile been clarified? The behavior of the "system" ABI (a Rust-specific ABI) definitely feels like t-lang territory to me. Fixes rust-lang/rust#100189 Cc `@rust-lang/lang` # Stabilization report > ## General design > ### What is the RFC for this feature and what changes have occurred to the user-facing design since the RFC was finalized? AFAIK there is no RFC. The tracking issues are - https://github.com/rust-lang/rust/issues/100189 - https://github.com/rust-lang/rust/issues/136946 > ### What behavior are we committing to that has been controversial? Summarize the major arguments pro/con. The only controversial point is whether "system" ABI functions should support variadics. - Pro: This allows crates like windows-rs to consistently use "system", see e.g. https://github.com/microsoft/windows-rs/issues/3626. - Cons: `@workingjubilee` had some implementation concerns, but I think those have been [resolved](https://github.com/rust-lang/rust/issues/136946#issuecomment-2967847553). EDIT: turns out Jubilee still has concerns (she mentioned that in a DM); I'll let her express those. Note that "system" is already a magic ABI we introduced to "do the right thing". This just makes it do the right thing in more cases. In particular, it means that on Windows one can almost always just do ```rust extern "system" { // put all the things here } ``` and it'll do the right thing, rather than having to split imports into non-varargs and varargs, with the varargs in a separate `extern "C"` block (and risking accidentally putting a non-vararg there). (I am saying "almost" always because some Windows API functions actually use cdecl, not stdcall, on x86. Those of course need to go in `extern "C"` blocks.) > ### Are there extensions to this feature that remain unstable? How do we know that we are not accidentally committing to those? Actually defining variadic functions in Rust remains unstable, under the [c_variadic feature gate](https://github.com/rust-lang/rust/issues/44930). > ## Has a Call for Testing period been conducted? If so, what feedback was received? > > Does any OSS nightly users use this feature? For instance, a useful indication might be "search <grep.app> for `#![feature(FEATURE_NAME)]` and had `N` results". There was no call for testing. A search brings up https://github.com/rust-osdev/uefi-rs/blob/main/uefi-raw/src/table/boot.rs using this for "efiapi". This doesn't seem widely used, but it is an "obvious" gap in our support for c-variadics. > ## Implementation quality All rustc does here is forward the ABI to LLVM so there's lot a lot to say here... > ### Summarize the major parts of the implementation and provide links into the code (or to PRs) > > An example for async closures: <https://rustc-dev-guide.rust-lang.org/coroutine-closures.html>. The check for allowed variadic ABIs is [here](https://github.com/rust-lang/rust/blob/9c870d30e2d6434c9e9a004b450c5ccffdf3d844/compiler/rustc_hir_analysis/src/lib.rs#L109-L126). The special handling of "system" is [here](https://github.com/rust-lang/rust/blob/c24914ec8329b22ec7bcaa6ab534a784b2bd8ab9/compiler/rustc_target/src/spec/abi_map.rs#L82-L85). > ### Summarize existing test coverage of this feature > > Consider what the "edges" of this feature are. We're particularly interested in seeing tests that assure us about exactly what nearby things we're not stabilizing. > > Within each test, include a comment at the top describing the purpose of the test and what set of invariants it intends to demonstrate. This is a great help to those reviewing the tests at stabilization time. > > - What does the test coverage landscape for this feature look like? > - Tests for compiler errors when you use the feature wrongly or make mistakes? > - Tests for the feature itself: > - Limits of the feature (so failing compilation) > - Exercises of edge cases of the feature > - Tests that checks the feature works as expected (where applicable, `//@ run-pass`). > - Are there any intentional gaps in test coverage? > > Link to test folders or individual tests (ui/codegen/assembly/run-make tests, etc.). Prior PRs add a codegen test for all ABIs and tests actually calling extern variadic functions for sysv64 and win64: - https://github.com/rust-lang/rust/pull/144359 - https://github.com/rust-lang/rust/pull/144379 We don't have a way of executing uefi target code in the test suite, so it's unclear how to fully test efiapi. aapcs could probably be done? (But note that we have hardly an such actually-calling-functions tests for ABI things, we almost entirely rely on codegen tests.) The test ensuring that we do *not* stabilize *defining* c-variadic functions is `tests/ui/feature-gates/feature-gate-c_variadic.rs`. > ### What outstanding bugs in the issue tracker involve this feature? Are they stabilization-blocking? None that I am aware of. > ### What FIXMEs are still in the code for that feature and why is it ok to leave them there? None that I am aware of. > ### Summarize contributors to the feature by name for recognition and assuredness that people involved in the feature agree with stabilization `@Soveu` added sysv64, win64, efiapi, aapcs to the list of ABIs that allow variadics, `@beepster4096` added system. `@workingjubilee` recently refactored the ABI handling in the compiler, also affecting this feature. > ### Which tools need to be adjusted to support this feature. Has this work been done? > > Consider rustdoc, clippy, rust-analyzer, rustfmt, rustup, docs.rs. Maybe RA needs to be taught about the new allowed ABIs? No idea how precisely they mirror what exactly rustc accepts and rejects here. > ## Type system and execution rules > ### What compilation-time checks are done that are needed to prevent undefined behavior? > > (Be sure to link to tests demonstrating that these tests are being done.) Nothing new here, this just expands the existing support for calling variadic functions to more ABIs. > ### Does the feature's implementation need checks to prevent UB or is it sound by default and needs opt in in places to perform the dangerous/unsafe operations? If it is not sound by default, what is the rationale? Nothing new here, this just expands the existing support for calling variadic functions to more ABIs. > ### Can users use this feature to introduce undefined behavior, or use this feature to break the abstraction of Rust and expose the underlying assembly-level implementation? (Describe.) Nothing new here, this just expands the existing support for calling variadic functions to more ABIs. > ### What updates are needed to the reference/specification? (link to PRs when they exist) - https://github.com/rust-lang/reference/pull/1936 > ## Common interactions > ### Does this feature introduce new expressions and can they produce temporaries? What are the lifetimes of those temporaries? No. > ### What other unstable features may be exposed by this feature? None.
2025-09-02stabilize extended_varargs_abi_supportRalf Jung-42/+42
2025-09-02Suggest parentheses around if-expressionsEsteban Küber-2/+177
``` error[E0308]: mismatched types --> $DIR/expr-as-stmt-2.rs:15:15 | LL | if true { true } else { false } && true; | ----------^^^^----------------- | | | | | expected `()`, found `bool` | expected this to be `()` | help: parentheses are required to parse this as an expression | LL | (if true { true } else { false }) && true; | + + ```
2025-08-31More targeted parentheses suggestion for match statement intended as expressionEsteban Küber-7/+88
``` error[E0308]: mismatched types --> $DIR/expr-as-stmt.rs:69:5 | LL | match () { () => 1 } + match () { () => 1 } | ^^^^^^^^^^^^^^^^^^^^ expected `()`, found integer | help: parentheses are required to parse this as an expression | LL | (match () { () => 1 }) + match () { () => 1 } | + + ```
2025-08-31Provide suggestion when encountering `match () { () => 1 } + match () { () ↵Esteban Küber-3/+10
=> 1 }` ``` error[E0308]: mismatched types --> $DIR/expr-as-stmt.rs:69:5 | LL | match () { () => 1 } + match () { () => 1 } | ^^^^^^^^^^^^^^^^^^^^ expected `()`, found integer | help: consider using a semicolon here | LL | match () { () => 1 }; + match () { () => 1 } | + help: alternatively, parentheses are required to parse this as an expression | LL | (match () { () => 1 }) + match () { () => 1 } | + + ``` Parentheses are needed for the `match` to be unambiguously parsed as an expression and not a statement when chaining with binops that are also unops.
2025-08-29Rollup merge of #145675 - Oneirical:uncountable-integer-8, r=jieyouxuMatthias Krüger-0/+7
Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#1 of Batch #2] Part of rust-lang/rust#133895 Methodology: 1. Refer to the previously written `tests/ui/SUMMARY.md` 2. Find an appropriate category for the test, using the original issue thread and the test contents. 3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers) 4. Rename the tests to make their purpose clearer Inspired by the methodology that `@Kivooeo` was using. r? `@jieyouxu`
2025-08-28Update uitest stderrJonathan Brouwer-50/+4
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-28Add another case to the bad-lit-suffixes testJonathan Brouwer-1/+23
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-28Rollup merge of #144864 - Muscraft:no-source-fixes, r=jieyouxuStuart Cook-0/+2
No source fixes This PR started as a fix for a rendering bug that [got noticed in #143661](https://github.com/rust-lang/rust/pull/143661#discussion_r2199109530), but turned into a fix for any rendering bugs related to files with no source. - Don't add an end column separator after a file with no source - Add column separator before secondary messages with no source - Render continuation between no source labels Before ``` error[E0423]: expected function, tuple struct or tuple variant, found struct `std::collections::HashMap` ╭▸ $DIR/multi-suggestion.rs:17:13 │ LL │ let _ = std::collections::HashMap(); │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━ ╭▸ $SRC_DIR/std/src/collections/hash/map.rs:LL:COL │ ╰ note: `std::collections::HashMap` defined here ╰╴ note: constructor is not visible here due to private fields ╭▸ $SRC_DIR/alloc/src/boxed.rs:LL:COL │ ╰ note: private field │ ╰ note: private field ``` After ``` error[E0423]: expected function, tuple struct or tuple variant, found struct `std::collections::HashMap` ╭▸ $DIR/multi-suggestion.rs:17:13 │ LL │ let _ = std::collections::HashMap(); │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━ ╰╴ ╭▸ $SRC_DIR/std/src/collections/hash/map.rs:LL:COL │ ╰ note: `std::collections::HashMap` defined here note: constructor is not visible here due to private fields ╭▸ $SRC_DIR/alloc/src/boxed.rs:LL:COL │ ├ note: private field │ ╰ note: private field ``` Note: This PR also makes it so `rustc` and `annotate-snippets` match in these cases
2025-08-27Changes to the uitestsJonathan Brouwer-9/+35
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-27Add test batch 1Oneirical-0/+7
2025-08-26fix: Add col separator before secondary messages with no sourceScott Schafer-0/+2
2025-08-22Rollup merge of #144897 - fee1-dead-contrib:raw_lifetimes_printing, r=fmeaseJacob Pratt-4/+4
print raw lifetime idents with r# This replaces rust-lang/rust#143185 and fixes rust-lang/rust#143150 cc ``@fmease``
2025-08-22Rollup merge of #137396 - compiler-errors:param-default, r=fmeaseJacob Pratt-0/+19
Recover `param: Ty = EXPR` Fixes #137310 Pretty basic recovery here, but better than giving an unexpected token error.
2025-08-22Recover param: Ty = EXPRMichael Goulet-0/+19
2025-08-22Updated uitests for new parserJonathan Brouwer-34/+88
2025-08-22address review commentsDeadbeef-4/+4
2025-08-22don't print invalid labels with `r#`Deadbeef-2/+2
2025-08-20Rollup merge of #140794 - karolzwolak:allow-unused-doc-65464, r=davidtwcoJacob Pratt-3/+3
mention lint group in default level lint note ### Summary This PR updates lint diagnostics so that default-level notes now mention the lint group they belong to, if any. Fixes: rust-lang/rust#65464. ### Example ```rust fn main() { let x = 5; } ``` Before: ``` = note: `#[warn(unused_variables)]` on by default ``` After: ``` = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default ``` ### Unchanged Cases Messages remain the same when the lint level is explicitly set, e.g.: * Attribute on the lint `#[warn(unused_variables)]`: ``` note: the lint level is defined here LL | #[warn(unused_variables)] | ^^^^^^^^^^^^^^^^ ``` * Attribute on the group `#[warn(unused)]:`: ``` = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` ``` * CLI option `-W unused`: ``` = note: `-W unused-variables` implied by `-W unused` = help: to override `-W unused` add `#[allow(unused_variables)]` ``` * CLI option `-W unused-variables`: ``` = note: requested on the command line with `-W unused-variables` ```
2025-08-19bless tests with new lint messagesKarol Zwolak-3/+3
2025-08-19Rollup merge of #145474 - fmease:paren-use-bounds-fix, r=fee1-dead许杰友 Jieyou Xu (Joe)-6/+6
Properly recover from parenthesized use-bounds (precise capturing lists) plus small cleanups Fixes https://github.com/rust-lang/rust/issues/145470. First commit fixes the issue, second one performs some desperately needed cleanups. The fix shouldn't be a breaking change because IINM the parser always ensures that all brackets are balanced (via a buffer of brackets). Meaning even though we used to accept `(use<>` as a valid precise capturing list, it was guaranteed that we would fail in the end.
2025-08-18Turn invalid index suffixes into hard errorsJieyou Xu-123/+82
2025-08-18Add test coverage for proc-macro invalid tup index suffixesJieyou Xu-0/+98
2025-08-18Expand `tuple-index-suffix` test coverageJieyou Xu-19/+222
Actually, the accidentally accepted invalid suffixes also include tuple struct indexing positions, struct numeral field name positions. So before changing anything, first expand test coverage, so we can observe the effect of bumping the non-lint pseudo-FCW warning into a hard error.
2025-08-18Rename and move tuple index suffix regression testJieyou Xu-0/+0
To make it more obvious what it's testing. This is its own commit to make git blame easier.
2025-08-18Rollup merge of #145208 - joshtriplett:mbe-derive, r=petrochenkovStuart Cook-6/+139
Implement declarative (`macro_rules!`) derive macros (RFC 3698) This is a draft for review, and should not be merged yet. This is layered atop https://github.com/rust-lang/rust/pull/145153 , and has only two additional commits atop that. The first handles parsing and provides a test for various parse errors. The second implements expansion and handles application. This implements RFC 3698, "Declarative (`macro_rules!`) derive macros". Tracking issue: https://github.com/rust-lang/rust/issues/143549 This has one remaining issue, which I could use some help debugging: in `tests/ui/macros/macro-rules-derive-error.rs`, the diagnostics for `derive(fn_only)` (for a `fn_only` with no `derive` rules) and `derive(ForwardReferencedDerive)` both get emitted twice, as a duplicate diagnostic. From what I can tell via adding some debugging code, `unresolved_macro_suggestions` is getting called twice from `finalize_macro_resolutions` for each of them, because `self.single_segment_macro_resolutions` has two entries for the macro, with two different `parent_scope` values. I'm not clear on why that happened; it doesn't happen with the equivalent code using attrs. I'd welcome any suggestions for fixing this.
2025-08-16Clean up parsers related to generic boundsLeón Orell Valerian Liehr-6/+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`.