Commit graph

1011 commits

Author SHA1 Message Date
Jacob Pratt
656d4e8a96
Rollup merge of #150072 - Bryntet:parse_no_link, r=JonathanBrouwer
Port #[no_link] to use attribute parser

Adds `#[no_link]` to the attribute parser, as well as adds tests making sure to FCW warn on `field`, `arm`, and `macrodef `
2025-12-16 23:10:12 -05:00
Edvin Bryntesson
52bcaabdb8
Port #[no_link] to use attribute parser 2025-12-16 22:45:32 +01:00
Jonathan Brouwer
f108cd7232
Rollup merge of #149767 - reddevilmidzy:t11, r=Kivooeo
Tidying up tests/ui/issues 33 tests [4/N]

> [!NOTE]
> Intermediate commits are intended to help review, but will be squashed add comment commit prior to merge.

part of rust-lang/rust#133895

`tests/ui/compile-flags` split it into `tests/ui/compile-flags/invalid/` and `tests/ui/compile-flags/run-pass/`

r? Kivooeo
2025-12-16 20:21:07 +01:00
reddevilmidzy
1bd997a452 Cleaned up some tests
Split invalid-compile-flags into run-pass & invalid

Update tests/ui/README.md
2025-12-16 02:10:08 +09:00
Matthias Krüger
d7a18fc052
Rollup merge of #148490 - hkBst:dangling-ptr-lint-2, r=Urgau
dangling pointer from temp cleanup

Continuation of https://github.com/rust-lang/rust/pull/148348
r? `@Urgau`
2025-12-14 20:04:54 +01:00
Marijn Schouten
cab911449a dangling pointer from temp cleanup 2025-12-14 11:39:43 +00:00
Matthias Krüger
b826d06771
Rollup merge of #149791 - clubby789:cfg-bool-lints, r=jdonszelmann
Remove uses of `cfg({any()/all()})`

~~This implements the followup warning suggested in https://github.com/rust-lang/rfcs/pull/3695~~
~~Lint against an empty `cfg(any/all)`, suggest the boolean literal equivalents.~~
https://github.com/rust-lang/rust/pull/149791#issuecomment-3638624348

Tracking issue: https://github.com/rust-lang/rust/issues/131204
2025-12-12 12:19:09 +01:00
bors
5b150d238f Auto merge of #149645 - GuillaumeGomez:doc-attr-based, r=jdonszelmann,jonathanbrouwer
Port `doc` attributes to new attribute API

Part of https://github.com/rust-lang/rust/issues/131229.

This PR ports the `doc` attributes to the new attribute API. However, there are things that will need to be fixed in a follow-up:

* Some part of `cfg_old.rs` are likely unused now, so they should be removed.
* Not all error/lints are emitted at the same time anymore, making them kinda less useful considering that you need to run and fix rustc/rustdoc multiple times to get through all of them.
* For coherency with the other attribute errors, I didn't modify the default output too much, meaning that we have some new messages now. I'll likely come back to that to check if the previous ones were better in a case-by-case approach.
* `doc(test(attr(...)))` is handled in a horrifying manner currently. Until we can handle it correctly with the `Attribute` system, it'll remain that thing we're all very ashamed of. 😈
* A type in rustdoc got its size increased, I'll check the impact on performance. But in any case, I plan to improve it in a follow-up so should be "ok".
* Because of error reporting, some fields of `Doc` are suboptimal, like `inline` which instead of being an `Option` is a `ThinVec` because we report the error later on. Part of the things I'm not super happy about but can be postponed to future me.
* In `src/librustdoc/clean/cfg.rs`, the `pub(crate) fn parse(cfg: &MetaItemInner) -> Result<Cfg, InvalidCfgError> {` function should be removed once `cfg_trace` has been ported to new `cfg` API.
* Size of type `DocFragment` went from 32 to 48. Would be nice to get it back to 32.
* ``malformed `doc` attribute input`` wasn't meant for so many candidates, should be improved.
* See how many of the checks in `check_attr` we can move to attribute parsing
* Port target checking to be in the attribute parser completely
* Fix target checking for `doc(alias)` on fields & patterns

And finally, once this PR is merged, I plan to finally stabilize `doc_cfg` feature. :)

