summary refs log tree commit diff
path: root/compiler/rustc_driver_impl
AgeCommit message (Collapse)AuthorLines
2024-11-21Rollup merge of #130236 - yaahc:unstable-feature-usage, r=estebankMatthias KrΓΌger-1/+33
unstable feature usage metrics example output ``` test-lib on ξ‚  master [?] is πŸ“¦ v0.1.0 via πŸ¦€ v1.80.1 ❯ cat src/lib.rs ───────┬─────────────────────────────────────────────────────── β”‚ File: src/lib.rs ───────┼─────────────────────────────────────────────────────── 1 β”‚ #![feature(unix_set_mark)] 2 β”‚ pub fn add(left: u64, right: u64) -> u64 { 3 β”‚ left + right 4 β”‚ } 5 β”‚ 6 β”‚ #[cfg(test)] 7 β”‚ mod tests { 8 β”‚ use super::*; 9 β”‚ 10 β”‚ #[test] 11 β”‚ fn it_works() { 12 β”‚ let result = add(2, 2); 13 β”‚ assert_eq!(result, 4); 14 β”‚ } 15 β”‚ } ───────┴─────────────────────────────────────────────────────── test-lib on ξ‚  master [?] is πŸ“¦ v0.1.0 via πŸ¦€ v1.80.1 ❯ cargo +stage1 rustc -- -Zmetrics-dir=$PWD/metrics Compiling test-lib v0.1.0 (/home/yaahc/tmp/test-lib) Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.08s test-lib on ξ‚  master [?] is πŸ“¦ v0.1.0 via πŸ¦€ v1.80.1 ❯ cat metrics/unstable_feature_usage.json ───────┬───────────────────────────────────────────────────────────────────── β”‚ File: metrics/unstable_feature_usage.json ───────┼───────────────────────────────────────────────────────────────────── 1 β”‚ {"lib_features":[{"symbol":"unix_set_mark"}],"lang_features":[]} ``` related to https://github.com/rust-lang/rust/issues/129485
2024-11-21Rewrite `show_md_content_with_pager`.Nicholas Nethercote-49/+43
I think the control flow in this function is complicated and confusing, largely due to the use of two booleans `print_formatted` and `fallback_to_println` that are set in multiple places and then used to guide proceedings. As well as hurting readability, this leads to at least one bug: if the `write_termcolor_buf` call fails and the pager also fails, the function will try to print color output to stdout, but that output will be empty because `write_termcolor_buf` failed. I.e. the `if fallback_to_println` body fails to check `print_formatted`. This commit rewrites the function to be neater and more Rust-y, e.g. by putting the result of `write_termcolor_buf` into an `Option` so it can only be used on success, and by using `?` more. It also changes terminology a little, using "pretty" to mean "formatted and colorized". The result is a little shorter, more readable, and less buggy.
2024-11-21Remove redundant `is_terminal` check.Nicholas Nethercote-2/+1
It's not necessary because `show_md_content_with_pager` is only ever called if `is_terminal` is true.
2024-11-21Fix `catbat` pager typo.Nicholas Nethercote-1/+1
`bat` is known as `batcat` on Ubuntu and Debian, not `catbat`.
2024-11-20unstable feature usage metricsJane Losare-Lusby-1/+33
2024-11-18Make rustc --explain busybox less compatibleomni-1/+1
busybox less does not support the -r flag and less(1) says: USE OF THE -r OPTION IS NOT RECOMMENDED.
2024-11-12Auto merge of #132282 - Noratrieb:it-is-the-end-of-serial, r=cjgillotbors-5/+0
Delete the `cfg(not(parallel))` serial compiler Since it's inception a long time ago, the parallel compiler and its cfgs have been a maintenance burden. This was a necessary evil the allow iteration while not degrading performance because of synchronization overhead. But this time is over. Thanks to the amazing work by the parallel working group (and the dyn sync crimes), the parallel compiler has now been fast enough to be shipped by default in nightly for quite a while now. Stable and beta have still been on the serial compiler, because they can't use `-Zthreads` anyways. But this is quite suboptimal: - the maintenance burden still sucks - we're not testing the serial compiler in nightly Because of these reasons, it's time to end it. The serial compiler has served us well in the years since it was split from the parallel one, but it's over now. Let the knight slay one head of the two-headed dragon! #113349 Note that the default is still 1 thread, as more than 1 thread is still fairly broken. cc `@onur-ozkan` to see if i did the bootstrap field removal correctly, `@SparrowLii` on the sync parts
2024-11-12Delete the `cfg(not(parallel))` serial compilerNoratrieb-5/+0
Since it's inception a long time ago, the parallel compiler and its cfgs have been a maintenance burden. This was a necessary evil the allow iteration while not degrading performance because of synchronization overhead. But this time is over. Thanks to the amazing work by the parallel working group (and the dyn sync crimes), the parallel compiler has now been fast enough to be shipped by default in nightly for quite a while now. Stable and beta have still been on the serial compiler, because they can't use `-Zthreads` anyways. But this is quite suboptimal: - the maintenance burden still sucks - we're not testing the serial compiler in nightly Because of these reasons, it's time to end it. The serial compiler has served us well in the years since it was split from the parallel one, but it's over now. Let the knight slay one head of the two-headed dragon!
2024-11-11Remove `rustc_session::config::rustc_short_optgroups`Zalathar-2/+5
2024-11-08Use a method to apply `RustcOptGroup` to `getopts::Options`Zalathar-3/+3
2024-11-03make time format parsing compiletimeklensy-3/+3
2024-11-02Add `--print host-triple`Noratrieb-0/+1
People often parse `-vV` output to get to the host triple, which is annoying to do. It's easier to just get it directly.
2024-11-02Rename target triple to target tuple in many places in the compilerNoratrieb-7/+7
This changes the naming to the new naming, used by `--print target-tuple`. It does not change all locations, but many.
2024-11-01Emit diagnostics for incorrect deployment targetsMads Marquart-3/+4
2024-11-01Move versioned LLVM target creation to rustc_codegen_ssaMads Marquart-3/+2
The OS version depends on the deployment target environment variables, the access of which we want to move to later in the compilation pipeline that has access to more information, for example `env_depinfo`.
2024-10-28fix clippy::clone_on_ref_ptr for compilerklensy-1/+1
2024-10-07Rollup merge of #130899 - bjorn3:wasi_bootstrap_fixes, r=davidtwcoJubilee-4/+3
Couple of changes to make it easier to compile rustc for wasm This is a subset of the patches I have on my rust fork to compile rustc for wasm32-wasip1.
2024-10-06Update out-dated linkmu001999-1/+1
2024-10-04Avoid unused import warning for the Ctrl-C handler on wasmbjorn3-4/+3
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