416 Commits

Author SHA1 Message Date
Jonathan Brouwer 9ad6dbf24f Use AllowedTargets::ManuallyChecked for LangParser 2026-06-22 17:09:37 +02:00
Jonathan Brouwer f99e8948be Move target checking for #[lang] to the attribute parser 2026-06-22 17:09:32 +02:00
qaijuang 98c932aba7 add missing test 2026-06-17 09:39:00 -04:00
qaijuang d1bc1b4631 suggest named lifetimes in assoc type bindings 2026-06-17 09:38:57 -04:00
qaijuang 5c7a657e99 add red test 2026-06-17 09:06:33 -04:00
Kivooeo c1f6331d13 add suggestion for mgca to add assoc type 2026-06-15 12:02:46 +00:00
Jonathan Brouwer 0c2ef16d32 Rollup merge of #157826 - tshepang:some-lack-a-personality, r=oli-obk
make test succeed on targets lacking a personality

Not all targets have `eh_personality` lang item set (see library/std/src/sys/personality/mod.rs), so change test to use a more available lang item.
2026-06-14 22:26:22 +02:00
León Orell Valerian Liehr 2fda23312d Slightly tweak the diagnostic for uncovered type parameters
The diagnostic is generally very noisy.
This commit tries to make it slightly less cluttered and more legible by

1. stopping to reuse the lengthy primary message as the primary label.
   This duplication didn't increase the information content and only
   turned the diagnostic into a letter and symbol soup.
   Instead, we now pick a succinct label ("uncovered type parameter")
   that immediately(!) signals to the users in red what is wrong with
   the highlighted type parameter.
2. breaking some information-dense notes into multiple lines.

Finally, this rephrases the slightly awkward and confusing
"type parameter […] must be used as a type parameter for […] type" to
"type parameter […] must be used as an argument to […] type".
2026-06-14 11:44:15 +02:00
Tshepang Mbambo 53ed8517b4 make test succeed on targets lacking a personality 2026-06-12 18:33:35 +02:00
Jonathan Brouwer 87a08b15cb Integrate target checking for #[repr] into its attribute parser 2026-06-02 21:12:15 +02:00
bjorn3 ee1536314f Remove unused import from a test
I forgot to remove this import when I changed this test.
2026-06-02 12:47:32 +02:00
Jonathan Brouwer 1bd288dd23 Rollup merge of #156924 - bjorn3:less_panic_impl, r=jdonszelmann
Use #[panic_handler] rather than #[lang = "panic_impl"]

As preparation for turning #[panic_handler] from a weak lang item into an EII.

r? @jdonszelmann
2026-06-01 19:35:49 +02:00
Jonathan Brouwer 737cb2d142 Rollup merge of #157125 - JonathanBrouwer:repr-target-checking2, r=mejrs
Rewrite the `#[repr]` attribute parser

The `#[repr]` attribute parser was one of the first attribute parsers we made, and didn't use a lot of the awesome infra we have nowadays yet, so in preparation for a new approach I'm trying for https://github.com/rust-lang/rust/pull/156569 I decided to clean it up.

This PR should have no observable effect other than improved diagnostic messages.

r? @mejrs
2026-05-30 18:01:56 +02:00
Jonathan Brouwer c72dc2be5b Clean up extend function of ReprParser 2026-05-30 11:33:50 +02:00
Aria Givens a1d4ad104f Suggest using NameValue syntax for malformed deprecated attribute 2026-05-28 23:03:44 -04:00
bjorn3 b8813df6cb Use #[panic_handler] rather than #[lang = "panic_impl"]
As preparation for turning #[panic_handler] from a weak lang item into
an EII.
2026-05-25 16:59:11 +02:00
janwi_mac d02b4c8e77 Improve suggestions for unconstrained parameters in impl blocks
When an unconstrained type or lifetime parameter is detected in an
`impl`, provide more specific help based on its usage:
- If the parameter is entirely unused, suggest removing it.
- If it is used in the `impl` body but not the `Self` type, suggest
  including it in the `Self` type and the struct definition.

