about summary refs log tree commit diff
path: root/compiler/rustc_driver_impl
AgeCommit message (Collapse)AuthorLines
2024-09-27bump few depsklensy-1/+1
cargo_metadata, thorin-dwp, windows
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-16/+14
2024-09-20Auto merge of #124895 - obeis:static-mut-hidden-ref, r=compiler-errorsbors-0/+2
Disallow hidden references to mutable static Closes #123060 Tracking: - https://github.com/rust-lang/rust/issues/123758
2024-09-17Rollup merge of #129988 - arnaudgolfouse:modify-locale_resources, r=davidtwcoMatthias Krüger-1/+1
Use `Vec` in `rustc_interface::Config::locale_resources` This allows a third-party tool to injects its own resources, when receiving the config via `rustc_driver::Callbacks::config`.
2024-09-17Rollup merge of #128961 - GKFX:issue-128930-explain-missing-option, r=jieyouxuMatthias Krüger-2/+15
Fix #128930: Print documentation of CLI options missing their arg Fix #128930. Failing to give an argument to CLI options which require it now prints something like: ``` $ rustc --print error: Argument to option 'print' missing Usage: --print [crate-name|file-names|sysroot|target-libdir|cfg|check-cfg|calling-conventions|target-list|target-cpus|target-features|relocation-models|code-models|tls-models|target-spec-json|all-target-specs-json|native-static-libs|stack-protector-strategies|link-args|deployment-target] Compiler information to print on stdout ```
2024-09-13Disallow hidden references to mutable staticObei Sideg-0/+2
2024-09-13Remove unnecessary lifetime from `RunCompiler`.Nicholas Nethercote-4/+4
This does change the external interface, but not in a way that will cause any breakage because external users don't mention the lifetimes.
2024-09-11Simplify some nested if statementsMichael Goulet-4/+2
2024-09-07Auto merge of #129941 - BoxyUwU:bump-boostrap, r=albertlarsan68bors-1/+0
Bump boostrap compiler to new beta Accidentally left some comments on the update cfgs commit directly xd
2024-09-07Auto merge of #129341 - madsmtm:refactor-deployment-target, r=petrochenkovbors-3/+3
Apple: Refactor deployment target version parsing Refactor deployment target parsing to make it easier to do https://github.com/rust-lang/rust/pull/129342 (I wanted to make sure of all the places that `std::env::var` is called). Specifically, my goal was to minimize the amount of target-specific configuration, so to that end I renamed the `opts` function that generates the `TargetOptions` to `base`, and made it return the LLVM target and `target_arch` too. In the future, I would like to move even more out of the target files and into `spec::apple`, as it makes it easier for me to maintain. For example, this fixed a bug in `aarch64-apple-watchos`, which wasn't passing the deployment target as part of the LLVM triple. This (probably) fixes https://github.com/rust-lang/rust/issues/123582 and fixes https://github.com/rust-lang/rust/issues/107630. We also now parse the patch version of deployment targets, allowing the user to specify e.g. `MACOSX_DEPLOYMENT_TARGET=10.12.6`. Finally, this fixes the LLVM target name for visionOS, it should be `*-apple-xros` and not `*-apple-visionos`. Since I have changed all the Apple targets here, I smoke-tested my changes by running the following: ```console # Build each target ./x build library --target="aarch64-apple-darwin,aarch64-apple-ios,aarch64-apple-ios-macabi,aarch64-apple-ios-sim,aarch64-apple-tvos,aarch64-apple-tvos-sim,aarch64-apple-visionos,aarch64-apple-visionos-sim,aarch64-apple-watchos,aarch64-apple-watchos-sim,arm64_32-apple-watchos,arm64e-apple-ios,armv7k-apple-watchos,armv7s-apple-ios,i386-apple-ios,x86_64-apple-darwin,x86_64-apple-ios,x86_64-apple-ios-macabi,x86_64-apple-tvos,x86_64-apple-watchos-sim,x86_64h-apple-darwin" # Test that we can still at least link basic projects cargo new foobar && cd foobar && cargo +stage1 build --target=aarch64-apple-darwin --target=aarch64-apple-ios --target=aarch64-apple-ios-macabi --target=aarch64-apple-ios-sim --target=aarch64-apple-tvos --target=aarch64-apple-tvos-sim --target=aarch64-apple-visionos --target=aarch64-apple-visionos-sim --target=aarch64-apple-watchos --target=aarch64-apple-watchos-sim --target=arm64_32-apple-watchos --target=armv7s-apple-ios --target=i386-apple-ios --target=x86_64-apple-darwin --target=x86_64-apple-ios --target=x86_64-apple-ios-macabi --target=x86_64-apple-tvos --target=x86_64-apple-watchos-sim --target=x86_64h-apple-darwin ``` I couldn't build for the `arm64e-apple-darwin` target, the `armv7k-apple-watchos` and `arm64e-apple-ios` targets failed to link, and I know that the `i686-apple-darwin` target requires a bit of setup, but all of this is as it was before this PR. r? thomcc CC `@BlackHoleFox` I would recommend using `rollup=never` when merging this, in case we need to bisect this later.
2024-09-05update cfgsBoxy-1/+0
2024-09-05Use a `Vec` in `rustc_interface::Config::locale_resources`arnaudgolfouse-1/+1
This allows a third-party tool to injects its own resources, when receiving the config via `rustc_driver::Callbacks::config`.
2024-09-05Apple: Refactor deployment target version parsingMads Marquart-3/+3
- Merge minimum OS version list into one function (makes it easier to see the logic in it). - Parse patch deployment target versions. - Consistently specify deployment target in LLVM target (previously omitted on `aarch64-apple-watchos`).
2024-09-05Rollup merge of #101339 - the8472:ci-randomize-debug, r=Mark-SimulacrumMatthias Krüger-0/+5
enable -Zrandomize-layout in debug CI builds This builds rustc/libs/tools with `-Zrandomize-layout` on *-debug CI runners. Only a handful of tests and asserts break with that enabled, which is promising. One test was fixable, the rest is dealt with by disabling them through new cargo features or compiletest directives. The config.toml flag `rust.randomize-layout` defaults to false, so it has to be explicitly enabled for now.
2024-09-03rustc_driver_impl: remove some old dead logicRalf Jung-11/+2
2024-08-31disable size asserts in the compiler when randomizing layoutsThe 8472-0/+5
2024-08-28Rollup merge of #129667 - dev-ardi:rustc_driver-cleanup, r=michaelwoeristerMatthias Krüger-29/+36
Rustc driver cleanup This adds a few comments to the driver to clarify a bit what's happening and does some cleanup.
2024-08-28clarify a few thingsOrion Gonzalez-4/+8
2024-08-28cleanup make_inputOrion Gonzalez-19/+26
2024-08-28replace is_some() -> unwrap with if letOrion Gonzalez-6/+2
2024-08-27Rollup merge of #129648 - nnethercote:unreachable_pub-2, r=UrgauMatthias Krüger-0/+1
More `unreachable_pub` Add `unreachable_pub` checking to some more compiler crates. A follow-up to #126013. r? ``@Urgau``
2024-08-27Add `warn(unreachable_pub)` to `rustc_driver_impl`.Nicholas Nethercote-0/+1
2024-08-26Use unsafe extern blocks throughout the compilerMichael Goulet-1/+2
2024-08-11Fix #128930: Print documentation of CLI options missing their argGeorge Bateman-2/+15
2024-08-11Rollup merge of #128762 - fmease:use-more-slice-pats, r=compiler-errorsMatthias Krüger-30/+25
Use more slice patterns inside the compiler Nothing super noteworthy. Just replacing the common 'fragile' pattern of "length check followed by indexing or unwrap" with slice patterns for legibility and 'robustness'. r? ghost
2024-08-07Add -Zerror-metrics=PATH to save diagnostic metadata to diskJane Losare-Lusby-8/+29
2024-08-07Use more slice patterns inside the compilerLeón Orell Valerian Liehr-30/+25
2024-07-30Make RUSTC_OVERRIDE_VERSION_STRING overwrite the rendered version output, tooOli Scherer-0/+9
2024-07-29Reformat `use` declarations.Nicholas Nethercote-23/+25
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-01Move codegen_and_build_linker from Queries to Linkerbjorn3-2/+4
2024-06-30Move -Zprint-type-sizes and -Zprint-vtable-sizes into codegen_and_build_linkerbjorn3-16/+1
2024-06-25Auto merge of #126834 - bjorn3:interface_refactor, r=michaelwoeristerbors-13/+16
Various refactorings to rustc_interface This should make it easier to move the driver interface away from queries in the future. Many custom drivers call queries like `queries.global_ctxt()` before they are supposed to be called, breaking some things like certain `--print` and `-Zunpretty` options, `-Zparse-only` and emitting the dep info at the wrong point in time. They are also not actually necessary at all. Passing around the query output manually would avoid recomputation too and would be just as easy. Removing driver queries would also reduce the amount of global mutable state of the compiler. I'm not removing driver queries in this PR to avoid breaking the aforementioned custom drivers.
2024-06-24Rollup merge of #124712 - Enselic:deprecate-inline-threshold, r=pnkfelixMichael Goulet-1/+5
Deprecate no-op codegen option `-Cinline-threshold=...` This deprecates `-Cinline-threshold` since using it has no effect. This has been the case since the new LLVM pass manager started being used, more than 2 years ago. Recommend using `-Cllvm-args=--inline-threshold=...` instead. Closes #89742 which is E-help-wanted.
2024-06-22Avoid a couple of unnecessary EarlyDiagCtxt usesbjorn3-10/+9
2024-06-22Inline write_dep_info querybjorn3-3/+7
2024-06-18Use a dedicated type instead of a reference for the diagnostic contextOli Scherer-1/+2
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-14Deprecate no-op codegen option `-Cinline-threshold=...`Martin Nordholts-0/+4
This deprecates `-Cinline-threshold` since using it has no effect. This has been the case since the new LLVM pass manager started being used, more than 2 years ago.
2024-06-14Fix typo in `-Cno-stack-check` deprecation warningMartin Nordholts-1/+1
The flag `--no-stack-check` does not exist: $ rustc --no-stack-check error: Unrecognized option: 'no-stack-check'. Did you mean `-C no-stack-check`?
2024-06-12Use `tidy` to sort crate attributes for all compiler crates.Nicholas Nethercote-2/+4
We already do this for a number of crates, e.g. `rustc_middle`, `rustc_span`, `rustc_metadata`, `rustc_span`, `rustc_errors`. For the ones we don't, in many cases the attributes are a mess. - There is no consistency about order of attribute kinds (e.g. `allow`/`deny`/`feature`). - Within attribute kind groups (e.g. the `feature` attributes), sometimes the order is alphabetical, and sometimes there is no particular order. - Sometimes the attributes of a particular kind aren't even grouped all together, e.g. there might be a `feature`, then an `allow`, then another `feature`. This commit extends the existing sorting to all compiler crates, increasing consistency. If any new attribute line is added there is now only one place it can go -- no need for arbitrary decisions. Exceptions: - `rustc_log`, `rustc_next_trait_solver` and `rustc_type_ir_macros`, because they have no crate attributes. - `rustc_codegen_gcc`, because it's quasi-external to rustc (e.g. it's ignored in `rustfmt.toml`).
2024-06-11Rename std::panic::PanicInfo to PanicHookInfo.Mara Bos-5/+4
2024-06-10Remove some unused crate dependencies.Nicholas Nethercote-1/+0
I found these by setting the `unused_crate_dependencies` lint temporarily to `Warn`.
2024-06-05Make top-level `rustc_parse` functions fallible.Nicholas Nethercote-3/+3
Currently we have an awkward mix of fallible and infallible functions: ``` new_parser_from_source_str maybe_new_parser_from_source_str new_parser_from_file (maybe_new_parser_from_file) // missing (new_parser_from_source_file) // missing maybe_new_parser_from_source_file source_str_to_stream maybe_source_file_to_stream ``` We could add the two missing functions, but instead this commit removes of all the infallible ones and renames the fallible ones leaving us with these which are all fallible: ``` new_parser_from_source_str new_parser_from_file new_parser_from_source_file source_str_to_stream source_file_to_stream ``` This requires making `unwrap_or_emit_fatal` public so callers of formerly infallible functions can still work. This does make some of the call sites slightly more verbose, but I think it's worth it for the simpler API. Also, there are two `catch_unwind` calls and one `catch_fatal_errors` call in this diff that become removable thanks this change. (I will do that in a follow-up PR.)
2024-06-05Inline and remove `parse_crate{,_attrs}_from_{file,source_str}`.Nicholas Nethercote-4/+6
All four functions are simple and have a single call site. This requires making `Parser::parse_inner_attributes` public, which is no big deal.
2024-06-04Rollup merge of #125953 - nnethercote:streamline-nested-calls, r=lqdMichael Goulet-8/+2
Streamline `nested` calls. `TyCtxt` impls `PpAnn` in `compiler/rustc_middle/src/hir/map/mod.rs`. We can call that impl, which then calls the one on `intravisit::Map`, instead of calling the one on `intravisit::Map` directly, avoiding a cast and extra references. r? `@lqd`
2024-06-04Streamline `nested` calls.Nicholas Nethercote-8/+2
`TyCtxt` impls `PpAnn` in `compiler/rustc_middle/src/hir/map/mod.rs`. We can call that impl, which then calls the one on `intravisit::Map`, instead of calling the one on `intravisit::Map` directly, avoiding a cast and extra references.
2024-06-02Handle no values cfg with --print=check-cfgUrgau-7/+11
2024-05-29Make `body_owned_by` return the body directly.Oli Scherer-1/+1
Almost all callers want this anyway, and now we can use it to also return fed bodies
2024-05-29Rollup merge of #124320 - Urgau:print-check-cfg, r=petrochenkov许杰友 Jieyou Xu (Joe)-0/+33
Add `--print=check-cfg` to get the expected configs This PR adds a new `--print` variant `check-cfg` to get the expected configs. Details and rational can be found on the MCP: https://github.com/rust-lang/compiler-team/issues/743 ``@rustbot`` label +F-check-cfg +S-waiting-on-MCP r? ``@petrochenkov``
2024-05-24Exit the process a short time after entering our ctrl-c handlerBen Kimock-9/+8
2024-05-21PR feedbackBen Kimock-3/+3