cc `@jdonszelmann`
r? `@JonathanBrouwer`
2025-12-11 21:08:19 +00:00
Jamie Hill-Daniel
c96ff2d429 Remove uses of cfg(any()/all()) 2025-12-10 23:41:19 +00:00
Guillaume Gomez
2bc2a0db69 For now, ignore target checking for doc attributes in attr_parsing 2025-12-10 20:18:42 +01:00
Jana Dönszelmann
1ef1ec13d8
bless the tests 2025-12-10 15:15:56 +01:00
Guillaume Gomez
4936973d49 Fix ui tests 2025-12-10 12:28:05 +01:00
reddevilmidzy
92f21a806d moved tests 2025-12-10 09:23:50 +09:00
Matthias Krüger
add772d3c4
Rollup merge of #149730 - SATVIKsynopsis:main, r=Kivooeo
lint: emit proper diagnostic for unsafe binders in improper_ctypes instead of ICE

Fixes rust-lang/rust#149719

This PR replaces the `todo!("FIXME(unsafe_binder)")` branch in the `improper_ctypes` lint with a proper diagnostic.

Previously, using an unsafe binder inside an extern `"C"` block caused an internal compiler error.
This fix now ensures that the compiler now emits a clear and stable error message explaining that types containing unsafe binders are not yet supported in FFI.

A new UI test `(unsafe-binder-basic.rs)` is included to ensure this behavior remains stable and prevent regressions.
2025-12-09 06:17:24 +01:00
SATVIKsynopsis
0f4ec28155 lint: treat unsafe binders in improper_ctypes instead of ICE
Replaced _binder with _
2025-12-08 18:51:59 +05:30
Jules Bertholet
43fa060c38
Expand lint note 2025-12-06 13:49:00 -05:00
Jules Bertholet
9e7200967e
Add note to lint message 2025-12-06 13:49:00 -05:00
Jules Bertholet
6b5da2f177
Don't warn when underscore is passed to macro 2025-12-06 13:49:00 -05:00
Jules Bertholet
234df83fe3
Add warn-by-default lint for visibility on const _ declarations
Add a warn-by-default `unused_visibility` lint for visibility qualifiers
on `const _` declarations - e.g. `pub const _: () = ();`.
These have no effect.
2025-12-06 13:48:58 -05:00
Matthias Krüger
5c9a4eed87
Rollup merge of #149544 - reddevilmidzy:where, r=fmease
Only apply `no_mangle_const_items`'s suggestion to plain const items

resolve: rust-lang/rust#149511
2025-12-04 09:22:11 +01:00
reddevilmidzy
2951d72219 Simplify and robustly compute suggestion span using
`vis_span.to(ident.span.shrink_to_lo())`
2025-12-04 11:01:40 +09:00
reddevilmidzy
6ce0f0ff91 Only apply no_mangle_const_items's suggestion to plain const items 2025-12-04 11:01:10 +09:00
Matthias Krüger
a2aa4f08da
Rollup merge of #149541 - WaffleLapkin:never-test, r=lcnr
Various never type test improvements

I want to make sure that the never type ui tests are actually sensible, and to do so I'm trying to clean them up. This mainly adds comments explaining test purposes and removes outdated stuff.

I imagine best reviewed commit-by-commit, I tried to write useful descriptions and group things into small commits.

cc `@lcnr` (I removed `fallback`/`nofallback` terminology in b5f82d4716d0d978b89034c902f88e2d449da636)
2025-12-03 13:05:15 +01:00
Matthias Krüger
02434fe718
Rollup merge of #148678 - xonx4l:EO412_replacement_with_EO425, r=Kivooeo
Merge E0412 into E0425

This PR merge E0412 into E0425  as both mean the same thing to users.

This fixes https://github.com/rust-lang/rust/issues/148558.
2025-12-02 22:02:30 +01:00
xonx4l
4b000cfacd Merge E0412 into E0425 2025-12-02 18:25:13 +00:00
Waffle Lapkin
98430c4d9d
remove unused features from some tests 2025-12-02 11:07:42 +01:00
Scott Schafer
b2b059c20b
chore: Update annotate-snippets to 0.12.10 2025-12-01 18:12:35 -07:00
bors
e6edf3ae53 Auto merge of #147498 - ferrocene:pvdrz/edition-range-gating, r=jieyouxu,fmease
Gate tests with the right edition

This PR guarantees that `./x test --test-args="--edition XXXX" ui` runs correctly with the 2015, 2018 and 2021 editions.

I don't expect this PR to hold up over time but it helps to submit further updates to the `//@ edition` directives of tests where we can use the new range syntax to have a more robust testing across different editions

r? `@fmease`

---

