440 Commits

Author SHA1 Message Date
bjorn3
1991779bd4 Make llvm_enzyme a regular cargo feature
This makes it clearer that it is set by the build system rather than by
the rustc that compiles the current rustc. It also avoids bootstrap
needing to pass --check-cfg llvm_enzyme to rustc.
2025-09-15 15:31:56 +00:00
Noratrieb
f157ce994e Add --print target-spec-json-schema
This schema is helpful for people writing custom target spec JSON. It
can provide autocomplete in the editor, and also serves as documentation
when there are documentation comments on the structs, as `schemars` will
put them in the schema.
2025-09-12 20:53:28 +02:00
León Orell Valerian Liehr
7a66925a81
Strip frontmatter in fewer places 2025-09-09 19:49:40 +02:00
Stuart Cook
6f490f7ae1
Rollup merge of #146112 - scrabsha:push-utkysktvulto, r=WaffleLapkin
don't uppercase error messages
2025-09-04 10:01:59 +10:00
Sasha Pourcelot
5c4b61b4b4 don't uppercase error messages
a more general version of https://github.com/rust-lang/rust/pull/146080.

after a bit of hacking in [`fluent.rs`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_fluent_macro/src/fluent.rs), i discovered that i'm not the only one that is bad at following guidelines 😅. this pr lowercases the first letter of all the error messages in the codebase.

(i did not change things that are traditionally uppercased such as _MIR_, _ABI_ or _C_)

i think it's reasonable to run a `@bors try` so all the test suite is checked, as i cannot run some of the tests on my machine. i double checked (and replaced manually) all the old error messages, but better be safe than sorry.

in the future i will try to add a check in `x test tidy` that errors if an error message starts with an uppercase letter.
2025-09-03 15:24:49 +02:00
Nicholas Nethercote
301655eafe Revert introduction of [workspace.dependencies].
This was done in #145740 and #145947. It is causing problems for people
using r-a on anything that uses the rustc-dev rustup package, e.g. Miri,
clippy.

This repository has lots of submodules and subtrees and various
different projects are carved out of pieces of it. It seems like
`[workspace.dependencies]` will just be more trouble than it's worth.
2025-09-02 19:12:54 +10:00
Nicholas Nethercote
daf6fe2c1b Add serde_json to [workspace.dependencies]. 2025-08-28 20:10:54 +10:00
Nicholas Nethercote
12dc789bc6 Add libc to [workspace.dependencies]. 2025-08-28 20:10:54 +10:00
Nicholas Nethercote
c50d2cc807 Add tracing to [workspace.dependencies]. 2025-08-27 14:21:19 +10:00
Nicholas Nethercote
704f2ca172 Tidy up Cargo.toml files.
- Add some missing `tidy-alphabetical-*` markers.
- Remove some unnecessary blank lines.
2025-07-31 19:58:04 +10:00
Matthias Krüger
26f5936cf9
Rollup merge of #143719 - xizheyin:142812-1, r=jieyouxu
Emit warning when there is no space between `-o` and arg

Closes rust-lang/rust#142812

`getopt` doesn't seem to have an API to check this, so we have to check the args manually.

r? compiler
2025-07-18 04:27:51 +02:00
xizheyin
af39c0c57c
Emit warning when there is no space between -o and confusing arg
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-16 23:40:49 +08:00
Makai
6598c61725 rename stable_mir to rustc_public, and rustc_smir to rustc_public_bridge 2025-07-14 09:25:54 +00:00
bjorn3
87958ad683 Avoid building C++ for rustc_llvm with --compile-time-deps
This saves about 30s.
2025-07-11 13:32:03 +00:00
Matthias Krüger
8b8cd35edc
Rollup merge of #143019 - danielframpton:codegen-backend-parse, r=bjorn3
Ensure -V --verbose processes both codegen_backend and codegen-backend
2025-06-30 20:49:40 +02:00
Daniel Frampton
bb65bc8cba Ensure -V --verbose processes both codegen_backend and codegen-backend 2025-06-30 11:11:00 -07:00
Vadim Petrochenkov
0be37cab97 rustc_session: Add a structure for keeping both explicit and default sysroots
Also avoid creating and cloning sysroot unnecessarily.
2025-06-24 16:00:04 +03:00
Trevor Gross
38600a6640
Rollup merge of #142650 - camsteffen:refactor-translator, r=petrochenkov
Refactor Translator

My main motivation was to simplify the usage of `SilentEmitter` for users like rustfmt. A few refactoring opportunities arose along the way.

* Replace `Translate` trait with `Translator` struct
* Replace `Emitter: Translate` with `Emitter::translator`
* Split `SilentEmitter` into `FatalOnlyEmitter` and `SilentEmitter`
2025-06-20 13:36:01 -04:00
Trevor Gross
dd41c06e27
Rollup merge of #142687 - cjgillot:less-hir_crate, r=oli-obk
Reduce uses of `hir_crate`.

