Commit Graph

906 Commits

Author SHA1 Message Date
b1yd 92194469a0 fix issue-144595 2026-05-26 21:35:25 +08:00
bors 9eb3be26b4 Auto merge of #156720 - JonathanBrouwer:rollup-vArjiS4, r=JonathanBrouwer
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#156709 (stdarch subtree update)
 - rust-lang/rust#155006 (stabilize `feature(cfg_target_has_atomic_equal_alignment)`)
 - rust-lang/rust#156444 (Implement `OsStr::split_at`)
 - rust-lang/rust#156582 (Allow `global_asm!` in statement positions)
 - rust-lang/rust#156661 (Remove `UncheckedIterator`)
 - rust-lang/rust#152367 (Derives `Copy` for `ffi::FromBytesUntilNulError`)
 - rust-lang/rust#156443 (Fix invalid suggestion for parenthesized break)
 - rust-lang/rust#156606 (Add pext/pdep as aliases for extract_bits/deposit_bits)
 - rust-lang/rust#156630 (Replace `println!` with `assert!` in HashMap documentation examples)
 - rust-lang/rust#156644 (Widen the result of `widening_mul`.)
 - rust-lang/rust#156653 (Update `sysinfo` version to `0.39.2`)
 - rust-lang/rust#156697 (Add diagnostic items for IoBufReader and StdinLock)
 - rust-lang/rust#156704 (reduce usage of `box_patterns` in tests)
2026-05-18 18:00:20 +00:00
Jonathan Brouwer e7d5c0a9ef Rollup merge of #156443 - el-ev:fix-break-sugg, r=ShoyuVanilla
Fix invalid suggestion for parenthesized break

Resolves rust-lang/rust#156383

The old code incorrectly assumed `e.span` started exactly at the beginning of `break`. Fixed by locating the exact start position of `break`.
2026-05-18 17:07:09 +02:00
Jacob Pratt 9a88f9f74f Rollup merge of #156664 - ManiSalahmand:fix-doc-comment-generic-tuple, r=petrochenkov
Avoid const generic recovery after doc comment in type

Fixes rust-lang/rust#122463.

When parsing a generic argument, rustc may snapshot the parser state and retry a failed type parse as an unbraced const generic argument. For `Vec<(/// doc
f32, f32)>`, that recovery produces a misleading follow-up E0747 after the useful “expected type, found doc comment” diagnostic.

This skips that const-generic recovery path when type parsing stopped at a doc comment, and adds a regression test for the compiler diagnostic.
2026-05-18 13:52:56 +02:00
Mani Salahmand 3cc1e44225 Add issue reference to regression test 2026-05-17 23:54:13 +02:00
Jonathan Brouwer 4bb85516e8 Rollup merge of #156376 - euclio:foreign-escapes, r=mu001999
suggest hex escapes for C-style escapes

Fixes rust-lang/rust#148884.
2026-05-17 15:52:38 +02:00
Mani Salahmand 0564168895 Avoid const generic recovery after doc comment in type 2026-05-17 14:32:47 +02:00
Andy Russell e5998316eb suggest hex escapes for C-style escapes 2026-05-16 20:23:53 -04:00
Esteban Küber 701e4942ed Remove a bunch of stray backticks
Thanks VSCode!
2026-05-13 02:40:58 +00:00
Iris Shi 2f90236a4d Fix invalid suggestion for parenthesized break 2026-05-11 16:58:25 +08:00
Takayuki Maeda e2b66ef351 add regression test for unicode dotdotdot rest pattern 2026-05-09 01:27:23 +09:00
Oli Scherer 11d88ee42b Rip out rustc_layout_scalar_valid_range_* attribute support 2026-05-03 10:59:52 +02:00
Jonathan Brouwer 8ee783610d Rollup merge of #154325 - WeiTheShinobi:tweak-let-else-output, r=davidtwco
Tweak irrefutable let else warning output

Fixes https://github.com/rust-lang/rust/issues/153454

Greeting!
This PR tweak diagnostic output for `irrefutable-let-else` patterns and adds a check for `let a = Some(b) else {...}`
Thanks for the review!

```
help: consider using `let Some(name) = case` to match on a specific variant
   |
LL -     let name = Some(case) else {
LL +     let Some(name) = case else {
   |
```
2026-04-28 20:24:30 +02:00
Zalathar 9ceed255b5 Avoid improper spans when ... or ..= is recovered from non-ASCII
This avoids an ICE due to indexing into the middle of a multi-byte character.
2026-04-26 21:41:46 +10:00
Zalathar f107bb85a2 Regression test for improper spans in inclusive-range suggestions 2026-04-26 21:36:51 +10:00
Jacob Pratt 1230f74ad5 Rollup merge of #155698 - fmease:no-struct-pat-tuple-index-shorthand, r=mu001999
Syntactically reject tuple index shorthands in struct patterns to fix a correctness regression

