410 Commits

Author SHA1 Message Date
danieljofficial 40904ddd75 add issue links and bless attribute tests 2026-05-02 12:02:25 +01:00
danieljofficial 200d4e3b8a move tests from issues into attributes folder 2026-05-02 11:38:56 +01:00
Jacob Pratt 5b91e270dc Rollup merge of #155523 - ujjwalvishwakarma2006:reorg-tests-02, r=Kivooeo
Reorganize `tests/ui/issues/` - 02

| old-name | new-sub-dir | new-name |
|-|-|-|
| `issue-19001.rs` [issue](https://github.com/rust-lang/rust/issues/19001) | `recursion/` | `recursive-struct-with-raw-pointer-field.rs` |
| `issue-31769.rs` [issue](https://github.com/rust-lang/rust/issues/31769) | `attributes/` | `dont-allow-inline-and-repr-at-invalid-positions.rs` |
| `issue-31769.stderr` | `attributes/` | `dont-allow-inline-and-repr-at-invalid-positions.stderr` |
| `issue-33202.rs` [issue](https://github.com/rust-lang/rust/issues/33202) | `attributes/` | `repr-on-single-variant-Enum.rs` |
| `issue-38763.rs` [issue](https://github.com/rust-lang/rust/issues/38763) | `foreign/` | `foreign-fn-with-more-than-8-byte-arg-size.rs` |

r? Kivooeo
2026-04-30 22:28:31 -04:00
Jacob Pratt 5216be311d Rollup merge of #155812 - SynapLink:codex/check-pass-fixme-62277, r=petrochenkov
[codex] tests: mark migrated UI tests as check-pass

## Summary

Migrate a small set of UI tests left behind by the `compile-pass` migration from `build-pass` to `check-pass`.

These tests exercise attributes, cfg_attr, range trait type checking, and reachable-code diagnostics. None of the changed tests need codegen or linking, so `check-pass` matches the intended coverage and removes the stale `FIXME(#62277)` notes.

## Validation

- `python x.py test tests/ui/attributes/attr-before-view-item.rs tests/ui/attributes/attr-before-view-item2.rs tests/ui/attributes/attr-mix-new.rs tests/ui/attributes/class-attributes-1.rs tests/ui/attributes/class-attributes-2.rs tests/ui/attributes/method-attributes.rs tests/ui/attributes/unrestricted-attribute-tokens.rs tests/ui/attributes/variant-attributes.rs tests/ui/conditional-compilation/cfg-attr-multi-false.rs tests/ui/conditional-compilation/cfg-attr-multi-true.rs tests/ui/range/range_traits-4.rs tests/ui/range/range_traits-5.rs tests/ui/range/range_traits-7.rs tests/ui/reachable/expr_andand.rs tests/ui/reachable/expr_oror.rs`
- `python x.py test tidy`
2026-04-28 05:37:26 -04:00
SynapLink d7184b76a7 tests: remove obsolete class attribute tests 2026-04-27 20:43:24 +02:00
Jonathan Brouwer 75fa098069 Add test for existing bug 2026-04-27 09:53:10 +02:00
Jonathan Brouwer 71ef1fafe0 Rewrite check_invalid_where_predicate_attrs 2026-04-27 09:53:10 +02:00
SynapLink 9854d7e82a tests: mark migrated UI tests as check-pass 2026-04-26 10:07:00 +02:00
Folkert de Vries a4f5c6e971 error on invalid macho section specifier 2026-04-25 20:06:30 +02:00
Waffle Lapkin 59be02e594 bless ui tests 2026-04-21 12:28:25 +02:00
ujjwalVishwakarma2006 c4f6148fd9 Add issue links 2026-04-19 23:51:38 +05:30
ujjwalVishwakarma2006 526f3d9bbe Move test files from issues/ to appropriate subdirectories 2026-04-19 23:44:20 +05:30
Jonathan Brouwer ae4cf84814 Mark all unstable attributes as OnDuplicate::Error 2026-04-18 10:20:32 +02:00
Jonathan Brouwer c142d8013c Rollup merge of #154781 - JonathanBrouwer:fix-attr-order, r=jdonszelmann
Fix attribute order implementation

The implementation in https://github.com/rust-lang/rust/pull/153041 contained a mistake :c
I swapped the place where the error message was on, but did not change any code for which attribute was also selected, which explains the empty crater results.
**Interestingly, the original code is broken too, before https://github.com/rust-lang/rust/pull/153041 it always took the last attribute, regardless of what the `AttributeOrder` actually was...**

Let's first see crater results before making a decision

TODO for this PR: Make better tests for this
2026-04-17 13:28:55 +02:00
Jonathan Brouwer 6f968782fd Add regression tests 2026-04-17 12:37:58 +02:00
bors 7af3402cda Auto merge of #155380 - jhpratt:rollup-j1e7DVL, r=jhpratt
Rollup of 18 pull requests

Successful merges:

 - rust-lang/rust#154451 (Require that a `<_ as Try>::Residual` implement the `Residual` trait)
 - rust-lang/rust#154595 (Emit fatal on invalid const args with nested defs)
 - rust-lang/rust#154599 (report the `varargs_without_pattern` lint in deps)
 - rust-lang/rust#154699 (`core::unicode`: Replace `Cased` table with `Lt`)
 - rust-lang/rust#155353 (resolve: Remove `inaccessible_ctor_reexport` resolver field)
 - rust-lang/rust#155357 (Add `--remap-path-scope` as unstable in rustdoc)
 - rust-lang/rust#150649 (clippy fix: non_canonical_clone_impl)
 - rust-lang/rust#154604 (abort in core)
 - rust-lang/rust#154616 (Add `--quiet` flag to x.py and bootstrap to suppress output)
 - rust-lang/rust#155215 (Clean up `AttributeLintKind` and refactor diagnostic attribute linting)
 - rust-lang/rust#155228 (Check diagnostic output in incremental `cpass` and `rpass` revisions)
 - rust-lang/rust#155266 (Adjust release notes for post-merge feedback)
 - rust-lang/rust#155326 (Disallow ZST allocations with `TypedArena`.)
 - rust-lang/rust#155334 (docs: Use `0b1` instead of `NonZero::MIN` in `NonZero::bit_width` doctests)
 - rust-lang/rust#155340 (Handle nonnull pattern types in size skeleton)
 - rust-lang/rust#155347 (Add push_mut and new Layout methods to release notes)
 - rust-lang/rust#155356 (remove calls to AliasTyKind::def_id)
 - rust-lang/rust#155364 (Reduce diagnostic type visibilities.)
2026-04-16 18:19:58 +00:00
bors 18b439f84e Auto merge of #154605 - estebank:attr-suggest, r=jieyouxu
Make `span_suggestions` always verbose



`span_suggestions` is to provide mutually exclusive suggestions. When it was introduced, we made its behavior be that if a single suggestion is given to it, we present the suggestion inline, otherwise in patch format. Changing this to make all of its uses be verbose, as that is closer in intent of output.
2026-04-16 11:23:18 +00:00
Jacob Pratt 0d98e0d54f Rollup merge of #155215 - mejrs:condense_diag_lints, r=JonathanBrouwer
Clean up `AttributeLintKind` and refactor diagnostic attribute linting

There was a fair amount of duplication here, and thanks to the proliferation of new diagnostic attributes these days, it was threatening to grow bigger.
2026-04-16 01:54:10 -04:00
Jonathan Brouwer 1de718c323 Rollup merge of #155286 - mejrs:confusables, r=JonathanBrouwer
attribute cleanup: rustc_confusables

r? @jdonszelmann
2026-04-15 14:39:07 +02:00
Esteban Küber b849e10d38 Make span_suggestions always verbose
`span_suggestions` is to provide mutually exclusive suggestions. When it was introduced, we made its behavior be that if a single suggestion is given to it, we present the suggestion inline, otherwise in patch format. Changing this to make all of its uses be verbose, as that is closer in intent of output.
2026-04-15 01:38:14 +00:00
mejrs f17ca97749 attribute cleanup: rustc_confusables 2026-04-14 14:24:26 +02:00
mejrs 57fd9747fb Merge "missing options" lints for diagnostic attributes 2026-04-12 21:37:45 +02:00
mejrs e9d0e320ec Merge malformed diagnostic attribute lint 2026-04-12 20:39:25 +02:00
Oscar Bray 25a92d208d Add #![unstable_removed(..)] attribute to track removed features
Move concat_idents to use the unstable_removed attribute
2026-04-12 11:18:10 +01:00
Jacob Pratt ca34f771c0 Rollup merge of #154827 - scrabsha:push-zuosxmmnzkrq, r=jdonszelmann
distinguish "expected a single argument" and "expected an argument" on attribute parsing
2026-04-11 04:50:15 -04:00
Sasha Pourcelot 6f87e0be69 use AcceptContext::single_element_list where possible 2026-04-09 17:09:23 +00: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
Sasha Pourcelot 362e0f9160 special case expected_single_argument when no argument is provided 2026-04-09 16:39:58 +00:00
Waffle Lapkin ec8c489469 ty::Alias refactor: bless tests 2026-04-07 10:08:12 +02:00
Jonathan Brouwer d88d64be5e Fix attribute order implementation 2026-04-03 23:41:40 +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
Yuki Okushi 531631c7ad Make messages more generic 2026-03-28 16:18:11 +09:00
Jonathan Brouwer 50018abcdb Rollup merge of #154225 - Unique-Usman:ua/rustc_confusable, r=Kivooeo
diagnostics: avoid ICE in confusable_method_name for associated functions

Avoid unconditionally slicing `inputs()[1..]`, which assumes a `self` parameter. Use `is_method()` to conditionally skip the receiver, preventing out-of-bounds access and fixing suggestions for associated functions.
2026-03-23 12:01:02 +01:00
Usman Akinyemi fa3e85a7e8 diagnostics: avoid ICE in confusable_method_name for associated functions
Avoid unconditionally slicing `inputs()[1..]`, which assumes a `self`
parameter. Use `is_method()` to conditionally skip the receiver,
preventing out-of-bounds access and fixing suggestions for associated
functions.

Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
2026-03-23 01:50:44 +05:30
Sasha Pourcelot 5491c3529b check earlier for misused crate-level attributes 2026-03-22 07:51:23 +00:00
Jonathan Brouwer cc335b236c Rollup merge of #154006 - JonathanBrouwer:doc-compile-err, r=jdonszelmann
attrs: Ignore ExprKind::Err when converting path attr expr to lit

r? @jdonszelmann

Fixes https://github.com/rust-lang/rust/issues/153930
2026-03-17 21:20:03 +01:00
Jonathan Brouwer de48ea79af Update uitests 2026-03-17 17:30:56 +01:00
cyrgani 72732f2013 move tests/ui/invalid tests to new folders 2026-03-17 10:07:52 +00:00
Jonathan Brouwer 2d9fde77a8 Rollup merge of #153594 - reddevilmidzy:ui-refactor, r=JohnTitor,Kivooeo
Move some ui tests

> [!NOTE]
> I split the commits to make the review easier and to keep the git history easier to trace.

Renamed issue-xxx tests

`tests/ui/dyn-drop` -> `tests/ui/dyn-keyword`
`tests/ui/missing-trait-bounds` -> `tests/ui/trait-bound/missing-trait-bounds`
`tests/ui/recursion_limit` -> `tests/ui/recursion/recursion_limit`
`tests/ui/version` -> `tests/ui/compile-flags`

Reorganize `tests/ui/empty`
2026-03-09 11:49:26 +01:00
Redddy e63664773c Move some ui tests
* Move dyn-drop to dyn-keyword
* Reorganize `tests/ui/empty` into specific dirs

remove tests/ui/empty/empty-linkname.rs duplicate of tests/ui/error-codes/E0454.rs
* Move `missing-trait-bounds` to `trait-bound/missing-trait-bounds`
* bless traits/missing-trait-bounds tests
* Move `recursion_limit` to `recursion/recursion_limit`
* Move `version` to `compile-flags`
2026-03-09 09:11:06 +00:00
Oscar Bray 4af572d84e Gate #![reexport_test_harness_main] properly 2026-03-04 08:29:44 +00:00
Guillaume Gomez b5ff567193 Migrate more types from LintDiagnostic to Diagnostic 2026-03-03 21:57:02 +01:00
mejrs f944436c29 port over diagnostic::on_unimplemented 2026-02-24 10:50:38 +01:00
Jonathan Brouwer 0b5290123d Update uitests 2026-02-22 20:20:33 +01:00
Stuart Cook e53dd52e16 Rollup merge of #152749 - cyrgani:rustc-allow-const, r=jdonszelmann
make `rustc_allow_const_fn_unstable` an actual `rustc_attrs` attribute

It is already named like one, but used to have its own feature gate, which this PR now removes in favor of just using `#![feature(rustc_attrs)]`.

Most of the diff is just the line number changes in `malformed-attrs.stderr`.
2026-02-18 17:29:49 +11:00
cyrgani 83ef5059d6 make rustc_allow_const_fn_unstable an actual rustc_attrs attribute 2026-02-17 20:16:29 +00:00
Esteban Küber c73b3d20c6 Unify wording of resolve error
Remove "failed to resolve" and use the same format we use in other resolution errors "cannot find `name`".

```
error[E0433]: cannot find `nonexistent` in `existent`
  --> $DIR/custom_attr_multisegment_error.rs:5:13
   |
LL | #[existent::nonexistent]
   |             ^^^^^^^^^^^ could not find `nonexistent` in `existent`
```
2026-02-17 16:51:44 +00:00
Jacob Pratt 2dba56033e Rollup merge of #151152 - nik-contrib:helper_attr_builtin, r=chenyukang
Add FCW for derive helper attributes that will conflict with built-in attributes

Adds a future-compatibility-warning deny-by-default lint that helps catch invalid derive helper attribute names early.

This issues the lint, saying that `ignore` helper will clash with the built-in `ignore` attribute.

```rust
#![crate_type = "proc-macro"]
#![deny(ambiguous_derive_helpers)]
use proc_macro::TokenStream;

#[proc_macro_derive(Trait, attributes(ignore))]
pub fn example(input: TokenStream) -> TokenStream {
    TokenStream::new()
}
```

If you actually tried to use that `ignore` helper attribute, you won't be able to due to the ambiguity:

```rust
#[derive(Trait)]
struct Foo {
    #[ignore]
    field: (),
}
```

Produces:

```
error[E0659]: `ignore` is ambiguous
 --> src/lib.rs:5:7
  |
5 |     #[ignore]
  |       ^^^^^^ ambiguous name
  |
  = note: ambiguous because of a name conflict with a builtin attribute
  = note: `ignore` could refer to a built-in attribute
note: `ignore` could also refer to the derive helper attribute defined here
 --> src/lib.rs:3:10
  |
3 | #[derive(Trait)]
  |          ^^^^^
```
2026-02-12 00:41:06 -05:00
Matthias Krüger 88eda646f2 Rollup merge of #152431 - oli-obk:limited_stability_attr, r=jdonszelmann
Restrict the set of things that const stability can be applied to

r? @jdonszelmann
2026-02-11 13:48:47 +01:00
Nik Revenco 846e4ee5dc Add FCW for derive helper attributes that will conflict with built-in attributes 2026-02-10 19:39:19 +00:00