548 Commits

Author SHA1 Message Date
Jonathan Brouwer c5f6afc3e8 Remove target arguments & features from parse_limited 2026-04-18 19:13:30 +02:00
Nicholas Nethercote 9b64d52d78 Reduce diagnostic type visibilities.
Most diagnostic types are only used within their own crate, and so have
a `pub(crate)` visibility. We have some diagnostic types that are
unnecessarily `pub`. This is bad because (a) information hiding, and (b)
if a `pub(crate)` type becomes unused the compiler will warn but it
won't warn for a `pub` type.

This commit eliminates unnecessary `pub` visibilities for some
diagnostic types, and also some related things due to knock-on effects.
(I found these types with some ad hoc use of `grep`.)
2026-04-16 07:42:17 +10:00
Nicholas Nethercote 0db4e3a883 De-pluralize the names of two error enums.
Error enum names should not be plural. Even though there are multiple
possible errors, each instance of an error enum describes a single
error. There are dozens of singular error enum names, and only two
plural error enum names. This commit makes them both singular.
2026-03-30 14:15:44 +11:00
Stuart Cook 44c87292ac Rollup merge of #153778 - bjorn3:driver_cleanups, r=TaKO8Ki
Couple of driver interface improvements

* Pass Session to `make_codegen_backend` callback. This simplifies some code in miri.
* Move env/file_depinfo from ParseSess to Session. There is no reason it has to be in ParseSess rather than Session.
* Rename hash_untracked_state to track_state to indicate that it isn't just used for hashing state, but also for adding env vars and files to be tracked through the dep info file.
2026-03-18 15:07:31 +11:00
bjorn3 2199d07e2b Move env/file_depinfo from ParseSess to Session 2026-03-12 15:35:27 +00:00
Nicholas Nethercote 282e8ec275 Rename some parameters.
`tcx` is the usual name for `TyCtxt` parameters.
2026-03-11 16:04:40 +11:00
Josh Stone eb093cfd5d Reformat with the new stage0 2026-03-07 10:42:02 -08: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
bjorn3 5aa980e6dc Replace CodegenResults with CompiledModules
This is already CodegenResults without CrateInfo. The driver can
calculate the CrateInfo and pass it by-ref to the backend. Using
CompiledModules makes it a bit easier to move some other things out of
the backend as will be necessary for moving LTO to the link phase.
2026-03-02 16:39:41 +00:00
bjorn3 a192c617ec Use CompiledModules inside CodegenResults
In preparation for fully replacing CodegenResults with CompiledModules.
2026-03-02 16:39:13 +00:00
mu001999 7f3bbe371f Report unused features 2026-03-02 09:38:03 +08:00
Jonathan Brouwer 07bf6ae810 Use the new parser throughout the compiler
Co-authored-by: Jana Dönszelmann <jana@donsz.nl>
2026-02-24 09:34:59 +01:00
Jonathan Brouwer 8f300d02fe Remove the Translator type 2026-02-11 17:52:00 +01:00
Jonathan Brouwer 7fbde8b9c8 Rollup merge of #152250 - JonathanBrouwer:convert_finish, r=jdonszelmann
Remove support for slugs in diagnostic messages

This PR contains 5 commits, and is best reviewed commit-by-commit:
- https://github.com/rust-lang/rust/pull/152250/changes/ea8733133cacf4496a2766b3d002492cc29ea7bf Removes support from slugs from `rustc_errors`
- https://github.com/rust-lang/rust/pull/152250/changes/62dd37131f6f43d0dab3e26cf125cd841a08e003 Removes support from slugs from `rustc_macros` (which declares `derive(Diagnostic)`)
- https://github.com/rust-lang/rust/pull/152250/changes/2289e6cfb7e379eba777a10df0a6f474f9450b02 Adjuist the `ui-fulldeps` testsuite to match the changes in `rustc_macros`
- https://github.com/rust-lang/rust/pull/152250/changes/0db0acd6993cbdf84384b00773d7509df6bc20fb Removes support for the fallback bundle (which previously contained all messages, but is now empty) from `rustc_driver_impl` and `rustc_session`
- https://github.com/rust-lang/rust/pull/152250/changes/81d42146040c4a6b3d252e3dc3ac32e563694796 Removes an integration test that tested the translation system using fluent
2026-02-08 19:15:25 +01:00
Jonathan Brouwer 0db0acd699 Remove the fallback bundle 2026-02-08 11:06:42 +01:00
Stuart Cook 68f4a99963 Rollup merge of #151887 - scottmcm:homogeneous-try-in-compiler, r=jackh726
Remove some unnecessary `try`-related type annotations