I tried rebasing my old incremental-HIR branch. This is a by-product, which is required if we want to get rid of `hir_crate` entirely.

The second commit is a drive-by cleanup. It can be pulled into its own PR.

r? ````@oli-obk````
2025-06-20 02:50:40 -04:00
Cameron Steffen
07b9bb1855 Extract Translator struct 2025-06-19 13:02:04 -05:00
Camille GILLOT
c6e77b3ba6 Reduce uses of hir_crate. 2025-06-18 15:46:19 +00:00
León Orell Valerian Liehr
0b249d3f85
Rollup merge of #141769 - bjorn3:codegen_metadata_module_rework, r=workingjubilee,saethlin
Move metadata object generation for dylibs to the linker code

This deduplicates some code between codegen backends and may in the future allow adding extra metadata that is only known at link time.

Prerequisite of https://github.com/rust-lang/rust/issues/96708.
2025-06-15 23:51:54 +02:00
Stypox
781baafbe4
Add documentation for init_logger_with_additional_layer 2025-06-12 12:11:15 +02:00
Stypox
fc96ca8bba
Use closure to allow passing custom tracing layers
The previous method, where a layer would be passed directly,
required to pass a "no-op" layer when no custom layer was needed.
This should have in theory worked, however having a no-op layer
seems to change the way the tracing lib applies filters internally,
leading to some debug!() being printed despite them being out of
the minimum level for the filters. Note however that this behavior
was very inconsistent, and e.g. some debug!() would get printed
and some others wouldn't, for no apparent reason.
2025-06-11 10:42:50 +02:00
Stypox
0d74252537
Allow initializing logger with additional tracing Layer 2025-06-11 10:41:22 +02:00
bjorn3
badabab01f Only borrow EncodedMetadata in codegen_crate
And move passing it to the linker to the driver code.
2025-06-03 10:04:34 +00:00
Jacob Pratt
241ec137fb
Rollup merge of #141072 - Rynibami:stabilize-const-result-flatten, r=jhpratt
Stabilize feature `result_flattening`

Stabilizes the `Result::flatten` method

## Implementations

- [x] Implementation `Result::flatten`: https://github.com/rust-lang/rust/pull/70140
- [x] Implementation `const` `Result::flatten`: https://github.com/rust-lang/rust/pull/130692
- [x] Update stabilization attribute macros (this PR)

## Stabilization process

