about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
AgeCommit message (Collapse)AuthorLines
2023-10-25Remove support for alias `-Z instrument-coverage`Zalathar-1/+0
This flag was stabilized in rustc 1.60.0 as `-C instrument-coverage`, but the old unstable flag was kept around as an alias to ease migration.
2023-10-25Auto merge of #116482 - matthewjasper:thir-unsafeck-inline-constants, r=b-naberbors-2/+6
Fix inline const pattern unsafety checking in THIR Fix THIR unsafety checking of inline constants. - Steal THIR in THIR unsafety checking (if enabled) instead of MIR lowering. - Represent inline constants in THIR patterns.
2023-10-20s/generator/coroutine/Oli Scherer-2/+2
2023-10-20s/Generator/Coroutine/Oli Scherer-1/+1
2023-10-17Automatically enable cross-crate inlining for small functionsBen Kimock-0/+1
2023-10-17Rollup merge of #111072 - Urgau:check-cfg-new-syntax, r=petrochenkovMatthias Krüger-7/+133
Add new simpler and more explicit syntax for check-cfg <details> <summary> Old proposition (before the MCP) </summary> This PR adds a new simpler and more explicit syntax for check-cfg. It consist of two new form: - `exhaustive(names, values)` - `configure(name, "value1", "value2", ... "valueN")` The preview forms `names(...)` and `values(...)` have implicit meaning that are not strait-forward. In particular `values(foo)`&`values(bar)` and `names(foo, bar)` are not equivalent which has created [some confusions](https://github.com/rust-lang/rust/pull/98080). Also the `names()` and `values()` form are not clear either and again created some confusions where peoples believed that `values()`&`values(foo)` could be reduced to just `values(foo)`. To fix that the two new forms are made to be explicit and simpler. See the table of correspondence: - `names()` -> `exhaustive(names)` - `values()` -> `exhaustive(values)` - `names(foo)` -> `exhaustive(names)`&`configure(foo)` - `values(foo)` -> `configure(foo)` - `values(feat, "foo", "bar")` -> `configure(feat, "foo", "bar")` - `values(foo)`&`values(bar)` -> `configure(foo, bar)` - `names()`&`values()`&`values(my_cfg)` -> `exhaustive(names, values)`&`configure(my_cfg)` Another benefits of the new syntax is that it allow for further options (like conditional checking for --cfg, currently always on) without syntax change. The two previous forms are deprecated and will be removed once cargo and beta rustc have the necessary support. </details> This PR is the first part of the implementation of [MCP636 - Simplify and improve explicitness of the check-cfg syntax](https://github.com/rust-lang/compiler-team/issues/636). ## New `cfg` form It introduces the new [`cfg` form](https://github.com/rust-lang/compiler-team/issues/636) and deprecate the other two: ``` rustc --check-cfg 'cfg(name1, ..., nameN, values("value1", "value2", ... "valueN"))' ``` ## Default built-in names and values It also changes the default for the built-in names and values checking. - Built-in values checking would always be activated as long as a `--check-cfg` argument is present - Built-in names checking would always be activated as long as a `--check-cfg` argument is present **unless** if any `cfg(any())` arg is passed ~~**Note: depends on https://github.com/rust-lang/rust/pull/111068 but is reviewable (last two commits)!**~~ Resolve https://github.com/rust-lang/compiler-team/issues/636 r? `@petrochenkov`
2023-10-16Fix inline const pattern unsafety checking in THIRMatthew Jasper-2/+6
THIR unsafety checking was getting a cycle of function unsafety checking -> building THIR for the function -> evaluating pattern inline constants in the function -> building MIR for the inline constant -> checking unsafety of functions (so that THIR can be stolen) This is fixed by not stealing THIR when generating MIR but instead when unsafety checking. This leaves an issue with pattern inline constants not being unsafety checked because they are evaluated away when generating THIR. To fix that we now represent inline constants in THIR patterns and visit them in THIR unsafety checking.
2023-10-14Add `Config::hash_untracked_state` callbackAlex Macleod-2/+13
2023-10-13MCP636: Add simpler and more explicit syntax to check-cfgUrgau-7/+133
This add a new form and deprecated the other ones: - cfg(name1, ..., nameN, values("value1", "value2", ... "valueN")) - cfg(name1, ..., nameN) or cfg(name1, ..., nameN, values()) - cfg(any()) It also changes the default exhaustiveness to be enable-by-default in the presence of any --check-cfg arguments.
2023-10-13Auto merge of #115964 - bjorn3:cgu_reuse_tracker_global_state, r=cjgillotbors-2/+1
Remove cgu_reuse_tracker from Session This removes a bit of global mutable state. It will now miss post-lto cgu reuse when ThinLTO determines that a cgu doesn't get changed, but there weren't any tests for this anyway and a test for it would be fragile to the exact implementation of ThinLTO in LLVM.
2023-10-09Remove cgu_reuse_tracker from Sessionbjorn3-2/+1
This removes a bit of global mutable state
2023-10-08Remove -Zdep-tasks.Camille GILLOT-1/+0
2023-10-04introduce `Polonius` enum for `-Zpolonius`Rémy Rakic-1/+2
this allows to opt into using the legacy version or the in-tree prototype
2023-09-24Don't use a thread to load the dep graphJohn Kåre Alsaker-44/+3
2023-09-23Enable drop_tracking_mir by default.Camille GILLOT-10/+6
2023-09-22Merge `ExternProviders` into the general `Providers` structOli Scherer-17/+5
2023-09-22Have a single struct for queries and hookOli Scherer-12/+12
2023-09-22Add a way to decouple the implementation and the declaration of a TyCtxt method.Oli Scherer-5/+8
2023-09-21Move `DepKind` to `rustc_query_system` and define it as `u16`John Kåre Alsaker-1/+42
2023-09-17Auto merge of #114750 - Enselic:metadata-dep-info, r=compiler-errorsbors-7/+13
Make `.rmeta` file in `dep-info` have correct name (`lib` prefix) Since `filename_for_metadata()` and `OutputFilenames::path(OutputType::Metadata)` had different logic for the name of the metadata file, the `.d` file contained a file name different from the actual name used. Share the logic to fix the out-of-sync name. Without this fix, the `.d` file contained dash-separated_something-extra.rmeta: dash-separated.rs instead of libdash_separated_something-extra.rmeta: dash-separated.rs which is the name of the file that is actually written by the compiler. Worth noting: It took me several iterations to get all tests to pass, so I am relatively confident that this PR does not break anything. Closes #68839
2023-09-13Auto merge of #115735 - bjorn3:better_list_crate_metadata, r=wesleywiserbors-1/+1
Extend rustc -Zls This makes it show a lot more things and thus a lot more useful.
2023-09-11Rollup merge of #115730 - bjorn3:some_driver_refactors, r=compiler-errorsMatthias Krüger-0/+2
Some more small driver refactors To improve clarity and simplify some code.
2023-09-10Fix testbjorn3-1/+1
2023-09-10Deprecate the pre_configure querybjorn3-0/+2
Only deprecating it rather than making it private to just in case someone has a use case for it.
2023-09-09Use `FreezeLock` for `CStore`John Kåre Alsaker-5/+3
2023-09-08Auto merge of #113492 - nebulark:pr_96475, r=petrochenkovbors-0/+10
Add CL and CMD into to pdb debug info Partial fix for https://github.com/rust-lang/rust/issues/96475 The Arg0 and CommandLineArgs of the MCTargetOptions cpp class are not set within https://github.com/rust-lang/rust/blob/bb548f964572f7fe652716f5897d9050a31c936e/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp#L378 This causes LLVM to not neither output any compiler path (cl) nor the arguments that were used when invoking it (cmd) in the PDB file. This fix adds the missing information to the target machine so LLVM can use it.
2023-09-08Add missing Debuginfo to PDB debug file on windows.Florian Schmiderer-0/+10
Set Arg0 and CommandLineArgs in MCTargetoptions so LLVM outputs correct CL and CMD in LF_DEBUGINFO instead of empty/invalid values.
2023-09-03Make `.rmeta` file in `dep-info` have correct name (`lib` prefix)Martin Nordholts-7/+13
Since `filename_for_metadata()` and `OutputFilenames::path(OutputType::Metadata)` had different logic for the name of the metadata file, the `.d` file contained a file name different from the actual name used. Share the logic to fix the out-of-sync name. Closes 68839.
2023-09-02Rename `Freeze` to `FreezeLock`John Kåre Alsaker-2/+4
2023-09-02Add `Freeze` type and use it to store `Definitions`John Kåre Alsaker-2/+2
2023-09-01Use `OnceLock` for `SingleCache`John Kåre Alsaker-5/+5
2023-08-30Auto merge of #111713 - Zoxc:lock-switch, r=nnethercotebors-8/+28
Use conditional synchronization for Lock This changes `Lock` to use synchronization only if `mode::is_dyn_thread_safe` could be true. This reduces overhead for the parallel compiler running with 1 thread. The emitters are changed to use `DynSend` instead of `Send` so they can still use `Lock`. A Rayon thread pool is not used with 1 thread anymore, as session globals contains `Lock`s which are no longer `Sync`. Performance improvement with 1 thread and `cfg(parallel_compiler)`: <table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th></tr><tr><td align="right">Time</td><td align="right">Time</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check</td><td align="right">1.7665s</td><td align="right">1.7336s</td><td align="right">💚 -1.86%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2780s</td><td align="right">0.2736s</td><td align="right">💚 -1.61%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">0.9994s</td><td align="right">0.9824s</td><td align="right">💚 -1.70%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.5875s</td><td align="right">1.5656s</td><td align="right">💚 -1.38%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">6.0682s</td><td align="right">5.9532s</td><td align="right">💚 -1.90%</td></tr><tr><td>Total</td><td align="right">10.6997s</td><td align="right">10.5083s</td><td align="right">💚 -1.79%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9831s</td><td align="right">💚 -1.69%</td></tr></table> cc `@SparrowLii`
2023-08-30Auto merge of #114908 - cjgillot:no-let-under, r=compiler-errorsbors-3/+2
Do not compute unneeded query results. r? `@ghost`
2023-08-30Use conditional synchronization for LockJohn Kåre Alsaker-8/+28
2023-08-28Auto merge of #115267 - nikic:revert-elf-relaxation, r=compiler-errorsbors-1/+1
Revert relax_elf_relocations default change This reverts commit 441086879821d554ecdfde391e767d1a954fd5e2 (#106511). The change caused linker failures with the binutils version used by cross (#115239), as well as miscompilations when using the mold linker (https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/SIGILL.20in.20build-script-build.20with.20nightly-2023-08-25/near/387506479).
2023-08-27Rollup merge of #114974 - nbdd0121:vtable, r=b-naberGuillaume Gomez-0/+1
Add an (perma-)unstable option to disable vtable vptr This flag is intended for evaluation of trait upcasting space cost for embedded use cases. Compared to the approach in #112355, this option provides a way to evaluate end-to-end cost of trait upcasting. Rationale: https://github.com/rust-lang/rust/issues/112355#issuecomment-1658207769 ## How this flag should be used (after merge) Build your project with and without `-Zno-trait-vptr` flag. If you are using cargo, set `RUSTFLAGS="-Zno-trait-vptr"` in the environment variable. You probably also want to use `-Zbuild-std` or the binary built may be broken. Save both binaries somewhere. ### Evaluate the space cost The option has a direct and indirect impact on vtable space usage. Directly, it gets rid of the trait vptr entry needed to store a pointer to a vtable of a supertrait. (IMO) this is a small saving usually. The larger saving usually comes with the indirect saving by eliminating the vtable of the supertrait (and its parent). Both impacts only affects vtables (notably the number of functions monomorphized should , however where vtable reside can depend on your relocation model. If the relocation model is static, then vtable is rodata (usually stored in Flash/ROM together with text in embedded scenario). If the binary is relocatable, however, the vtable will live in `.data` (more specifically, `.data.rel.ro`), and this will need to reside in RAM (which may be a more scarce resource in some cases), together with dynamic relocation info living in readonly segment. For evaluation, you should run `size` on both binaries, with and without the flag. `size` would output three columns, `text`, `data`, `bss` and the sum `dec` (and it's hex version). As explained above, both `text` and `data` may change. `bss` shouldn't usually change. It'll be useful to see: * Percentage change in text + data (indicating required flash/ROM size) * Percentage change in data + bss (indicating required RAM size)
2023-08-27add rustc_abi debugging attributeRalf Jung-1/+2
2023-08-27Revert "Auto merge of #106511 - MaskRay:gotpcrelx, r=nikic"Nikita Popov-1/+1
This reverts commit 441086879821d554ecdfde391e767d1a954fd5e2, reversing changes made to 249595b7523fc07a99c1adee90b1947739ca0e5b. This causes linker failures with the binutils version used by cross (#115239), as well as miscompilations when using the mold linker.
2023-08-23Default relax_elf_relocations to trueFangrui Song-1/+1
This option tells LLVM to emit relaxable relocation types R_X86_64_GOTPCRELX/R_X86_64_REX_GOTPCRELX/R_386_GOT32X in applicable cases. True matches Clang's CMake default since 2020-08 [1] and latest LLVM default[2]. This also works around a GNU ld<2.41 issue[3] when using general-dynamic/local-dynamic TLS models in `-Z plt=no` mode with latest LLVM. [1]: https://github.com/llvm/llvm-project/commit/c41a18cf61790fc898dcda1055c3efbf442c14c0 [2]: https://github.com/llvm/llvm-project/commit/2aedfdd9b82e6c72a28576d0e8ea854f1300ff4e [3]: https://sourceware.org/bugzilla/show_bug.cgi?id=24784
2023-08-19Do not compute unneeded results.Camille GILLOT-3/+2
2023-08-18Add an (perma-)unstable option to disable vtable vptrGary Guo-0/+1
This flag is intended for evaluation of trait upcasting space cost for embedded use cases.
2023-08-14Fix review commentbjorn3-1/+1
2023-08-13Remove metadata_loader querybjorn3-4/+4
It is only used by CrateLoader. We can store the metadata loader in CStore instead which CrateLoader has access to.
2023-08-13Pass WorkProductMap to build_dep_graph instead of FxIndexMapbjorn3-9/+1
Constructing an FxIndexMap is useless work as the iteration order never matters.
2023-08-13Inline queries for crate_name, crate_types and stable_crate_idbjorn3-45/+19
All of them are not exported from rustc_interface and used only during global_ctxt(). Inlining them makes it easier to follow the order of queries and slightly reduces line count.
2023-08-11rustc: Move `features` from `Session` to `GlobalCtxt`Vadim Petrochenkov-12/+30
Removes two pieces of mutable state. Follow up to #114622.
2023-08-09rustc: Move `stable_crate_id` from `Session` to `GlobalCtxt`Vadim Petrochenkov-3/+5
Removes a piece of mutable state. Follow up to #114578.
2023-08-09rustc: Move `crate_types` from `Session` to `GlobalCtxt`Vadim Petrochenkov-6/+9
Removes a piece of mutable state. Follow up to #114578.
2023-08-07rustc_interface: Dismantle `register_plugins` queryVadim Petrochenkov-110/+100
2023-08-04Make MissingDoc a module lint.Camille GILLOT-3/+1