summary refs log tree commit diff
path: root/compiler/rustc_interface/src
AgeCommit message (Collapse)AuthorLines
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)
2024-06-18Use a dedicated type instead of a reference for the diagnostic contextOli Scherer-7/+7
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-18Rollup merge of #126587 - Zalathar:no-mir-spans, r=oli-obkGuillaume Gomez-1/+1
coverage: Add debugging flag `-Zcoverage-options=no-mir-spans` When set, this flag skips the code that normally extracts coverage spans from MIR statements and terminators. That sometimes makes it easier to debug branch coverage and MC/DC coverage instrumentation, because the coverage output is less noisy. For internal debugging only. If future code changes would make it hard to keep supporting this flag, it should be removed at that time. `@rustbot` label +A-code-coverage
2024-06-17coverage: Add debugging flag `-Zcoverage-options=no-mir-spans`Zalathar-1/+1
When set, this flag skips the code that normally extracts coverage spans from MIR statements and terminators. That sometimes makes it easier to debug branch coverage and MC/DC coverage, because the coverage output is less noisy. For internal debugging only. If other code changes would make it hard to keep supporting this flag, remove it.
2024-06-16Rename InstanceDef -> InstanceKindMichael Goulet-1/+1
2024-06-12Use `tidy` to sort crate attributes for all compiler crates.Nicholas Nethercote-0/+2
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-06Revert "Rollup merge of #124976 - petrochenkov:usedcrates, r=oli-obk"Rémy Rakic-1/+1
This reverts commit eda4a35f365535af72118118a3597edf5a13c12d, reversing changes made to eb6b35b5bcb3c2a594cb29cd478aeb2893f49d30.
2024-06-05Make top-level `rustc_parse` functions fallible.Nicholas Nethercote-6/+8
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-6/+9
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-03check_is_object_safe -> is_object_safeMichael Goulet-1/+1
2024-05-29Rollup merge of #124655 - Darksonn:fixed-x18, r=lqd,estebankMatthias Krüger-0/+1
Add `-Zfixed-x18` This PR is a follow-up to #124323 that proposes a different implementation. Please read the description of that PR for motivation. See the equivalent flag in [the clang docs](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-ffixed-x18). MCP: https://github.com/rust-lang/compiler-team/issues/748 Fixes https://github.com/rust-lang/rust/issues/121970 r? rust-lang/compiler
2024-05-03Add -Zfixed-x18Alice Ryhl-0/+1
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
2024-04-29coverage: Replace boolean options with a `CoverageLevel` enumZalathar-7/+7
2024-04-25debuginfo: Stabilize `-Z debug-macros`, `-Z collapse-macro-debuginfo` and ↵Vadim Petrochenkov-2/+1
`#[collapse_debuginfo]` `-Z debug-macros` is "stabilized" by enabling it by default and removing. `-Z collapse-macro-debuginfo` is stabilized as `-C collapse-macro-debuginfo`. It now supports all typical boolean values (`parse_opt_bool`) in addition to just yes/no. Default value of `collapse_debuginfo` was changed from `false` to `external` (i.e. collapsed if external, not collapsed if local). `#[collapse_debuginfo]` attribute without a value is no longer supported to avoid guessing the default.
2024-04-23Auto merge of #123126 - oli-obk:feed_crate_num, r=davidtwcobors-5/+11
Enable `CrateNum` query feeding via `TyCtxt` Instead of having a magic function that violates some `TyCtxtFeed` invariants, add a `create_def` equivalent for `CrateNum`s. Note that this still isn't tracked by the query system (unlike `create_def`), and that feeding most `CrateNum` queries for crates other than the local one will likely cause performance regressions. These things should be attempted on their own separately, but this PR should stand on its own
2024-04-23Rollup merge of #124285 - ferrocene:unstable-L-rust-builtin, r=petrochenkovLeón Orell Valerian Liehr-0/+1
Mark `@RUSTC_BUILTIN` search path usage as unstable Follow up to https://github.com/rust-lang/rust/pull/121843 r? `@petrochenkov`