about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
AgeCommit message (Collapse)AuthorLines
2022-07-08Implement support for DWARF version 5.Patrick Walton-0/+1
DWARF version 5 brings a number of improvements over version 4. Quoting from the announcement [1]: > Version 5 incorporates improvements in many areas: better data compression, > separation of debugging data from executable files, improved description of > macros and source files, faster searching for symbols, improved debugging > optimized code, as well as numerous improvements in functionality and > performance. On platforms where DWARF version 5 is supported (Linux, primarily), this commit adds support for it behind a new `-Z dwarf-version=5` flag. [1]: https://dwarfstd.org/Public_Review.php
2022-07-08Rollup merge of #98533 - jyn514:drop-tracking-debugging, r=eholkDylan DPC-0/+1
Add a `-Zdump-drop-tracking-cfg` debugging flag This is useful for debugging drop-tracking; previously, you had to recompile rustc from source and manually add a call to `write_graph_to_file`. This makes the option more discoverable and configurable at runtime. I also took the liberty of making the labels for the CFG nodes much easier to read: previously, they looked like `id(2), local_id: 48`, now they look like ``` expr from_config (hir_id=HirId { owner: DefId(0:10 ~ default_struct_update[79f9]::foo), local_id: 2}) ``` r? ``@eholk``
2022-07-08Rollup merge of #95635 - davidtwco:terminal-width-stabilization, r=oli-obkMatthias Krüger-1/+0
sess: stabilize `--terminal-width` as `--diagnostic-width` Formerly `-Zterminal-width`, `--terminal-width` allows the user or build tool to inform rustc of the width of the terminal so that diagnostics can be truncated. Pending agreement to stabilize, see tracking issue at #84673. r? ```@oli-obk```
2022-07-06Make AST lowering a query.Camille GILLOT-52/+11
2022-07-06sess: stabilize `--terminal-width`David Wood-1/+0
Formerly `-Zterminal-width`, `--terminal-width` allows the user or build tool to inform rustc of the width of the terminal so that diagnostics can be truncated. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-03Auto merge of #98570 - SparrowLii:deadlock, r=cjgillotbors-14/+6
get rid of `tcx` in deadlock handler when parallel compilation This is a very obscure and hard-to-trace problem that affects thread scheduling. If we copy `tcx` to the deadlock handler thread, it will perform unpredictable behavior and cause very weird problems when executing `try_collect_active_jobs`(For example, the deadlock handler thread suddenly preempts the content of the blocked worker thread and executes the unknown judgment branch, like #94654). Fortunately we can avoid this behavior by precomputing `query_map`. This change fixes the following ui tests failure on my environment when set `parallel-compiler = true`: ``` [ui] src/test\ui\async-await\no-const-async.rs [ui] src/test\ui\infinite\infinite-struct.rs [ui] src/test\ui\infinite\infinite-tag-type-recursion.rs [ui] src/test\ui\issues\issue-3008-1.rs [ui] src/test\ui\issues\issue-3008-2.rs [ui] src/test\ui\issues\issue-32326.rs [ui] src/test\ui\issues\issue-57271.rs [ui] src/test\ui\issues\issue-72554.rs [ui] src/test\ui\parser\fn-header-semantic-fail.rs [ui] src/test\ui\union\union-nonrepresentable.rs ``` Updates #75760 Fixes #94654
2022-07-02Auto merge of #97235 - nbdd0121:unwind, r=Amanieubors-0/+1
Fix FFI-unwind unsoundness with mixed panic mode UB maybe introduced when an FFI exception happens in a `C-unwind` foreign function and it propagates through a crate compiled with `-C panic=unwind` into a crate compiled with `-C panic=abort` (#96926). To prevent this unsoundness from happening, we will disallow a crate compiled with `-C panic=unwind` to be linked into `panic-abort` *if* it contains a call to `C-unwind` foreign function or function pointer. If no such call exists, then we continue to allow such mixed panic mode linking because it's sound (and stable). In fact we still need the ability to do mixed panic mode linking for std, because we only compile std once with `-C panic=unwind` and link it regardless panic strategy. For libraries that wish to remain compile-once-and-linkable-to-both-panic-runtimes, a `ffi_unwind_calls` lint is added (gated under `c_unwind` feature gate) to flag any FFI unwind calls that will cause the linkable panic runtime be restricted. In summary: ```rust #![warn(ffi_unwind_calls)] mod foo { #[no_mangle] pub extern "C-unwind" fn foo() {} } extern "C-unwind" { fn foo(); } fn main() { // Call to Rust function is fine regardless ABI. foo::foo(); // Call to foreign function, will cause the crate to be unlinkable to panic-abort if compiled with `-Cpanic=unwind`. unsafe { foo(); } //~^ WARNING call to foreign function with FFI-unwind ABI let ptr: extern "C-unwind" fn() = foo::foo; // Call to function pointer, will cause the crate to be unlinkable to panic-abort if compiled with `-Cpanic=unwind`. ptr(); //~^ WARNING call to function pointer with FFI-unwind ABI } ``` Fix #96926 `@rustbot` label: T-compiler F-c_unwind
2022-07-02remove non_durable_rename in rustc_interface::utilYoshiki Matsuda-18/+0
2022-07-02move encode_and_write_metadata to rustc_metadata::fsYoshiki Matsuda-70/+4
2022-07-02move emit_metadata to rustc_metadata::fsYoshiki Matsuda-1/+1
2022-06-29get rid of `tcx` in deadlock handler when parallel compilationSparrowLii-14/+6
2022-06-26Add a `-Zdump-drop-tracking-cfg` debugging flagJoshua Nelson-0/+1
This is useful for debugging drop-tracking; previously, you had to recompile rustc from source and manually add a call to `write_graph_to_file`. This makes the option more discoverable and configurable at runtime. I also took the liberty of making the labels for the CFG nodes much easier to read: previously, they looked like `id(2), local_id: 48`, now they look like ``` expr from_config (hir_id=HirId { owner: DefId(0:10 ~ default_struct_update[79f9]::foo), local_id: 2}) ```
2022-06-19Rollup merge of #98165 - WaffleLapkin:once_things_renamings, r=m-ou-seMatthias Krüger-6/+6
once cell renamings This PR does the renamings proposed in https://github.com/rust-lang/rust/issues/74465#issuecomment-1153703128 - Move/rename `lazy::{OnceCell, Lazy}` to `cell::{OnceCell, LazyCell}` - Move/rename `lazy::{SyncOnceCell, SyncLazy}` to `sync::{OnceLock, LazyLock}` (I used `Lazy...` instead of `...Lazy` as it seems to be more consistent, easier to pronounce, etc) ```@rustbot``` label +T-libs-api -T-libs
2022-06-17Auto merge of #98106 - cjgillot:split-definitions, r=michaelwoeristerbors-10/+38
Split up `Definitions` and `ResolverAstLowering`. Split off https://github.com/rust-lang/rust/pull/95573 r? `@michaelwoerister`
2022-06-16Move/rename `lazy::Sync{OnceCell,Lazy}` to `sync::{Once,Lazy}Lock`Maybe Waffle-6/+6
2022-06-15Consume resolutions for lowering separately.Camille GILLOT-8/+24
2022-06-14Make ResolverAstLowering a struct.Camille GILLOT-6/+13
2022-06-14Separate Definitions and CrateStore from ResolverOutputs.Camille GILLOT-3/+8
2022-06-14Add -Zvirtual-function-elimination flagflip1995-0/+1
Adds the virtual-function-elimination unstable compiler flag and a check that this flag is only used in combination with -Clto. LLVM can only apply this optimization with fat LTO.
2022-06-13remove unnecessary `to_string` and `String::new`Takayuki Maeda-1/+1
2022-06-11Rollup merge of #97789 - ferrocene:pa-fix-issue-71363-test, r=cjgillotDylan DPC-0/+1
Fix #71363's test by adding `-Z translate-remapped-path-to-local-path=no` The test relies on `library/std/src/error.rs` not corresponding to a local path, but remapping might still find the related local file of a remapped path. To fix the test, this PR adds a new `-Z` flag to disable finding the corresponding local path of a remapped path.
2022-06-08Fix FFI-unwind unsoundness with mixed panic modeGary Guo-0/+1
2022-06-06fix #71363 test by adding `-Z translate-remapped-path-to-local-path=no`Pietro Albini-0/+1
The test relies on library/std/src/error.rs not corresponding to a local path, but remapping might still find the related local file of a remapped path. To fix the test, this adds a new -Z flag to disable finding the corresponding local path of a remapped path.
2022-06-03Fully stabilize NLLJack Huey-2/+0
2022-06-03Remove support for -Zast-json and -Zast-json-noexpandbjorn3-11/+0
2022-05-24Remove the check_mod_intrinsics queryOli Scherer-1/+0
2022-05-23typoTshepang Lekhonkhobe-1/+1
2022-05-22rustc_parse: Move AST -> TokenStream conversion logic to `rustc_ast`Vadim Petrochenkov-7/+1
2022-05-10only_local: always check for misuselcnr-4/+1
2022-05-08Move lint expectation checking into a separate query (RFC 2383)xFrednet-0/+4
2022-05-04Stabilize `bool::then_some`Josh Triplett-1/+0
2022-04-25Rollup merge of #96090 - JakobDegen:mir-tests, r=nagisaMatthias Krüger-0/+1
Implement MIR opt unit tests This implements rust-lang/compiler-team#502 . There's not much to say here, this implementation does everything as proposed. I also added the flag to a bunch of existing tests (mostly those to which I could add it without causing huge diffs due to changes in line numbers). Summarizing the changes to test outputs: - Every time an `MirPatch` is created, it adds a cleanup block to the body if it did not exist already. If this block is unused (as is usually the case), it usually gets removed soon after by some pass calling `SimplifyCFG` for unrelated reasons (in many cases this cycle happens quite a few times for a single body). We now run `SimplifyCFG` less often, so those blocks end up in some of our outputs. I looked at changing `MirPatch` to not do this, but that seemed too complicated for this PR. I may still do that in a follow-up. - The `InstCombine` test had set `-C opt-level=0` in its flags and so there were no storage markers. I don't really see a good motivation for doing this, so bringing it back in line with what everything else does seems correct. - One of the `EarlyOtherwiseBranch` tests had `UnreachableProp` running on it. Preventing that kind of thing is the goal of this feature, so this seems fine. For the remaining tests for which this feature might be useful, we can gradually migrate them as opportunities present themselves. In terms of documentation, I plan on submitting a PR to the rustc dev guide in the near future documenting this and other recent changes to MIR. If there's any other places to update, do let me know r? `@nagisa`
2022-04-23Add support for `nounused` --extern flagJeremy Fitzhardinge-0/+1
This adds `nounused` to the set of extern flags: `--extern nounused:core=/path/to/core/libcore.rlib`. The effect of this flag is to suppress `unused-crate-dependencies` warnings relating to the crate.
2022-04-17Auto merge of #95655 - kckeiks:create-hir-crate-items-query, r=cjgillotbors-19/+9
Refactor HIR item-like traversal (part 1) Issue #95004 - Create hir_crate_items query which traverses tcx.hir_crate(()).owners to return a hir::ModuleItems - use tcx.hir_crate_items in tcx.hir().items() to return an iterator of hir::ItemId - use tcx.hir_crate_items to introduce a tcx.hir().par_items(impl Fn(hir::ItemId)) to traverse all items in parallel; Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com> cc `@cjgillot`
2022-04-16Add support for MIR opt unit testsJakob Degen-0/+1
2022-04-16Rollup merge of #93969 - bjorn3:codegen_backend_dep_info, r=pnkfelixDylan DPC-4/+8
Only add codegen backend to dep info if -Zbinary-dep-depinfo is used I am currently migrating the cg_clif build system from using a binary linked to the codegen backend as rustc replacement to passing `-Zcodegen-backend` instead. Without this PR this would force cargo to rebuild the sysroot on any change to the codegen backend even if I explicitly specify that I want it to be preserved, which would make development of cg_clif a lot slower. If you still want to have changes to the codegen backend invalidate the cargo build cache you can explicitly specify `-Zbinary-dep-depinfo`. cc ``@eddyb`` as the codegen backend was initially added to the depinfo for rust-gpu.
2022-04-12sess: try sysroot candidates for fluent bundleDavid Wood-0/+15
Instead of checking only the user provided sysroot or the default (when no sysroot is provided), search user provided sysroot and then check default sysroots for locale requested by the user. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-09update Finder to store LocalDefIdMiguel Guarniz-3/+3
2022-04-09expand: Remove `ParseSess::missing_fragment_specifiers`Vadim Petrochenkov-16/+0
It was used for deduplicating some errors for legacy code which are mostly deduplicated even without that, but at cost of global mutable state, which is not a good tradeoff.
2022-04-08remove ItemLikeVisitor impls in incremental, interface, metadata and ↵Miguel Guarniz-19/+2
symbol_mangling crates Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-04-08remove some uses of visit_all_item_likes in incremental, metadata and ↵Miguel Guarniz-1/+8
interface crates Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-04-05span: move `MultiSpan`David Wood-2/+2
`MultiSpan` contains labels, which are more complicated with the introduction of diagnostic translation and will use types from `rustc_errors` - however, `rustc_errors` depends on `rustc_span` so `rustc_span` cannot use types like `DiagnosticMessage` without dependency cycles. Introduce a new `rustc_error_messages` crate that can contain `DiagnosticMessage` and `MultiSpan`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-02Address review comments and add a testJakub Beránek-1/+1
2022-04-02Include a header in .rlink files to provide nicer error messages when a ↵Jakub Beránek-3/+3
wrong file is parsed as .rlink
2022-03-31Stop emitting lints during lowering.Camille GILLOT-17/+15
2022-03-30Spellchecking compiler commentsYuri Astrakhan-1/+1
This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-24Don't include invalid paths in the depinfo for builtin backendsbjorn3-1/+5
2022-03-24Only add codegen backend to dep info if -Zbinary-dep-depinfo is usedbjorn3-4/+4
2022-03-18Auto merge of #88098 - Amanieu:oom_panic, r=nagisabors-2/+3
Implement -Z oom=panic This PR removes the `#[rustc_allocator_nounwind]` attribute on `alloc_error_handler` which allows it to unwind with a panic instead of always aborting. This is then used to implement `-Z oom=panic` as per RFC 2116 (tracking issue #43596). Perf and binary size tests show negligible impact.
2022-03-16rustc_error: make ErrorReported impossible to constructmark-17/+16
There are a few places were we have to construct it, though, and a few places that are more invasive to change. To do this, we create a constructor with a long obvious name.