I left a few, like
```rust
let result: Result<_, ModError<'_>> = try {
```
where it felt like seeing it might still be useful for the reader.

Feel free to push back on any of these changes if you think they should be left alone.
2026-02-08 16:58:23 +11:00
Jonathan Brouwer c814f76c06 Convert to inline diagnostics in rustc_lint 2026-02-07 19:34:21 +01:00
Jonathan Brouwer 9a114c686f Convert to inline diagnostics in rustc_parse 2026-02-07 10:30:40 +01:00
Jonathan Brouwer edd43c9e1f Fix existing messages in the diag structs 2026-02-07 09:11:34 +01:00
Jonathan Brouwer a66d0f8598 Rollup merge of #152186 - GuillaumeGomez:inline-diag-rustc_const_eval, r=JonathanBrouwer
Convert to inline diagnostics in `rustc_const_eval`

Part of rust-lang/rust#151366.

r? @JonathanBrouwer
2026-02-07 01:18:53 +01:00
Jonathan Brouwer 4fa1cdb455 Rollup merge of #152126 - GuillaumeGomez:inline-diag-rustc_mir_build, r=JonathanBrouwer
Convert to inline diagnostics in `rustc_mir_build`

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

r? @JonathanBrouwer
2026-02-07 01:18:53 +01:00
Guillaume Gomez c6829020b0 Convert to inline diagnostics in rustc_const_eval 2026-02-06 22:55:58 +01:00
Guillaume Gomez 885a8081c4 Convert to inline diagnostics in rustc_mir_build 2026-02-06 22:21:27 +01:00
Jonathan Brouwer ea43035654 Convert to inline diagnostics in rustc_passes 2026-02-06 13:31:54 +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 771fa578bf Rollup merge of #152117 - JonathanBrouwer:convert_trait_selection2, r=GuillaumeGomez
Convert to inline diagnostics in `rustc_trait_selection`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-06 10:06:43 +01:00
Jonathan Brouwer 65a1d9708d Rollup merge of #152107 - JonathanBrouwer:convert_borrowck, r=lqd
Convert to inline diagnostics in `rustc_borrowck`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-06 10:06:43 +01:00
Jonathan Brouwer 57aae94bed Convert to inline diagnostics in rustc_hir_analysis 2026-02-06 10:05:35 +01:00
Jonathan Brouwer 55d1ba12d9 Convert to inline diagnostics in rustc_trait_selection 2026-02-05 16:58:59 +01:00
Jonathan Brouwer dd61998e74 Convert to inline diagnostics in rustc_borrowck 2026-02-05 16:55:55 +01:00
Jonathan Brouwer 3c61714cc3 Rollup merge of #152121 - JonathanBrouwer:convert_builtin_macros, r=lqd
Convert to inline diagnostics in `rustc_builtin_macros`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-05 12:17:01 +01:00
Jonathan Brouwer 4d535f5642 Rollup merge of #152119 - JonathanBrouwer:convert_middle, r=jdonszelmann
Convert to inline diagnostics in `rustc_middle`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-05 12:17:01 +01:00
Jonathan Brouwer 62de21f0ad Rollup merge of #152109 - JonathanBrouwer:convert_errors, r=lqd
Convert to inline diagnostics in `rustc_errors`