Split out of PR rust-lang/rust#154492. This fixes a correctness regression introduced in PR rust-lang/rust#81235 from 2021. Crater was run in my other PR and didn't report any real regressions (https://github.com/rust-lang/rust/pull/154492#issuecomment-4187544786); a rerun has been issued for a few spurious builds (https://github.com/rust-lang/rust/pull/154492#issuecomment-4237077272) but I'm certain it won't find anything either.

This is a theoretical breaking change that doesn't need any T-lang input IMHO since it's such a minute, niche and crystal clear bug that's not worth bothering them with (such a decision is not unprecedented). I'm adding it to the compatibility section of the release notes as is customary.

The Reference doesn't need updating since it didn't adopt this bug and thus accurately describes this part of the grammar as it used to be before 2021-02-23 and as it's meant to be.

The majority of the diff is doc comment additions & necessary UI test restructurings.
2026-04-24 02:42:52 -04:00
León Orell Valerian Liehr 07d015e566 Syntactically reject tuple index shorthands in struct patterns to fix a correctness regression 2026-04-23 22:28:00 +02:00
Guillaume Gomez 8c3864b6cc Rollup merge of #155561 - cijiugechu:fix/need-type-info-underscore-wording, r=adwinwhite
Use singular wording for single _ placeholders in type suggestions

While looking this part of code, I noticed this FIXME and fixed it :)
2026-04-23 14:42:48 +02:00
Oli Scherer 24b1634898 BinOpAssign always returns unit 2026-04-22 12:27:03 +02:00
Eric Huss 69dae5941e Update shebang reference rule names
This updates the rule names for shebang which were changed in
rust-lang/reference#2192 and rust-lang/reference#2199.
2026-04-20 15:08:37 -07:00
cijiugechu ffcbfc1cf4 Use singular wording for single _ placeholders in type suggestions 2026-04-20 22:21:51 +08:00
Kao-Wei Yeh 8591f0f230 Tweak irrefutable let else warning output, add new suggestion 2026-04-18 13:03:47 +08:00
Jonathan Brouwer c729f33e46 Rollup merge of #155078 - cijiugechu:fix/where-clause-trailing-attrs, r=petrochenkov
Reject dangling attributes in where clauses

Report `attribute without where predicates` for trailing outer attributes in where clauses.

Closes rust-lang/rust#155073 .
2026-04-10 18:38:12 +02:00
cijiugechu 3c6cf27ae4 Reject dangling attributes in where clauses 2026-04-10 21:45:26 +08:00
Jonathan Brouwer 65745a1b95 Revert #152369 because of multiple regressions
The regressions are documented in the PR comments.
This reverts commit 2972b5e, reversing changes made to f908263.
2026-04-09 18:53:59 +02:00
Scott Schafer 63ed113d84 chore: Update annotate-snippets to 0.12.15 2026-04-06 14:48:52 -06:00
Jonathan Brouwer 77a5cb0194 Rollup merge of #154561 - FranciscoTGouveia:typo-detection-after-visibility, r=TaKO8Ki
Suggest similar keyword when visibility is not followed by an item

Fixes rust-lang/rust#153353.