This also adds a comprehensive UI test for these cases.
2026-05-09 17:50:35 +12:00
mu001999 d5a26d811b Support trailing self in import paths 2026-04-27 10:58:30 +08: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
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
yukang ef9b7c2b8f replace span_look_ahead with span_followed_by 2026-04-08 09:34:24 +08: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
cyrgani 9b0be7857a allow incomplete_features in most UI tests 2026-03-21 20:10:07 +00:00
León Orell Valerian Liehr 6bb6b11d9d Rename #[rustc_variance] to #[rustc_dump_variances] 2026-03-02 19:31:15 +01:00
mu001999 58e5475683 Rewrite build_reduced_graph_for_use_tree 2026-02-20 10:58:58 +08:00
Esteban Küber 37684bdfc5 Make all multipart suggestions verbose
The ShowAlways style of suggestions is usually easier to understand than the inline style.
2026-02-18 18:33:35 +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
Ralf Jung 5e65109f21 add write_box_via_move intrinsic and use it for vec!
This allows us to get rid of box_new entirely
2026-02-16 17:27:40 +01:00
Jonathan Brouwer c61c2603cf Port #[lang] to the new attribute parsers 2026-02-13 16:04:19 +00:00
xizheyin ed90b35669 Add note when inherent impl for a alias type defined outside of the crate 2026-02-09 15:10:01 +08:00
Jonathan Brouwer c1091da34c Fix existing messages in stderrs 2026-02-07 09:13:42 +01:00
Esteban Küber dffec20dee Tweak help to unify formatting and wording 2026-02-01 18:20:31 +00:00
Esteban Küber 879633f97b Change note to help 2026-02-01 18:20:31 +00:00
Esteban Küber 20000ca25a Point at destructor when denying deriving Copy 2026-02-01 18:20:30 +00:00
Esteban Küber aebf1fdcf9 Keep span of type in builtin derive macros expansions 2026-02-01 18:20:30 +00:00
Esteban Küber 4a27be6972 Do not mention -Zmacro-backtrace for std macros that are a wrapper around a compiler intrinsic 2026-01-26 17:34:31 +00:00
León Orell Valerian Liehr 233a45c41a Fix handling of const params defaults that ref Self & generalize diag
We used to lower such bad defaulted const args in trait object types to
`{type error}`; now correctly lower them to `{const error}`.

The added tests used to ICE prior to this change.
2026-01-21 12:53:47 +01:00
León Orell Valerian Liehr 9b861ace46 Generalize diag for missing assoc types to account for assoc consts 2026-01-21 12:53:46 +01:00
Jonathan Brouwer f5a1fc75ad Update uitests 2026-01-18 22:41:00 +01:00
Jonathan Brouwer cbcd1c3eef Rollup merge of #151036 - issue-151026, r=mati865
Better handle when trying to iterate on a `Range` of a type that isn't `Step`

Mention when a trait bound corresponds to an unstable trait.

Mention `Range` when `Step` bound is unment, and explain that only some std types impl `Iterator` for `Range`.

CC rust-lang/rust#151026
2026-01-14 11:05:40 +01:00
Guillaume Gomez 6c700ecd6a Rollup merge of #150737 - smithdb3/fix-150576, r=chenyukang
diagnostics: make implicit Sized bounds explicit in E0277

When a trait parameter depends upon Sized, the error message only referred to the full trait itself and didn't mention Sized. This makes the failure to implement Sized explicit. It also notes when the Sized trait bound is explicit or implicit.

Fixes rust-lang/rust#150576
2026-01-13 23:39:08 +01:00
Esteban Küber cafe91749f On unmet trait bound, mention if trait is unstable 2026-01-13 01:16:58 +00:00
Jakub Beránek 284d1361e4 Dogfood -Zno-embed-metadata for the standard library 2026-01-12 10:52:13 +01:00
Daniel Smith 291d0a9a4b diagnostics: make implicit Sized bounds explicit in E0277
When a trait parameter depends upon Sized, the error message only
referred to the full trait itself and didn't mention Sized. This makes
the failure to implement Sized explicit. It also notes when the Sized
trait bound is explicit or implicit.
2026-01-08 16:07:18 -05:00
Oli Scherer a3359bdd4f Compile-Time Reflection MVP: tuples 2026-01-08 11:41:00 +00:00
Edvin Bryntesson acd6ba4edb Port #[instruction_set] to attribute parser 2025-12-31 03:01:05 +01:00
bors 3f4dc1e02d Auto merge of #146348 - jdonszelmann:eiiv3, r=lcnr,oli-obk
Externally implementable items

Supersedes https://github.com/rust-lang/rust/pull/140010
Tracking issue: https://github.com/rust-lang/rust/issues/125418

Getting started:

```rust
#![feature(eii)]

#[eii(eii1)]
pub fn decl1(x: u64)
// body optional (it's the default)
{
    println!("default {x}");
}

// in another crate, maybe
#[eii1]
pub fn decl2(x: u64) {
    println!("explicit {x}");
}

fn main() {
    decl1(4);
}
```

- tiny perf regression, underlying issue makes multiple things in the compiler slow, not just EII, planning to solve those separately.
- No codegen_gcc support, they don't have bindings for weak symbols yet but could
- No windows support yet for weak definitions

This PR merges the implementation of EII for just llvm + not windows, doesn't yet contain like a new panic handler implementation or alloc handler. With this implementation, it would support implementing the panic handler in terms of EII already since it requires no default implementation so no weak symbols

The PR has been open in various forms for about a year now, but I feel that having some implementation merged to build upon
2025-12-14 04:20:26 +00:00
Guillaume Gomez d025cdef7d If there are too many suggestions for malformed attribute, do not suggest them 2025-12-12 14:55:17 +01:00