For rust-lang/rust#151366
r? @jdonszelmann
2026-02-05 12:17:00 +01:00
Jonathan Brouwer 3421938bb8 Rollup merge of #152106 - JonathanBrouwer:convert_ast_passes, r=jdonszelmann
Convert to inline diagnostics in `rustc_ast_passes`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-05 12:16:59 +01:00
Jonathan Brouwer e55eb45661 Convert to inline diagnostics in rustc_errors 2026-02-05 12:14:48 +01:00
Jonathan Brouwer 67c6cd99b7 Convert to inline diagnostics in rustc_pattern_analysis 2026-02-05 12:13:25 +01:00
Jonathan Brouwer 0da9476010 Convert to inline diagnostics in rustc_ast_passes 2026-02-05 12:08:42 +01:00
Jonathan Brouwer 46753b1b43 Convert to inline diagnostics in rustc_middle 2026-02-05 12:02:02 +01:00
Jonathan Brouwer d40e60fc44 Convert to inline diagnostics in rustc_builtin_macros 2026-02-05 12:00:56 +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
Jonathan Brouwer dd05e03db1 Rollup merge of #152118 - JonathanBrouwer:convert_codegen_ssa, r=jdonszelmann
Convert to inline diagnostics in `rustc_codegen_ssa`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-05 08:32:56 +01:00
Jonathan Brouwer 9a2c4cb064 Rollup merge of #152115 - GuillaumeGomez:inline-diag-rustc_metadata, r=JonathanBrouwer
Convert to inline diagnostics in `rustc_metadata`

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

r? @JonathanBrouwer
2026-02-05 08:32:55 +01:00
Jonathan Brouwer c2da69cd18 Rollup merge of #152114 - JonathanBrouwer:convert_mir_transform, r=jdonszelmann
Convert to inline diagnostics in `rustc_mir_transform`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-05 08:32:54 +01:00
Jonathan Brouwer d58a87b287 Rollup merge of #152108 - JonathanBrouwer:convert_expand, r=jdonszelmann
Convert to inline diagnostics in `rustc_expand`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-05 08:32:52 +01:00
Jonathan Brouwer 945bfa770e Rollup merge of #152105 - GuillaumeGomez:inline-diag-rustc_ast_lowering, r=JonathanBrouwer
Convert to inline diagnostics in `rustc_ast_lowering`

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

r? @JonathanBrouwer
2026-02-05 08:32:51 +01:00
Jonathan Brouwer 50c768e1bb Rollup merge of #152068 - JonathanBrouwer:convert_resolve, r=lqd
Convert to inline diagnostics in `rustc_resolve`

For https://github.com/rust-lang/rust/issues/151366
2026-02-05 08:32:47 +01:00
Jonathan Brouwer 775ae61f3e Rollup merge of #152142 - JonathanBrouwer:convert_hir_typeck, r=GuillaumeGomez
Convert to inline diagnostics in `rustc_hir_typeck`

For https://github.com/rust-lang/rust/issues/151366
r? @GuillaumeGomez
2026-02-05 08:32:44 +01:00
Jonathan Brouwer c0b4db118b Rollup merge of #150379 - ChrisDenton:exitcode, r=jieyouxu
Return `ExitCode` from `rustc_driver::main` instead of calling `process::exit`

This makes rustc simply return an exit code from main rather than calling `std::process::exit` with an exit code. This means that drops run normally and the process exits cleanly. This is similar to what happens when an ICE occurs (due to being a panic that's caught by std's `lang_start`).

Also instead of hard coding success and failure codes this uses `ExitCode::SUCCESS` and `ExitCode::FAILURE`, which in turn effectively uses `libc::EXIT_SUCCESS` and `libc::EXIT_FAILURE` (via std). These are `0` and `1` respectively for all currently supported host platforms so it doesn't actually change the exit code.
2026-02-05 08:32:43 +01:00
bjorn3 1851937577 Hard code the error code registry for custom drivers 2026-02-04 21:21:15 +00:00
Jonathan Brouwer 44a14c1f30 Convert to inline diagnostics in rustc_hir_typeck 2026-02-04 21:36:48 +01:00