Esteban Küber
d48e699b6c
Emit fewer errors for incorrect rtn and = -> : typos in bindings
...
Stash parse errors when pasing rtn that doesn't use `(..)`.
Emit single error on `Foo::bar(qux)` that looks like rtn in incorrect position and suggest `Foo::bar(..)`.
```
error: return type notation not allowed in this position yet
--> $DIR/let-binding-init-expr-as-ty.rs:18:10
|
LL | struct K(S::new(()));
| ^^^^^^^^^^
|
help: furthermore, argument types not allowed with return type notation
|
LL - struct K(S::new(()));
LL + struct K(S::new(..));
|
```
On incorrect rtn in let binding type for an existing inherent associated function, suggest `:` -> `=` to turn the "type" into a call expression.
```
error: expected type, found associated function call
--> $DIR/let-binding-init-expr-as-ty.rs:29:12
|
LL | let x: S::new(());
| ^^^^^^^^^^
|
help: use `=` if you meant to assign
|
LL - let x: S::new(());
LL + let x = S::new(());
|
```
2026-03-20 19:33:05 +00:00
Esteban Küber
408066f310
Do not suggest introducing new binding when other suggestions are present
2026-03-15 03:51:25 +00:00
Nicholas Nethercote
3399ed3c9a
Simplify type_of_opaque.
...
There is a bunch of complexity supporting the "cannot check whether the
hidden type of opaque type satisfies auto traits" error that shows up in
`tests/ui/impl-trait/auto-trait-leak.rs`. This is an obscure error that
shows up in a single test. If we are willing to downgrade that error
message to a cycle error, we can do the following.
- Simplify the `type_of_opaque` return value.
- Remove the `cycle_stash` query modifier.
- Remove the `CyclePlaceholder` type.
- Remove the `SelectionError::OpaqueTypeAutoTraitLeakageUnknown`
variant.
- Remove a `FromCycleError` impl.
- Remove `report_opaque_type_auto_trait_leakage`.
- Remove the `StashKey::Cycle` variant.
- Remove the `CycleErrorHandling::Stash` variant.
That's a lot! I think this is a worthwhile trade-off.
2026-03-11 21:54:42 +11:00
Guillaume Gomez
4019a92ca8
Add new rustc_errors::DiagDecorator type
2026-03-09 11:19:53 +01:00
Zalathar
985b41d387
Remove the rustc_data_structures::assert_matches! re-exports
2026-03-08 22:02:23 +11:00
Josh Stone
32bae1353e
Update cfg(bootstrap)
2026-03-07 10:42:02 -08:00
Jonathan Brouwer
f540b27f90
Rollup merge of #153508 - JonathanBrouwer:improved_eager_format, r=GuillaumeGomez
...
Clean up the eager formatting API
For https://github.com/rust-lang/rust/issues/151366#event-22181360642
Previously eager formatting worked by throwing the arguments into a diag, formatting, then removing the args again. This is ugly so instead we now just do the formatting completely separately.
This PR has nice commits, so I recommend reviewing commit by commit.
r? @GuillaumeGomez
2026-03-07 01:42:37 +01:00
Jonathan Brouwer
10eb844bac
Remove eagerly_format_to_string from DiagCtxt
2026-03-06 18:52:11 +01:00
Jonathan Brouwer
8c87d0761f
Remove eagerly_format from DiagCtxt
2026-03-06 18:52:11 +01:00
Jonathan Brouwer
46cedc33b8
Use eager formatting in #[derive(Subdiagnostic)]
2026-03-06 18:32:54 +01:00
Jonathan Brouwer
8d96e603b1
Preserve the DiagLocation in diag_lint_level
2026-03-06 15:15:43 +01:00
Jonathan Brouwer
53ef4d297e
Rollup merge of #153414 - JonathanBrouwer:translate_cleanup, r=Kivooeo
...
Rename translation -> formatting
Because there is no translation happening anymore
r? @Kivooeo
2026-03-04 19:30:42 +01:00
Jonathan Brouwer
1500680ba5
Rollup merge of #153401 - GuillaumeGomez:migrate-diag, r=JonathanBrouwer
...
Migrationg of `LintDiagnostic` - part 7
Part of https://github.com/rust-lang/rust/issues/153099 .
This PR removes the `LintDiagnostic` trait and proc-macro. \o/
r? @JonathanBrouwer
2026-03-04 19:30:40 +01:00
Jonathan Brouwer
1c44dbd580
Rollup merge of #152164 - mu001999-contrib:lint/unused_features, r=JonathanBrouwer
...
Lint unused features
*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/152164 )*
Fixes rust-lang/rust#44232
Fixes rust-lang/rust#151752
---
This PR records used features through query side effect, then reports unsued features finally.
2026-03-04 19:30:36 +01:00
Jonathan Brouwer
d8092147fe
Rename translation -> formatting
2026-03-04 17:47:24 +01:00
Guillaume Gomez
7ceb8ea1b0
Remove unused LintDiagnostic trait
2026-03-04 15:16:51 +01:00
Guillaume Gomez
bd538f90fe
Remove unused rustc_errors::LintDiagnosticBox trait
2026-03-03 17:21:41 +01:00
mu001999
d0a182f485
Remove unused features in compiler
2026-03-02 09:38:04 +08:00
Jonathan Brouwer
51f35d76a2
Pass DiagArgMap instead of FluentArgs into format_diag_message
2026-03-01 10:07:39 +01:00
Jonathan Brouwer
5ade46246e
Move DiagArgMap to rustc_error_messages
2026-03-01 10:07:36 +01:00
Jonathan Brouwer
5a18412c93
Remove TranslationError
2026-02-28 18:34:17 +01:00
Jonathan Brouwer
b0cdafbd4a
Rollup merge of #152455 - JonathanBrouwer:remove_translation, r=jdonszelmann
...
Remove the translation `-Z` options and the `Translator` type.
This PR implements MCP https://github.com/rust-lang/compiler-team/issues/967
It is split up into individually reviewable commits, each commit passes tests:
* https://github.com/rust-lang/rust/commit/678211956793a2e772414a71700a21525af6e67b Removes the translation compiler options from the session
* https://github.com/rust-lang/rust/commit/8f300d02fe8d2f01a39425925afd4cf3e15a822b Removes the now empty `Translator` type
* https://github.com/rust-lang/rust/commit/ab715c536fbd4ac09409e9a44eea2e25ea8a4f48 Renames `translate_message` to `format_diag_message`, as the function no longer does any translation
* https://github.com/rust-lang/rust/commit/8bcbc3f766af6242dcb52afe1ef4f6b1a9685019 Removes a section describing the removed compiler options from the rustc dev guide
2026-02-20 22:00:57 +01:00
Jonathan Brouwer
018a5efcf7
Rename inline_fluent! to msg!
2026-02-14 13:47:52 +01:00
Jonathan Brouwer
f1b935d08f
Rollup merge of #152356 - JonathanBrouwer:inline_diag4, r=jdonszelmann
...
Improve the `inline_fluent!` macro
For https://github.com/rust-lang/rust/issues/151366
This PR turns `inline_fluent!` into a proc macro, so we can run validation on the messages in this macro :)
I started a thread here because I don't like the name of the macro, but that's for a future PR: [#t-compiler > Bikeshed the new `inline_fluent!` macro](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Bikeshed.20the.20new.20.60inline_fluent!.60.20macro/with/572646242 )
2026-02-13 13:35:01 +01:00
mu001999
a07f837491
Remove unused features in compiler
2026-02-13 09:25:39 +08:00
Jonathan Brouwer
ab715c536f
Rename translate_message to format_diag_message
2026-02-11 17:52:00 +01:00
Jonathan Brouwer
8f300d02fe
Remove the Translator type
2026-02-11 17:52:00 +01:00
Lukas Bergdoll
2f3b952349
Stabilize assert_matches
2026-02-11 14:13:44 +01:00
Jonathan Brouwer
ea361287be
Remove SubdiagMessage in favour of the identical DiagMessage
2026-02-10 09:13:45 +00:00
Jonathan Brouwer
6eb2a8fa9e
Reformat existing error messages
2026-02-09 19:12:22 +01:00
Jonathan Brouwer
81d4214604
Remove fluent tests in rustc_error
2026-02-08 11:06:42 +01:00
Jonathan Brouwer
d96d73fd86
Rollup merge of #152140 - bjorn3:driver_fixed_error_codes, r=jdonszelmann
...
Hard code the error code registry for custom drivers
And do some cleanups enabled by this.
2026-02-06 10:06:45 +01:00
Jonathan Brouwer
e55eb45661
Convert to inline diagnostics in rustc_errors
2026-02-05 12:14:48 +01:00
bjorn3
639cb694df
Replace Registry type with a lazily initialized static
...
And move try_find_description to rustc_errors::codes.
2026-02-05 10:54:46 +00:00
bjorn3
1851937577
Hard code the error code registry for custom drivers
2026-02-04 21:21:15 +00:00
Jacob Pratt
4a983e0900
Rollup merge of #151439 - Mark-Simulacrum:bootstrap-bump, r=nnethercote
...
Bump bootstrap compiler to 1.94
https://forge.rust-lang.org/release/process.html#default-branch-bootstrap-update-tuesday
2026-01-22 00:37:43 -05:00
Mark Rousskov
3dc7a1f33b
Bump stage0
2026-01-21 20:03:56 -05:00
bjorn3
3ccabc6a8d
Remove old error emitter
...
This completes the transition to annotate-snippets
2026-01-21 12:14:51 +00:00
Jacob Pratt
2206d935f7
Rollup merge of #149209 - lto_refactors8, r=jackh726
...
Move LTO to OngoingCodegen::join
This will make it easier to in the future move all this code to link_binary.
Follow up to https://github.com/rust-lang/rust/pull/147810
Part of https://github.com/rust-lang/compiler-team/issues/908
2026-01-21 02:04:01 -05:00
Jonathan Brouwer
e8c3dd36f8
Rollup merge of #151326 - translated, r=davidtwco
...
Remove `DiagMessage::Translated` in favour of `DiagMessage::Str`
This variant did not seem to be meaningfully different from `DiagMessage::Str`.
Am I missing something or was this just an oversight?
r? @davidtwco
2026-01-19 20:53:24 +01:00
Jonathan Brouwer
f50f5dc494
Remove all usages of #[rustc_lint_diagnostics]
2026-01-19 17:39:54 +01:00
Jonathan Brouwer
0ee7d96253
Remove all allows for diagnostic_outside_of_impl and untranslatable_diagnostic throughout the codebase
...
This PR was mostly made by search&replacing
2026-01-19 17:39:49 +01:00
Zalathar
7ec34defe9
Temporarily re-export assert_matches! to reduce stabilization churn
2026-01-19 18:26:53 +11:00
Jonathan Brouwer
ec787b07fd
Remove DiagMessage::Translated in favour of DiagMessage::Str
2026-01-18 18:30:11 +01:00
Matthias Krüger
bf399241fe
Rollup merge of #146584 - cyrgani:error-codes-macro, r=GuillaumeGomez
...
remove duplicated columns from `rustc_error_code::error_codes!`
Possible because of rust-lang/rust#146308 ~~, but currently still blocked on the next stage0 bump~~.
2025-12-11 22:09:52 +01:00
bors
ba86c0460b
Auto merge of #149704 - matthiaskrgr:rollup-u4zhw99, r=matthiaskrgr
...
Rollup of 5 pull requests
Successful merges:
- rust-lang/rust#146826 (Implement `Allocator` for `&mut A` where `A: Allocator + ?Sized`)
- rust-lang/rust#148487 (add Option::into_flat_iter)
- rust-lang/rust#148814 (stabilize `array_windows`)
- rust-lang/rust#149401 (Fix `name()` functions for local defs in rustc_public)
- rust-lang/rust#149683 (Fix armv8r-none-eabihf tier)
r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-06 12:25:12 +00:00
Matthias Krüger
8a6f82efac
Rollup merge of #148814 - bend-n:stabilize_array_windows, r=scottmcm
...
stabilize `array_windows`
Tracking issue: rust-lang/rust#75027
Closes : rust-lang/rust#75027
FCP completed: https://github.com/rust-lang/rust/issues/75027#issuecomment-3477510526
2025-12-06 09:57:59 +01:00
Jonathan Brouwer
8f59eb0177
Move attribute lints to rustc_lint
2025-12-05 14:22:52 +01:00
bors
47cd7120d9
Auto merge of #147634 - fmease:mv-var-to-dyn-buf-lints-next, r=jdonszelmann
...
Move even more early buffered lints to dyn lint diagnostics
Follow-up to https://github.com/rust-lang/rust/pull/145881 and https://github.com/rust-lang/rust/pull/145747 .
I originally wanted to migrate most if not the entire rest of the early buffered lints. However, when trying to migrate the buffered lints used by check-cfg I encountered a roadblock. Namely, it depends on `TyCtxt` (well, `Option<TyCtxt>`) which makes it quite hard to migrate (see also https://github.com/rust-lang/rust/pull/147634#issuecomment-3398174584 , https://github.com/rust-lang/rust/pull/147634#issuecomment-3398207128 & rust-lang/rust#149215 ).
So for now, I won't migrate it (maybe rust-lang/rust#149215 will find a solution), nor will I migrate the rest since it's quite tedious to migrate these. I'll leave them for future me.
2025-12-02 07:33:36 +00:00
bendn
919e46f4d4
stabilize [T]::array_windows
2025-12-02 00:37:17 +07:00