I would appreciate feedback on the following:
- I inlined [`find_similar_kw`](https://github.com/rust-lang/rust/blob/cd14b73b4a41542d921f59e362a5b5005fa4f2ef/compiler/rustc_parse/src/parser/diagnostics.rs#L218-L224) instead of changing its visibility to `pub(super)`. I am happy to switch if it is preferred;
- I didn't add a comment to the new test. Although the rustc-dev-guide specifies that a [comment should be added](https://rustc-dev-guide.rust-lang.org/tests/adding.html#comment-explaining-what-the-test-is-about) to every new test, this is not common in `tests/ui/parser/misspelled_keywords/` and the test seems self-explanatory. Let me know if you would like me to add a comment;

Thank you in advance for your time and input!
2026-04-06 08:27:50 +02:00
Edvin Bryntesson bd864efa70 bless tests and tidy
also removes E0452 and splits
`tests/rustdoc-ui/lints/renamed-lint-still-applies` into 2 tests

this is because of delayed warn lint being lost on compiler aborting on
error
2026-04-03 11:08:11 +02:00
Jonathan Brouwer 4b2aa6d93b Rollup merge of #154527 - fmease:more-soft-gates, r=nnethercote
Emit pre-expansion feature gate warnings for negative impls and specialization

Follow up to rust-lang/rust#154475; part of rust-lang/rust#154045.

This shouldn't need any extra input from T-compiler or T-lang since it's legitimized by [MCP 535](https://github.com/rust-lang/compiler-team/issues/535).

However, I have a feeling that negative impls & specialization behind "`#[cfg(feature = "nightly")]`" are more prevalent in the ecosystem compared to e.g., auto traits & box patterns, so these new warnings will probably hit a bunch of users. In any case, it's only a warning for now not an error so e.g., running crater "in deny mode" or nominating for a T-lang meeting discussion would be disproportionate (esp. since T-lang [has confirmed in the past](https://github.com/rust-lang/rust/pull/116393#issuecomment-1745571299) that this is a T-compiler matter).
2026-04-02 22:13:50 +02:00
bors 009a6c1e8b Auto merge of #154308 - ShoyuVanilla:undo-fudge-iv, r=jieyouxu
Revert #151380 and #153869

cc https://rust-lang.zulipchat.com/#narrow/channel/474880-t-compiler.2Fbackports/topic/.23153869.3A.20beta-nominated/with/581306395

r? ghost
2026-04-02 00:09:59 +00:00
León Orell Valerian Liehr 92fbfae16b Emit pre-expansion feature gate warning for item modifier default 2026-04-01 17:01:59 +02:00
Francisco Gouveia 7f53271474 Suggest similar keyword when visibility is not followed by an item 2026-03-29 21:16:08 +01:00
Guillaume Gomez c2fc360b96 Rollup merge of #154504 - cyrgani:structenum, r=Kivooeo
move many tests from `structs-enums` to `structs` or `enum`

This PR moves most of the tests in `ui/structs-enums` that are only about structs or only about enums to their respective directory, as a step towards removing `ui/structs-enums`.
Followup to rust-lang/rust#154131.
r? @Kivooeo
2026-03-29 00:06:53 +01:00
cyrgani 5bdde380cc move many tests from structs-enums to structs or enum 2026-03-28 12:38:35 +00:00
Ralf Jung 7881a31ccf Rollup merge of #152880 - JohnTitor:tweak-assoc-item-note, r=fmease
Tweak incorrect assoc item note

Fix rust-lang/rust#142797
r? @fmease
2026-03-28 13:15:48 +01:00
Yuki Okushi 531631c7ad Make messages more generic 2026-03-28 16:18:11 +09:00
yukang 16b9fddf00 Improve doc comment unicode guidance 2026-03-26 11:42:38 +08:00
Shoyu Vanilla d5bbeb978e Revert "Auto merge of #151380 - ShoyuVanilla:shallow-resolve-to-root-var, r=lcnr"
This reverts commit 75b9d89c68, reversing
changes made to 7bee525095.
2026-03-24 22:31:37 +09:00
Eric Huss ae3d87c2a8 Update shebang reference names
This updates the rule names for shebang which were changed in
https://github.com/rust-lang/reference/pull/2192 and
https://github.com/rust-lang/reference/pull/2199.
2026-03-23 14:28:42 -07:00
cyrgani 9b0be7857a allow incomplete_features in most UI tests 2026-03-21 20:10:07 +00:00
Esteban Küber 3b27a36601 Suggest appropriate spaces around = in let binding parse error 2026-03-20 19:45:29 +00:00
Esteban Küber 244322f0be Make : -> = typo suggestion verbose 2026-03-20 19:07:28 +00:00
Esteban Küber 87d8f5885b Provide more context on type errors in const context
- On `const` and `static` point at the type (like we do for let bindings)
- On fn calls, point at const parameter in fn definition
- On type, point at const parameter in type definition
- On array type lengths, explain that array length is always `usize`
- On enum variant discriminant, mention `repr`
2026-03-14 20:13:43 +00:00
cyrgani 9e97c57cc8 relocate several ui tests 2026-03-13 10:00:39 +00:00
Jonathan Brouwer cecc5e7cea Rollup merge of #153346 - WaffleLapkin:sometimes-test, r=jieyouxu
move never type tests to subdirectories and add some comments

This hopefully makes things a little bit clearer
2026-03-07 01:42:36 +01:00
Waffle Lapkin 05174fbcc5 tidy never type issue-* tests 2026-03-06 17:44:18 +01:00
Waffle Lapkin eef3c4db7b move never type tests to subdirectories and add some comments 2026-03-04 13:17:19 +01:00
Stuart Cook 70287b9bc2 Rollup merge of #153048 - ozankenangungor:fix-irrefutable-let-else-wording, r=Kivooeo
Improve irrefutable let-else lint wording

Update the `irrefutable_let_patterns` wording for let-else to better reflect that the `else` clause is unreachable when the LHS pattern always matches.

Closes rust-lang/rust#152938
2026-03-04 11:54:09 +11:00
Jonathan Brouwer 87bd517707 Rollup merge of #153034 - arferreira:fix-trivial-bound-diagnostic, r=Kivooeo
Remove unhelpful hint from trivial bound errors

The `= help: see issue #48214` hint on trivial bound errors isn't useful, most users hitting these errors aren't trying to use the `trivial_bounds` feature. The `disabled_nightly_features` call already handles suggesting the feature gate on nightly.

Closes rust-lang/rust#152872
2026-03-03 07:14:15 +01:00
Ozan Kenan Güngör a8d4eeef1b Improve irrefutable let-else lint wording 2026-03-03 03:39:56 +03:00