try-job: aarch64-gnu
try-job: aarch64-apple
try-job: x86_64-msvc-1
try-job: i686-msvc-1
try-job: x86_64-mingw-1
try-job: test-various
try-job: armhf-gnu
2025-11-27 22:37:05 +00:00
Christian Poveda
7ae2823bc6
Gate 2018 UI tests 2025-11-27 14:13:58 -05:00
Christian Poveda
b2ab7cf980
Gate 2015 UI tests 2025-11-27 11:19:00 -05:00
Sasha Pourcelot
2ab2090937 Port the #![windows_subsystem] attribute to the new attribute system 2025-11-27 00:17:48 +01:00
Ben Kimock
bef49a02ef Don't lint on derefs of null pointers to ZSTs 2025-11-24 21:45:28 -05:00
Ben Kimock
c0097978aa Make deref_nullptr deny by default instead of warn 2025-11-24 21:45:28 -05:00
bors
122cbd0438 Auto merge of #147804 - tmiasko:move-copy, r=cjgillot,saethlin
Turn moves into copies after copy propagation

Previously copy propagation presumed that there is further unspecified distinction between move operands and copy operands in assignments and propagated moves from assignments into terminators. This is inconsistent with current operational semantics.

Turn moves into copies after copy propagation to preserve existing behavior.

Fixes https://github.com/rust-lang/rust/issues/137936.
Fixes https://github.com/rust-lang/rust/issues/146423.

r? `@cjgillot`
2025-11-23 13:56:14 +00:00
bors
e0e204f3e9 Auto merge of #149096 - chenyukang:yukang-fix-unused-vars-148373, r=oli-obk
Skip unused variables warning for unreachable code

Fixes rust-lang/rust#148373

These warnings are not reported on stable branch, but are now reported on the beta.

I tried another solution to record whether a `local` is reachable in `find_dead_assignments`, but the code in this PR seems simpler.

r? `@cjgillot`
2025-11-23 04:14:38 +00:00
Matthias Krüger
cef578b3a9
Rollup merge of #149072 - chenyukang:yukang-fix-unused-148960, r=davidtwco
Fix the issue of unused assignment from MIR liveness checking

Fixes rust-lang/rust#148960
Fixes rust-lang/rust#148418

r? ``@davidtwco``

cc ``@cjgillot``

My first try on MIR related code, so it may not be the best fix.
2025-11-22 18:41:21 +01:00
Urgau
dc2a61eccd Add const_item_interior_mutations lint 2025-11-22 14:48:40 +01:00
yukang
2c6b1d3430 Skip unused variables warning for unreachable code 2025-11-21 08:48:45 +08:00
Tomasz Miąsko
6bd1a031ab Turn moves into copies after copy propagation
Previously copy propagation presumed that there is further unspecified
distinction between move operands and copy operands in assignments and
propagated moves from assignments into terminators. This is inconsistent
with current operational semantics.

Turn moves into copies after copy propagation to preserve existing behavior.

Fixes https://github.com/rust-lang/rust/issues/137936.
Fixes https://github.com/rust-lang/rust/issues/146423.
2025-11-20 19:23:10 +01:00
yukang
00f3155794 fix unused assigment issue for variable with drop, issue 148418 2025-11-20 20:00:54 +08:00
yukang
4930d3e612 Fix the issue of unused assignment from MIR liveness checking 2025-11-19 13:29:43 +08:00
Guillaume Gomez
d05f297164 Add more test for function_cast_as_integer lint 2025-11-10 16:38:28 +01:00
Guillaume Gomez
0a2c473ae7 Convert function_cast_as_integer lint suggestion to plain *const () cast 2025-11-10 16:38:28 +01:00
Guillaume Gomez
2ac32ae7a0 Add ui test for function_casts_as_integer lint 2025-11-10 16:38:28 +01:00
Guillaume Gomez
725f4ad24b Allow function_casts_as_integer in non-related ui tests 2025-11-10 16:38:28 +01:00
Stuart Cook
b0c4434a7f
Rollup merge of #148601 - GrigorenkoPV:invalid_atomic_ordering, r=Kivooeo
`invalid_atomic_ordering`: also lint `update` & `try_update`

Split from rust-lang/rust#148590

Tracking issue for `update` and `try_update`: rust-lang/rust#135894
2025-11-09 13:22:30 +11:00
21aslade
566a86b02f show packed alignment in mir_transform_unaligned_packed_ref 2025-11-07 13:57:37 -07:00
Pavel Grigorenko
bd23d55f29 invalid_atomic_ordering: also lint update & try_update 2025-11-07 16:17:10 +03:00
Marijn Schouten
0bd6a03edf dangling ptr lint cleanup 2025-11-01 15:15:05 +00:00
Jonathan Brouwer
a09c4fc862
Fix types being marked as dead when they are inferred generic arguments
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-10-30 08:31:07 +01:00