about summary refs log tree commit diff
path: root/compiler/rustc_session/src/session.rs
AgeCommit message (Collapse)AuthorLines
2023-03-23Rollup merge of #107718 - Zoxc:z-time, r=nnethercoteMatthias Krüger-1/+4
Add `-Z time-passes-format` to allow specifying a JSON output for `-Z time-passes` This adds back the `-Z time` option as that is useful for [my rustc benchmark tool](https://github.com/Zoxc/rcb), reverting https://github.com/rust-lang/rust/pull/102725. It now uses nanoseconds and bytes as the units so it is renamed to `time-precise`.
2023-03-22rustc: Remove unused `Session` argument from some attribute functionsVadim Petrochenkov-35/+1
2023-03-21Add `-Z time-passes-format` to allow specifying a JSON output for `-Z ↵John Kåre Alsaker-1/+4
time-passes`
2023-03-12Auto merge of #108794 - nnethercote:avoid-unnecessary-hashing, r=cjgillotbors-0/+39
Avoid unnecessary hashing I noticed some stable hashing being done in a non-incremental build. It turns out that some of this is necessary to compute the crate hash, but some of it is not. Removing the unnecessary hashing is a perf win. r? `@cjgillot`
2023-03-08Auto merge of #108312 - michaelwoerister:hash-set-not-hash-stable, r=eholkbors-5/+5
Do not implement HashStable for HashSet (MCP 533) This PR removes all occurrences of `HashSet` in query results, replacing it either with `FxIndexSet` or with `UnordSet`, and then removes the `HashStable` implementation of `HashSet`. This is part of implementing [MCP 533](https://github.com/rust-lang/compiler-team/issues/533), that is, removing the `HashStable` implementations of all collection types with unstable iteration order. The changes are mostly mechanical. The only place where additional sorting is happening is in Miri's override implementation of the `exported_symbols` query.
2023-03-08Only compute the crate hash when necessary.Nicholas Nethercote-0/+39
The crate hash is needed: - if debug assertions are enabled, or - if incr. comp. is enabled, or - if metadata is being generated, or - if `-C instrumentation-coverage` is enabled. This commit avoids computing the crate hash when these conditions are all false, such as when doing a release build of a binary crate. It uses `Option` to store the hashes when needed, rather than computing them on demand, because some of them are needed in multiple places and computing them on demand would make compilation slower. The commit also removes `Owner::hash_without_bodies`. There is no benefit to pre-computing that one, it can just be done in the normal fashion.
2023-03-01Use FxIndexSet instead of FxHashSet for asm_target_features query.Michael Woerister-5/+5
2023-02-23Lazily compute crate name for consider_optimizingNilstrieb-3/+7
The extra query is unnecessary in the common case of not having fuel.
2023-02-22various: translation resources from cg backendDavid Wood-7/+5
Extend `CodegenBackend` trait with a function returning the translation resources from the codegen backend, which can be added to the complete list of resources provided to the emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-22errors: generate typed identifiers in each crateDavid Wood-2/+8
Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-14Add `kernel-address` sanitizer support for freestanding targetsWesley Norris-2/+2
2023-02-13Rollup merge of #107838 - estebank:terminal_hyperlinks, r=nagisaMatthias Krüger-0/+18
Introduce `-Zterminal-urls` to use OSC8 for error codes Terminals supporting the OSC8 Hyperlink Extension can support inline anchors where the text is user defineable but clicking on it opens a browser to a specified URLs, just like `<a href="URL">` does in HTML. https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
2023-02-12Rollup merge of #107748 - tshepang:renamed, r=cuviperMatthias Krüger-1/+1
refer to new home The module has since been made its own crate... see 2d75a339ca9e7cd11338b165311927e6eb73cca4.
2023-02-09Introduce `-Zterminal-urls` to use OSC8 for error codesEsteban Küber-0/+18
Terminals supporting the OSC8 Hyperlink Extension can support inline anchors where the text is user defineable but clicking on it opens a browser to a specified URLs, just like `<a href="URL">` does in HTML. https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
2023-02-09Emit an error if -Z instrument-xray is not supportedOleksii Lozovskyi-0/+4
This is somewhat important because LLVM enables the pass based on target architecture, but support by the target OS also matters. For example, XRay attributes are processed by codegen for macOS targets, but Apple linker fails to process relocations in XRay data sections, so the feature as a whole is not supported there for the time being.
2023-02-07refer to new homeTshepang Mbambo-1/+1
The module has since been made its own crate... see 2d75a339ca9e7cd11338b165311927e6eb73cca4.
2023-02-05rustc_session: remove huge error importsest31-29/+23
2023-02-02Rename `rust_2015` => `is_rust_2015`Maybe Waffle-2/+2
2023-02-01Rollup merge of #107533 - ↵Matthias Krüger-1/+1
pnkfelix:distinguish-generator-state-in-print-type-sizes, r=compiler-errors Extend `-Z print-type-sizes` to distinguish generator upvars+locals from "normal" fields. For example, for this code: ```rust async fn wait() {} async fn test(arg: [u8; 8192]) { wait().await; drop(arg); } async fn test_ideal(_rg: [u8; 8192]) { wait().await; // drop(arg); } fn main() { let gen_t = test([0; 8192]); let gen_i = test_ideal([0; 8192]); println!("expect {}, got: {}", std::mem::size_of_val(&gen_i), std::mem::size_of_val(&gen_t)); } ``` the `-Z print-type-sizes` output used to start with: ``` print-type-size type: `[async fn body@issue-62958-a.rs:3:32: 6:2]`: 16386 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Suspend0`: 16385 bytes print-type-size field `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes print-type-size field `.arg`: 8192 bytes print-type-size field `.__awaitee`: 1 bytes ... print-type-size type: `std::mem::ManuallyDrop<[u8; 8192]>`: 8192 bytes, alignment: 1 bytes print-type-size field `.value`: 8192 bytes ... ``` but with this change, it now instead prints: ``` print-type-size type: `[async fn body@issue-62958-a.rs:3:32: 6:2]`: 16386 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Suspend0`: 16385 bytes print-type-size upvar `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes print-type-size local `.arg`: 8192 bytes print-type-size local `.__awaitee`: 1 bytes ... print-type-size type: `std::mem::ManuallyDrop<[u8; 8192]>`: 8192 bytes, alignment: 1 bytes print-type-size field `.value`: 8192 bytes ``` (spawned off of investigation of https://github.com/rust-lang/rust/issues/62958 )
2023-01-31Rollup merge of #107508 - WaffleLapkin:uneq'15, r=oli-obkGuillaume Gomez-4/+5
`Edition` micro refactor r? ``@oli-obk``
2023-01-31Extend `-Z print-type-sizes` to distinguish generator upvars and locals from ↵Felix S. Klock II-1/+1
"normal" ADT fields.
2023-01-31Document `rust_2015` methodsMaybe Waffle-0/+1
2023-01-31Use `Edition` methods a bit moreMaybe Waffle-4/+4
2023-01-30session: diagnostic migration lint on more fnsDavid Wood-4/+23
Apply the diagnostic migration lint to more functions on `Session`. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-19Auto merge of #106810 - oli-obk:resolver_reverse_plumbing, r=petrochenkovbors-10/+17
Various cleanups around pre-TyCtxt queries and functions part of #105462 based on https://github.com/rust-lang/rust/pull/106776 (everything starting at [0e2b39f](https://github.com/rust-lang/rust/pull/106810/commits/0e2b39fd1ffde51b50d45ccbe41de52b85136b8b) is new in this PR) r? `@petrochenkov` I think this should be most of the uncontroversial part of #105462.
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-1/+1
2023-01-16Avoid an unnecessary allocationOli Scherer-1/+1
2023-01-16Move compiler input and ouput paths into sessionOli Scherer-10/+17
2022-12-30Add some docs to `bug`, `span_bug` and `delay_span_bug`Nilstrieb-1/+13
2022-12-20Remove wrapper functions for some unstable optionsNilstrieb-24/+0
They are trivial and just forward to the option. Like most other options, we can just access it directly.
2022-12-18don't restuct references just to reborrowMatthias Krüger-1/+1
2022-12-17Auto merge of #105421 - jacobbramley:jb/branch-prot-check, r=nagisabors-4/+8
Check AArch64 branch-protection earlier in the pipeline. As suggested in #93516. r? `@nagisa`
2022-12-10Rollup merge of #105109 - rcvalle:rust-kcfi, r=bjorn3Matthias Krüger-0/+12
Add LLVM KCFI support to the Rust compiler This PR adds LLVM Kernel Control Flow Integrity (KCFI) support to the Rust compiler. It initially provides forward-edge control flow protection for operating systems kernels for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. (See llvm/llvm-project@cff5bef.) Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue #89653). LLVM KCFI can be enabled with -Zsanitizer=kcfi. Thank you again, `@bjorn3,` `@eddyb,` `@nagisa,` and `@ojeda,` for all the help!
2022-12-08Add LLVM KCFI support to the Rust compilerRamon de C Valle-0/+12
This commit adds LLVM Kernel Control Flow Integrity (KCFI) support to the Rust compiler. It initially provides forward-edge control flow protection for operating systems kernels for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. (See llvm/llvm-project@cff5bef.) Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue #89653). LLVM KCFI can be enabled with -Zsanitizer=kcfi. Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2022-12-06Check AArch64 branch-protection earlier in the pipeline.Jacob Bramley-4/+8
As suggested in #93516.
2022-11-28Detect long types in E0308 and write them to diskEsteban Küber-0/+11
On type error with long types, print an abridged type and write the full type to disk. Print the widest possible short type while still fitting in the terminal.
2022-11-24Rollup merge of #104780 - BoxyUwU:error_reported_not_be_bad, r=oli-obkMatthias Krüger-1/+4
make `error_reported` check for delayed bugs Fixes #104768 `error_reported()` was only checking if there were errors emitted, not for `delay_bug`s which can also be a source of `ErrorGuaranteed`. I assume the same is true of `lint_err_count` but i dont know
2022-11-24make `error_reported` check for delayed bugsBoxy-1/+4
2022-11-24Auto merge of #104507 - WaffleLapkin:asderefsyou, r=wesleywiserbors-2/+2
Use `as_deref` in compiler (but only where it makes sense) This simplifies some code :3 (there are some changes that are not exacly `as_deref`, but more like "clever `Option`/`Result` method use")
2022-11-18`track_errors` use a delay_span_bugBoxy-1/+4
2022-11-16Use `as_deref` in compiler (but only where it makes sense)Maybe Waffle-2/+2
2022-11-05Rollup merge of #103660 - ozkanonur:master, r=jyn514Dylan DPC-1/+1
improve `filesearch::get_or_default_sysroot` `fn get_or_default_sysroot` is now improved and used in `miri` and `clippy`, and tests are still passing as they should. So we no longer need to implement custom workarounds/hacks to find sysroot in tools like miri/clippy. Resolves https://github.com/rust-lang/rust/issues/98832 re-opened from #103581
2022-11-04improve `filesearch::get_or_default_sysroot` r=ozkanonurOnur Özkan-1/+1
Signed-off-by: Onur Özkan <work@onurozkan.dev>
2022-11-02Rollup merge of #103610 - wesleywiser:thinlto_cgu1, r=michaelwoeristerMatthias Krüger-6/+3
Allow use of `-Clto=thin` with `-Ccodegen-units=1` in general The current logic to ignore ThinLTO when `-Ccodegen-units=1` makes sense for local ThinLTO but even in this scenario, a user may still want (non-local) ThinLTO for the purpose of optimizing dependencies into the final crate which is being compiled with 1 CGU. The previous behavior was even more confusing because if you were generating a binary (`--emit=link`), then you would get ThinLTO but if you asked for LLVM IR or bytecode, then it would silently change to using regular LTO. With this change, we only override the defaults for local ThinLTO if you ask for a single output such as LLVM IR or bytecode and in all other cases honor the requested LTO setting. r? `@michaelwoerister`
2022-11-01Auto merge of #103217 - mejrs:track, r=eholkbors-3/+42
Track where diagnostics were created. This implements the `-Ztrack-diagnostics` flag, which uses `#[track_caller]` to track where diagnostics are created. It is meant as a debugging tool much like `-Ztreat-err-as-bug`. For example, the following code... ```rust struct A; struct B; fn main(){ let _: A = B; } ``` ...now emits the following error message: ``` error[E0308]: mismatched types --> src\main.rs:5:16 | 5 | let _: A = B; | - ^ expected struct `A`, found struct `B` | | | expected due to this -Ztrack-diagnostics: created at compiler\rustc_infer\src\infer\error_reporting\mod.rs:2275:31 ```
2022-10-31Add more track_callermejrs-0/+15
2022-10-26Allow use of `-Clto=thin` with `-Ccodegen-units=1` in generalWesley Wiser-6/+3
The current logic to ignore ThinLTO when `-Ccodegen-units=1` makes sense for local ThinLTO but even in this scenario, a user may still want (non-local) ThinLTO for the purpose of optimizing dependencies into the final crate which is being compiled with 1 CGU. The previous behavior was even more confusing because if you were generating a binary (`--emit=link`), then you would get ThinLTO but if you asked for LLVM IR or bytecode, then it would silently change to using regular LTO. With this change, we only override the defaults for local ThinLTO if you ask for a single output such as LLVM IR or bytecode and in all other cases honor the requested LTO setting.
2022-10-21Rollup merge of #103051 - davidtwco:translation-tidying-up, r=compiler-errorsDylan DPC-17/+16
translation: doc comments with derives, subdiagnostic-less enum variants, more derive use - Adds support for `doc` attributes in the diagnostic derives so that documentation comments don't result in the derive failing. - Adds support for enum variants in the subdiagnostic derive to not actually correspond to an addition to a diagnostic. - Made use of the derive in more places in the `rustc_ast_lowering`, `rustc_ast_passes`, `rustc_lint`, `rustc_session`, `rustc_infer` - taking advantage of recent additions like eager subdiagnostics, multispan suggestions, etc. cc #100717
2022-10-19Implement -Ztrack-diagnosticsmejrs-3/+27
2022-10-18Remove `RunCompiler::emitter`.Nicholas Nethercote-55/+14
It's no longer used.