- [x] Created this PR [suggested](https://github.com/rust-lang/rust/issues/70142#issuecomment-2885044548) by ``@RalfJung``
- [x] FCP (haven't found any, is it applicable here?)
- [ ] Close issue rust-lang/rust#70142
2025-06-01 00:35:50 +02:00
klensy
9cacafdd1a compiler & tools: bump windows crate to dedupe versions 2025-05-17 15:26:38 +03:00
Ryan van Polen
4c2d3bc8bd Removed feature flag from compiler/rustc_driver_impl 2025-05-16 12:00:44 +02:00
Pietro Albini
2ce08ca5d6
update cfg(bootstrap) 2025-05-12 15:33:37 +02:00
Kivooeo
3c1c0726ad added error handle for error code > 9999 2025-05-06 23:02:47 +05:00
Stuart Cook
7ea3350902
Rollup merge of #140532 - celinval:chores-smir-ra, r=oli-obk
Fix RustAnalyzer discovery of rustc's `stable_mir` crate

This fixes issues with RustAnalyzer not finding `stable_mir` crate since RA discovery traverses the dependency graph of `rustc_driver` crate.

This change also aligns with the long term architecture plan for these crates, since we are moving towards having stable_mir depend on rustc_smir and not the other way around. See [this doc](https://hackmd.io/jBRkZLqAQL2EVgwIIeNMHg) for more details.

I believe a similar function will come handy eventually for `stable_mir` users, but I'm keeping it as part of `rustc_internal` since its current format initializes the StableMir context and requires `TyCtxt`.

Finally, I added the `rustc_internal` module re-export under a feature since the APIs from this module shall not be stabilized.
2025-05-06 16:28:41 +10:00
Bryanskiy
14535312b5 Initial support for dynamically linked crates 2025-05-04 22:03:15 +03:00
Celina G. Val
0f81fca8ec Change rustc_driver dependency on stable_mir crate
This fixes issues with RustAnalyzer not finding stable_mir crate.
It is also part of the long term architecture plan for these crates,
since we are moving towards having stable_mir depend on rustc_smir and
not the other way around.

I believe this is an utility function that will come handy eventually
for stable_mir users, but I'm keeping it as part of rustc_internal since
it initializes the StableMir context and requires `TyCtxt`.

Finally, I added the rustc_internal crate under a feature since the APIs
from this module shall not be stabilized.
2025-04-30 15:39:52 -07:00
est31
7493e1cdf6 Make #![feature(let_chains)] bootstrap conditional in compiler/ 2025-04-23 16:40:30 +02:00
bors
f836ae4e66 Auto merge of #124141 - nnethercote:rm-Nonterminal-and-TokenKind-Interpolated, r=petrochenkov
Remove `Nonterminal` and `TokenKind::Interpolated`

A third attempt at this; the first attempt was #96724 and the second was #114647.

r? `@ghost`
2025-04-14 03:56:55 +00:00
Chris Denton
0149a43f8a
Rollup merge of #139315 - clubby789:deranged-bump, r=Mark-Simulacrum
Switch `time` to `jiff` for time formatting in ICE dumps

Due to https://github.com/jhpratt/deranged/issues/21, Clippy, R-A and Miri currently fail to build if we bump to 0.4.1, pulled in via `time`. ~~Add some specific type annotations so we don't have to just pin it.~~

~~I can open 3 PRs to the tool repos if preferred, but I thought it might be easier to do this than to pin the transitive dep and go back and remove it once the changes are synced back.~~
2025-04-12 21:05:28 +00:00
Stuart Cook
0abc6c6e98
Rollup merge of #138682 - Alexendoo:extra-symbols, r=fee1-dead
Allow drivers to supply a list of extra symbols to intern

Allows adding new symbols as `const`s in external drivers, desirable in Clippy so we can use them in patterns to replace code like 75530e9f72/src/tools/clippy/clippy_lints/src/casts/cast_ptr_alignment.rs (L66)

The Clippy change adds a couple symbols as a demo, the exact `clippy_utils` API and replacing other usages can be done on the Clippy side to minimise sync conflicts

---

try-job: aarch64-gnu
2025-04-11 13:31:44 +10:00
Alex Macleod
f740326216 Allow drivers to supply a list of extra symbols to intern 2025-04-10 13:39:23 +00:00
Jane Losare-Lusby
6f55015835 fix "still mutable" ice while metrics are enabled 2025-04-08 15:00:37 -07:00
bors
f5c510260b Auto merge of #138947 - madsmtm:refactor-apple-versions, r=Noratrieb
Refactor Apple version handling in the compiler

Move various Apple version handling code in the compiler out `rustc_codegen_ssa` and into a place where it can be accessed by `rustc_attr_parsing`, which I found to be necessary when doing https://github.com/rust-lang/rust/pull/136867. Thought I'd split it out to make it easier to land, and to make further changes like https://github.com/rust-lang/rust/pull/131477 have fewer conflicts / PR dependencies.

There should be no functional changes in this PR.

`@rustbot` label O-apple
r? rust-lang/compiler
2025-04-06 10:16:28 +00:00
clubby789
41fcdab3b5 Switch time to jiff for time formatting in ICE dumps 2025-04-05 09:52:55 +00:00
Stuart Cook
ae745a06fa
Rollup merge of #138950 - yaahc:svh-metrics-name, r=bjorn3
replace extra_filename with strict version hash in metrics file names

Should resolve the potential issue of overwriting metrics from the same crate when compiled with different features or flags.

r? `````@estebank`````

try-job: test-various
2025-04-05 13:18:15 +11:00
Mads Marquart
7e4379c4eb refactor: Move env parsing of deployment target to rustc_session 2025-04-04 15:02:22 +02:00
Mads Marquart
d74ce25b65 refactor: Move Apple OSVersion (back) to rustc_target
Also convert OSVersion into a proper struct for better type-safety.
2025-04-04 15:01:27 +02:00
Matthias Krüger
66e61c78e7
Rollup merge of #138949 - madsmtm:rename-to-darwin, r=WaffleLapkin
Rename `is_like_osx` to `is_like_darwin`

Replace `is_like_osx` with `is_like_darwin`, which more closely describes reality (OS X is the pre-2016 name for macOS, and is by now quite outdated; Darwin is the overall name for the OS underlying Apple's macOS, iOS, etc.).

``@rustbot`` label O-apple
r? compiler
2025-04-04 08:02:05 +02:00
Oli Scherer
805f389da5 Remove LintExpectationId from Level variants 2025-04-03 09:22:21 +00:00
Nicholas Nethercote
1830245a22 Remove recursion_limit increases.
These are no longer needed now that `Nonterminal` is gone.
2025-04-02 16:25:27 +11:00
Jane Losare-Lusby
6ce74f78f0 replace extra_filename with strict version hash in metrics file names 2025-04-01 12:12:14 -07:00
Urgau
df18de57a5 Add unstable --print=crate-root-lint-levels 2025-04-01 18:29:39 +02:00