about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
AgeCommit message (Collapse)AuthorLines
2024-09-05Use a `Vec` in `rustc_interface::Config::locale_resources`arnaudgolfouse-1/+3
This allows a third-party tool to injects its own resources, when receiving the config via `rustc_driver::Callbacks::config`.
2024-09-05stabilize `-Znext-solver=coherence`lcnr-1/+1
2024-09-02chore: Fix typos in 'compiler' (batch 1)Alexander Cyon-1/+1
2024-08-30make `-Z mir-include-spans` a dedicated enumRémy Rakic-4/+5
We want to allow setting this on the CLI, override it only in MIR passes, and disable it altogether in mir-opt tests. The default value is "only for NLL MIR dumps", which is considered off for all intents and purposes, except for `rustc_borrowck` when an NLL MIR dump is requested.
2024-08-29Rollup merge of #128970 - DianQK:lint-llvm-ir, r=nikicGuillaume Gomez-0/+1
Add `-Zlint-llvm-ir` This flag is similar to `-Zverify-llvm-ir` and allows us to lint the generated IR. r? compiler
2024-08-29Add `-Zlint-llvm-ir`DianQK-0/+1
2024-08-28fmt-debug optionKornel-5/+6
Allows disabling `fmt::Debug` derive and debug formatting.
2024-08-27Auto merge of #128506 - compiler-errors:by-move-body, r=cjgillotbors-0/+14
Stop storing a special inner body for the coroutine by-move body for async closures ...and instead, just synthesize an item which is treated mostly normally by the MIR pipeline. This PR does a few things: * We synthesize a new `DefId` for the by-move body of a closure, which has its `mir_built` fed with the output of the `ByMoveBody` MIR transformation, and some other relevant queries. * This has the `DefKind::ByMoveBody`, which we use to distinguish it from "real" bodies (that come from HIR) which need to be borrowck'd. Introduce `TyCtxt::is_synthetic_mir` to skip over `mir_borrowck` which is called by `mir_promoted`; borrowck isn't really possible to make work ATM since it heavily relies being called on a body generated from HIR, and is redundant by the construction of the by-move-body. * Remove the special `PassManager` hacks for handling the inner `by_move_body` stored within the coroutine's mir body. Instead, this body is fed like a regular MIR body, so it's goes through all of the `tcx.*_mir` stages normally (build -> promoted -> ...etc... -> optimized) ✨. * Remove the `InstanceKind::ByMoveBody` shim, since now we have a "regular" def id, we can just use `InstanceKind::Item`. This also allows us to remove the corresponding hacks from codegen, such as in `fn_sig_for_fn_abi` ✨. Notable remarks: * ~~I know it's kind of weird to be using `DefKind::Closure` here, since it's not a distinct closure but just a new MIR body. I don't believe it really matters, but I could also use a different `DefKind`... maybe one that we could use for synthetic MIR bodies in general?~~ edit: We're doing this now.
2024-08-27Auto merge of #129665 - matthiaskrgr:rollup-hy23k7d, r=matthiaskrgrbors-0/+1
Rollup of 8 pull requests Successful merges: - #129507 (make it possible to enable const_precise_live_drops per-function) - #129581 (exit: explain our expectations for the exit handlers registered in a Rust program) - #129634 (Fix tidy to allow `edition = "2024"` in `Cargo.toml`) - #129635 (Use unsafe extern blocks throughout the compiler) - #129645 (Fix typos in floating-point primitive type docs) - #129648 (More `unreachable_pub`) - #129649 (ABI compat check: detect unadjusted ABI mismatches) - #129652 (fix Pointer to reference conversion docs) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-27Auto merge of #129513 - cjgillot:fast-source-span, r=petrochenkovbors-5/+13
Do not call source_span when not tracking dependencies. Split from https://github.com/rust-lang/rust/pull/127241
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-27Rollup merge of #126985 - Mrmaxmeier:dwarf-embed-source, r=davidtwcoTrevor Gross-0/+1
Implement `-Z embed-source` (DWARFv5 source code embedding extension) Implement https://github.com/rust-lang/compiler-team/issues/764 MCP which adds an unstable flag that exposes LLVM's [DWARFv5 source code embedding](https://dwarfstd.org/issues/180201.1.html) support.
2024-08-27Add `warn(unreachable_pub)` to `rustc_interface`.Nicholas Nethercote-0/+1
2024-08-26Remove some unnecessary TODOsMichael Goulet-2/+0
2024-08-26Stop using a special inner body for the coroutine by-move body for async ↵Michael Goulet-0/+16
closures
2024-08-24Do not call source_span when not tracking dependencies.Camille GILLOT-5/+13
2024-08-24Fix `elided_named_lifetimes` in codePavel Grigorenko-1/+1
2024-08-16Stabilize std::thread::Builder::spawn_uncheckedDavid Tolnay-1/+0
2024-08-10rustc_interface: remove a redundant `#[allow(rustc::untranslatable_diagnostic)]`Pavel Grigorenko-1/+0
2024-08-09Rollup merge of #128851 - compiler-errors:validate-mir-opt-mir, r=matthiaskrgrMatthias Krüger-1/+7
Add comment that bors did not see pushed before it merged In #128612, bors merged 470ada2de0ec507191ad8da35b0712986646d01c instead of 1e07c19. This means it dropped a useful comment I added, and a stage rename that is more descriptive.
2024-08-09Rollup merge of #128806 - estebank:color-config, r=jieyouxuMatthias Krüger-1/+2
Split `ColorConfig` off of `HumanReadableErrorType` The previous setup tied two unrelated things together. Splitting these two is a better model. Identified by https://github.com/rust-lang/rust/pull/126597/files#r1667800754
2024-08-08Add comment that bors did not see pushed before it mergedMichael Goulet-1/+7
2024-08-08Split `ColorConfig` off of `HumanReadableErrorType`Esteban Küber-1/+2
The previous setup tied two unrelated things together. Splitting these two is a better model.
2024-08-03Make validate_mir pull optimized/ctfe MIR for all bodiesMichael Goulet-0/+7
2024-08-01Auto merge of #127543 - carbotaniuman:more_unsafe_attr_verification, ↵bors-2/+3
r=estebank,traviscross More unsafe attr verification This code denies unsafe on attributes such as `#[test]` and `#[ignore]`, while also changing the `MetaItem` parsing so `unsafe` in args like `#[allow(unsafe(dead_code))]` is not accidentally allowed. Tracking: - https://github.com/rust-lang/rust/issues/123757
2024-07-30Add toggle for `parse_meta_item` unsafe parsingcarbotaniuman-2/+3
This makes it possible for the `unsafe(...)` syntax to only be valid at the top level, and the `NestedMetaItem`s will automatically reject `unsafe(...)`.
2024-07-29Structured suggestion for `extern crate foo` when `foo` isn't resolved in importEsteban Küber-1/+7
When encountering a name in an import that could have come from a crate that wasn't imported, use a structured suggestion to suggest `extern crate foo;` pointing at the right place in the crate. When encountering `_` in an import, do not suggest `extern crate _;`. ``` error[E0432]: unresolved import `spam` --> $DIR/import-from-missing-star-3.rs:2:9 | LL | use spam::*; | ^^^^ maybe a missing crate `spam`? | help: consider importing the `spam` crate | LL + extern crate spam; | ```
2024-07-29Add `-Z embed-source=yes` to embed source code in DWARF debug infoMrmaxmeier-0/+1
2024-07-29Reformat `use` declarations.Nicholas Nethercote-61/+57
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-12Rollup merge of #126502 - cuviper:dump-mir-exclude-alloc-bytes, r=estebankJubilee-0/+1
Ignore allocation bytes in some mir-opt tests This adds `rustc -Zdump-mir-exclude-alloc-bytes` to skip writing allocation bytes in MIR dumps, and applies it to tests that were failing on s390x due to its big-endian byte order. Fixes #126261
2024-07-03Rollup merge of #127184 - bjorn3:interface_refactor2, r=NadrierilMatthias Krüger-28/+35
More refactorings to rustc_interface Follow up to https://github.com/rust-lang/rust/pull/126834
2024-07-02Rename the `asm-comments` compiler flag to `verbose-asm`Trevor Gross-1/+1
Since this codegen flag now only controls LLVM-generated comments rather than all assembly comments, make the name more accurate (and also match Clang).
2024-07-01Inline Query::default()bjorn3-8/+2
2024-07-01Minor changebjorn3-2/+2
2024-07-01Move codegen_and_build_linker from Queries to Linkerbjorn3-30/+31
2024-06-30Move -Zprint-type-sizes and -Zprint-vtable-sizes into codegen_and_build_linkerbjorn3-0/+12
2024-06-28Reduce merge conflicts from rustfmt's wrappingKornel-7/+15
2024-06-27Updated diagnostic messagesFlorian Schmiderer-1/+2
2024-06-26Add `-Zdump-mir-exclude-alloc-bytes`Josh Stone-0/+1
2024-06-25Updated code for changes to RFC, added additional error handling, addedFlorian Schmiderer-3/+6
tests
2024-06-25Support for -Z patchable-function-entryMatthew Maurer-0/+1
`-Z patchable-function-entry` works like `-fpatchable-function-entry` on clang/gcc. The arguments are total nop count and function offset. See MCP rust-lang/compiler-team#704
2024-06-25Auto merge of #126834 - bjorn3:interface_refactor, r=michaelwoeristerbors-166/+139
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-23compiler(nfc): -Cforce-frame-pointers is a FramePointerJubilee Young-3/+3
2024-06-22Ensure run_compiler always aborts on errorsbjorn3-12/+9
Before if the closure passed to run_compiler emitted an error without calling abort_if_errors and no diagnostics have been stashed, run_compiler would return normally as if no error had occured.
2024-06-22Inline write_dep_info querybjorn3-9/+2
2024-06-22Clarify visibility of several rustc_interface passesbjorn3-2/+2
2024-06-22Move has_errors_or_delayed_bugs check into start_codegenbjorn3-10/+10
2024-06-22Call check_for_rustc_errors_attr from start_codegenbjorn3-39/+39
2024-06-22Move almost all code from Queries::global_ctxt into passes::create_global_ctxtbjorn3-95/+78
2024-06-18Auto merge of #126623 - oli-obk:do_not_count_errors, r=davidtwcobors-7/+7
Replace all `&DiagCtxt` with a `DiagCtxtHandle<'_>` wrapper type r? `@davidtwco` This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle Basically I will add a field to the `DiagCtxtHandle` that refers back to the `InferCtxt`'s (and others) `Option<ErrorHandled>`, allowing us to immediately taint these contexts when emitting an error and not needing manual tainting anymore (which is easy to forget and we don't do in general anyway)