summary refs log tree commit diff
path: root/compiler/rustc_driver_impl
AgeCommit message (Collapse)AuthorLines
2025-06-20Rollup merge of #142650 - camsteffen:refactor-translator, r=petrochenkovTrevor Gross-3/+7
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-20Rollup merge of #142687 - cjgillot:less-hir_crate, r=oli-obkTrevor Gross-1/+5
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-19Extract Translator structCameron Steffen-3/+7
2025-06-18Reduce uses of `hir_crate`.Camille GILLOT-1/+5
2025-06-15Rollup merge of #141769 - bjorn3:codegen_metadata_module_rework, ↵León Orell Valerian Liehr-21/+28
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-12Add documentation for init_logger_with_additional_layerStypox-1/+6
2025-06-11Use closure to allow passing custom tracing layersStypox-5/+7
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-11Allow initializing logger with additional tracing LayerStypox-0/+11
2025-06-03Only borrow EncodedMetadata in codegen_cratebjorn3-21/+28
And move passing it to the linker to the driver code.
2025-06-01Rollup merge of #141072 - Rynibami:stabilize-const-result-flatten, r=jhprattJacob Pratt-1/+0
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-05-17compiler & tools: bump windows crate to dedupe versionsklensy-1/+1
2025-05-16Removed feature flag from `compiler/rustc_driver_impl`Ryan van Polen-1/+0
2025-05-12update cfg(bootstrap)Pietro Albini-1/+0
2025-05-06added error handle for error code > 9999Kivooeo-0/+1
2025-05-06Rollup merge of #140532 - celinval:chores-smir-ra, r=oli-obkStuart Cook-2/+2
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-04Initial support for dynamically linked cratesBryanskiy-2/+5
2025-04-30Change rustc_driver dependency on stable_mir crateCelina G. Val-2/+2
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-23Make #![feature(let_chains)] bootstrap conditional in compiler/est31-1/+1
2025-04-14Auto merge of #124141 - ↵bors-1/+0
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-12Rollup merge of #139315 - clubby789:deranged-bump, r=Mark-SimulacrumChris Denton-11/+4
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-11Rollup merge of #138682 - Alexendoo:extra-symbols, r=fee1-deadStuart Cook-0/+1
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 https://github.com/rust-lang/rust/blob/75530e9f72a1990ed2305e16fd51d02f47048f12/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-10Allow drivers to supply a list of extra symbols to internAlex Macleod-0/+1
2025-04-08fix "still mutable" ice while metrics are enabledJane Losare-Lusby-4/+4
2025-04-06Auto merge of #138947 - madsmtm:refactor-apple-versions, r=Noratriebbors-3/+2
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-05Switch `time` to `jiff` for time formatting in ICE dumpsclubby789-11/+4
2025-04-05Rollup merge of #138950 - yaahc:svh-metrics-name, r=bjorn3Stuart Cook-8/+5
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-04refactor: Move env parsing of deployment target to rustc_sessionMads Marquart-3/+2
2025-04-04refactor: Move Apple OSVersion (back) to rustc_targetMads Marquart-1/+1
Also convert OSVersion into a proper struct for better type-safety.
2025-04-04Rollup merge of #138949 - madsmtm:rename-to-darwin, r=WaffleLapkinMatthias Krüger-1/+1
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-03Remove `LintExpectationId` from `Level` variantsOli Scherer-1/+1
2025-04-02Remove `recursion_limit` increases.Nicholas Nethercote-1/+0
These are no longer needed now that `Nonterminal` is gone.
2025-04-01replace extra_filename with strict version hash in metrics file namesJane Losare-Lusby-8/+5
2025-04-01Add unstable `--print=crate-root-lint-levels`Urgau-0/+28
2025-03-25Rename `is_like_osx` to `is_like_darwin`Mads Marquart-1/+1
2025-03-23Implement `supported-crate-types` print requestJieyou Xu-2/+12
As an unstable print request.
2025-03-21Move some calls to before calling codegen_cratebjorn3-1/+15
`--emit mir`, `#[rustc_symbol_name]` and `#[rustc_def_path]` now run before codegen and thus work even if codegen fails. This can help with debugging.
2025-03-21Move make_input callbjorn3-12/+7
2025-03-20Use `-Wunused_crate_dependencies` for compiler crates.Nicholas Nethercote-1/+9
It's very useful. There are some false positives involving integration tests in `rustc_pattern_analysis` and `rustc_serialize`. There is also a false positive involving `rustc_driver_impl`'s `rustc_randomized_layouts` feature. And I removed a `rustc_span` mention in a doc comment in `rustc_log` because it wasn't integral to the comment but caused a dev-dependency.
2025-03-17Auto merge of #138566 - yotamofek:pr/strip-prefix, r=nnethercotebors-2/+1
Use `strip_{prefix|suffix}` instead of `{starts|ends}_with`+indexing Randomly scratching an itch 😁
2025-03-17Use `strip_{prefix|suffix}` instead of `{starts|ends}_with`+indexingYotam Ofek-2/+1
2025-03-16Rename `PrintKind::{AllTargetSpecs,TargetSpec}` to ↵Jieyou Xu-2/+2
`{AllTargetSpecsJson,TargetSpecJson}` To correspond to their actual print request names, `target-spec-json` and `all-target-specs-json`, and for consistency with other print name <-> print kind mappings.
2025-03-13Auto merge of #138416 - Manishearth:rollup-fejor9p, r=Manishearthbors-2/+1
Rollup of 12 pull requests Successful merges: - #134076 (Stabilize `std::io::ErrorKind::InvalidFilename`) - #137504 (Move methods from Map to TyCtxt, part 4.) - #138175 (Support rmeta inputs for --crate-type=bin --emit=obj) - #138259 (Disentangle `ForwardGenericParamBan` and `ConstParamTy` ribs) - #138280 (fix ICE in pretty-printing `global_asm!`) - #138318 (Rustdoc: remove a bunch of `@ts-expect-error` from main.js) - #138331 (Use `RUSTC_LINT_FLAGS` more) - #138357 (merge `TypeChecker` and `TypeVerifier`) - #138394 (remove unnecessary variant) - #138403 (Delegation: one more ICE fix for `MethodCall` generation) - #138407 (Delegation: reject C-variadics) - #138409 (Use sa_sigaction instead of sa_union.__su_sigaction for AIX) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-12Auto merge of #138414 - matthiaskrgr:rollup-9ablqdb, r=matthiaskrgrbors-1/+0
Rollup of 7 pull requests Successful merges: - #137314 (change definitely unproductive cycles to error) - #137701 (Convert `ShardedHashMap` to use `hashbrown::HashTable`) - #138269 (uefi: fs: Implement FileType, FilePermissions and FileAttr) - #138331 (Use `RUSTC_LINT_FLAGS` more) - #138345 (Some autodiff cleanups) - #138387 (intrinsics: remove unnecessary leading underscore from argument names) - #138390 (fix incorrect tracing log) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-12Rollup merge of #138331 - nnethercote:use-RUSTC_LINT_FLAGS-more, ↵Manish Goregaokar-1/+0
r=onur-ozkan,jieyouxu Use `RUSTC_LINT_FLAGS` more An alternative to the failed #138084. Fixes #138106. r? `````@jieyouxu`````
2025-03-12Move methods from `Map` to `TyCtxt`, part 4.Nicholas Nethercote-2/+1
Continuing the work from #137350. Removes the unused methods: `expect_variant`, `expect_field`, `expect_foreign_item`. Every method gains a `hir_` prefix.
2025-03-11Remove `#![warn(unreachable_pub)]` from all `compiler/` crates.Nicholas Nethercote-1/+0
It's no longer necessary now that `-Wunreachable_pub` is being passed.
2025-03-10Revert "Use workspace lints for crates in `compiler/` #138084"许杰友 Jieyou Xu (Joe)-3/+1
Revert <https://github.com/rust-lang/rust/pull/138084> to buy time to consider options that avoids breaking downstream usages of cargo on distributed `rustc-src` artifacts, where such cargo invocations fail due to inability to inherit `lints` from workspace root manifest's `workspace.lints` (this is only valid for the source rust-lang/rust workspace, but not really the distributed `rustc-src` artifacts). This breakage was reported in <https://github.com/rust-lang/rust/issues/138304>. This reverts commit 48caf81484b50dca5a5cebb614899a3df81ca898, reversing changes made to c6662879b27f5161e95f39395e3c9513a7b97028.
2025-03-08Remove `#![warn(unreachable_pub)]` from all `compiler/` crates.Nicholas Nethercote-1/+0
(Except for `rustc_codegen_cranelift`.) It's no longer necessary now that `unreachable_pub` is in the workspace lints.
2025-03-08Specify rust lints for `compiler/` crates via Cargo.Nicholas Nethercote-0/+3
By naming them in `[workspace.lints.rust]` in the top-level `Cargo.toml`, and then making all `compiler/` crates inherit them with `[lints] workspace = true`. (I omitted `rustc_codegen_{cranelift,gcc}`, because they're a bit different.) The advantages of this over the current approach: - It uses a standard Cargo feature, rather than special handling in bootstrap. So, easier to understand, and less likely to get accidentally broken in the future. - It works for proc macro crates. It's a shame it doesn't work for rustc-specific lints, as the comments explain.
2025-03-07Increase recursion_limit in numerous crates.Nicholas Nethercote-0/+1
This is temporarily needed for `x doc compiler` to work. They can be removed once the `Nonterminal` is removed (#124141).