about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
AgeCommit message (Collapse)AuthorLines
2023-12-05Remove deprecated --check-cfg names() and values() syntaxUrgau-157/+83
2023-12-05rustc_interface: Address all `rustc::potential_query_instability` lintsMartin Nordholts-1/+7
Instead of allowing `rustc::potential_query_instability` on the whole crate we go over each lint and allow it individually if it is safe to do. Turns out all instances were safe to allow in this crate.
2023-12-05Factor out some repeated code.Nicholas Nethercote-14/+10
2023-12-02Use `Session::diagnostic` in more places.Nicholas Nethercote-3/+1
2023-12-02Rename `HandlerInner::delay_span_bug` as `HandlerInner::span_delayed_bug`.Nicholas Nethercote-3/+3
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug` follows the pattern used everywhere else: `span_err`, `span_warning`, etc.
2023-11-30Add `-Zfunction-return={keep,thunk-extern}` optionMiguel Ojeda-4/+6
This is intended to be used for Linux kernel RETHUNK builds. With this commit (optionally backported to Rust 1.73.0), plus a patched Linux kernel to pass the flag, I get a RETHUNK build with Rust enabled that is `objtool`-warning-free and is able to boot in QEMU and load a sample Rust kernel module. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-11-28resolve: Feed the `def_kind` query immediately on `DefId` creationVadim Petrochenkov-0/+4
2023-11-27QueryContext: rename try_collect_active_jobs -> collect_active_jobs and ↵klensy-5/+2
change it's return type from Option<QueryMap> to QueryMap As there currently always Some(...) inside
2023-11-27Auto merge of #117584 - bjorn3:eager_output_filenames, r=b-naberbors-39/+31
Eagerly compute output_filenames It can be computed before creating TyCtxt. Previously the query would also write the dep info file, which meant that the output filenames couldn't be accessed before macro expansion is done. The dep info file writing is now done as a separate non-query function. The old query was always executed again anyways due to depending on the HIR. Also encode the output_filenames in rlink files to ensure `#![crate_name]` affects the linking stage when doing separate compiling and linking using `-Zno-link`/`-Zlink-only`.
2023-11-26Turn write_dep_info into a regular functionbjorn3-2/+8
It has side-effects and as such can't be cached.
2023-11-26Mostly revert "Accept crate name instead of attributes in ↵bjorn3-5/+11
build_output_filenames"
2023-11-26Ensure macro expansion runs before writing the dep infobjorn3-0/+5
2023-11-26Feed the output filenames into the TyCtxtbjorn3-7/+7
Since the introduction of the crate attribute pre-expansion pass we don't need access to the TyCtxt to compute it.
2023-11-26Serialize OutputFilenames into rmeta filebjorn3-19/+9
This ensures that linking will use the correct crate name even when `#![crate_name = "..."]` is used to specify the crate name.
2023-11-26Accept crate name instead of attributes in build_output_filenamesbjorn3-13/+9
2023-11-26Inline and remove pre_configurebjorn3-15/+4
2023-11-26Auto merge of #118319 - GuillaumeGomez:rollup-vte50yq, r=GuillaumeGomezbors-1/+1
Rollup of 4 pull requests Successful merges: - #118296 (rustdoc: replace `elemIsInParent` with `Node.contains`) - #118302 (Clean dead codes) - #118311 (merge `DefKind::Coroutine` into `Defkind::Closure`) - #118318 (Remove myself from users on vacation) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-26Auto merge of #117301 - saethlin:finish-rmeta-encoding, r=WaffleLapkinbors-1/+9
Call FileEncoder::finish in rmeta encoding Fixes https://github.com/rust-lang/rust/issues/117254 The bug here was that rmeta encoding never called FileEncoder::finish. Now it does. Most of the changes here are needed to support that, since rmeta encoding wants to finish _then_ access the File in the encoder, so finish can't move out. I tried adding a `cfg(debug_assertions)` exploding Drop impl to FileEncoder that checked for finish being called before dropping, but fatal errors cause unwinding so this isn't really possible. If we encounter a fatal error with a dirty FileEncoder, the Drop impl ICEs even though the implementation is correct. If we try to paper over that by wrapping FileEncoder in ManuallyDrop then that just erases the fact that Drop automatically checks that we call finish on all paths. I also changed the name of DepGraph::encode to DepGraph::finish_encoding, because that's what it does and it makes the fact that it is the path to FileEncoder::finish less confusing. r? `@WaffleLapkin`
2023-11-26merge `DefKind::Coroutine` into `DefKind::Closure`bohan-1/+1
2023-11-26Use `rustc_fluent_macro::fluent_messages!` directly.Nicholas Nethercote-3/+1
Currently we always do this: ``` use rustc_fluent_macro::fluent_messages; ... fluent_messages! { "./example.ftl" } ``` But there is no need, we can just do this everywhere: ``` rustc_fluent_macro::fluent_messages! { "./example.ftl" } ``` which is shorter.
2023-11-26Avoid need for `{D,Subd}iagnosticMessage` imports.Nicholas Nethercote-1/+0
The `fluent_messages!` macro produces uses of `crate::{D,Subd}iagnosticMessage`, which means that every crate using the macro must have this import: ``` use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage}; ``` This commit changes the macro to instead use `rustc_errors::{D,Subd}iagnosticMessage`, which avoids the need for the imports.
2023-11-23Enforce NonZeroUsize on thread countMark Rousskov-1/+1
This allows avoiding some if != 0 checks when allocating worker-local datasets.
2023-11-22Call FileEncoder::finish in rmeta encodingBen Kimock-1/+9
2023-11-22Auto merge of #118086 - nnethercote:queries-cleanups, r=bjorn3bors-45/+31
Queries cleanups r? `@bjorn3`
2023-11-22Auto merge of #117928 - nnethercote:rustc_ast_pretty, r=fee1-deadbors-1/+1
`rustc_ast_pretty` cleanups Some improvements I found while looking at this code. r? `@fee1-dead`
2023-11-22Merge `Queries::{ongoing_codegen,linker}`.Nicholas Nethercote-17/+13
There is no real need for them to be separate.
2023-11-22Make `Compiler::{sess,codegen_backend}` public.Nicholas Nethercote-31/+18
And remove the relevant getters on `Compiler` and `Queries`.
2023-11-22Add comments about a timer.Nicholas Nethercote-0/+3
2023-11-22Remove outdated reference to compiler plugins.Nicholas Nethercote-1/+1
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-11/+11
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-11-17Make `Compiler::sess` private.Nicholas Nethercote-2/+2
Like `Compiler::codegen_backend`.
2023-11-17Remove a low-value local variable.Nicholas Nethercote-3/+2
2023-11-17Rename `Linker::prepare_outputs` as `output_filenames`.Nicholas Nethercote-5/+5
It matches the type, and a noun makes more sense than a verb. The `output_filenames` function still uses a profiling label named `prepare_outputs`, but I think that makes sense as a verb and can be left unchanged.
2023-11-17Move `CodegenBackend` out of `Linker`.Nicholas Nethercote-19/+11
It can easily be passed in. And that removes the single clone of `Compiler::codegen_backend`, which means it no longer needs to be `Lrc`.
2023-11-17Move `Session` out of `Linker`.Nicholas Nethercote-19/+13
It can easily be passed in. And that removes the single clone of `Compiler::session`, which means it no longer needs to be `Lrc`.
2023-11-17Streamline `Queries::linker`.Nicholas Nethercote-19/+13
2023-11-17Remove `Compiler::register_lints`.Nicholas Nethercote-5/+0
Lint registration now happens early enough that we can run it from `Config`, before `Compiler` is created.
2023-11-17Move `lint_store` from `GlobalCtxt` to `Session`.Nicholas Nethercote-11/+12
This was made possible by the removal of plugin support, which simplified lint store creation. This simplifies the places in rustc and rustdoc that call `describe_lints`, which are early on. The lint store is now built before those places, so they don't have to create their own lint store for temporary use, they can just use the main one.
2023-11-17Inline and remove `create_lint_store`.Nicholas Nethercote-13/+6
2023-11-15Re-format code with new rustfmtMark Rousskov-7/+21
2023-11-15Auto merge of #116555 - paulmenage:llvm-module-flag, r=wesleywiserbors-0/+1
Add -Z llvm_module_flag Allow adding values to the `!llvm.module.flags` metadata for a generated module. The syntax is `-Z llvm_module_flag=<name>:<type>:<value>:<behavior>` Currently only u32 values are supported but the type is required to be specified for forward compatibility. The `behavior` element must match one of the named LLVM metadata behaviors.viors. This flag is expected to be perma-unstable.
2023-11-14Auto merge of #117773 - nnethercote:rm-Zperf-stats, r=wesleywiserbors-1/+0
Remove `-Zperf-stats`. The included measurements have varied over the years. At one point there were quite a few more, but #49558 deleted a lot that were no longer used. Today there's just four, and it's a motley collection that doesn't seem particularly valuable. I think it has been well and truly subsumed by self-profiling, which collects way more data. r? `@wesleywiser`
2023-11-13Remove `-Zperf-stats`.Nicholas Nethercote-1/+0
The included measurements have varied over the years. At one point there were quite a few more, but #49558 deleted a lot that were no longer used. Today there's just four, and it's a motley collection that doesn't seem particularly valuable. I think it has been well and truly subsumed by self-profiling, which collects way more data.
2023-11-11Add -Z llvm_module_flagPaul Menage-0/+1
Allow adding values to the `!llvm.module.flags` metadata for a generated module. The syntax is `-Z llvm_module_flag=<name>:<type>:<value>:<behavior>` Currently only u32 values are supported but the type is required to be specified for forward compatibility. The `behavior` element must match one of the named LLVM metadata behaviors.viors. This flag is expected to be perma-unstable.
2023-11-10Remove `-Zkeep-hygiene-data`.Nicholas Nethercote-1/+0
It was added way back in #28585 under the name `-Zkeep-mtwt-tables`. The justification was: > This is so that the resolution results can be used after analysis, > potentially for tool support. There are no uses of significance in the code base, and various Google searches for both option names (and variants) found nothing of interest. @petrochenkov says removing this part (and it's only part) of the hygiene data is dubious. It doesn't seem that big, so let's just keep it around.
2023-11-07Add -Zcross-crate-inline-threshold=yesBen Kimock-6/+6
2023-11-04Remove support for compiler plugins.Nicholas Nethercote-22/+4
They've been deprecated for four years. This commit includes the following changes. - It eliminates the `rustc_plugin_impl` crate. - It changes the language used for lints in `compiler/rustc_driver_impl/src/lib.rs` and `compiler/rustc_lint/src/context.rs`. External lints are now called "loaded" lints, rather than "plugins" to avoid confusion with the old plugins. This only has a tiny effect on the output of `-W help`. - E0457 and E0498 are no longer used. - E0463 is narrowed, now only relating to unfound crates, not plugins. - The `plugin` feature was moved from "active" to "removed". - It removes the entire plugins chapter from the unstable book. - It removes quite a few tests, mostly all of those in `tests/ui-fulldeps/plugin/`. Closes #29597.
2023-11-03Auto merge of #117507 - nnethercote:rustc_span, r=Nilstriebbors-1/+2
`rustc_span` cleanups Just some things I found while looking over this crate. r? `@oli-obk`
2023-11-02Minimize `pub` usage in `source_map.rs`.Nicholas Nethercote-1/+2
Most notably, this commit changes the `pub use crate::*;` in that file to `use crate::*;`. This requires a lot of `use` items in other crates to be adjusted, because everything defined within `rustc_span::*` was also available via `rustc_span::source_map::*`, which is bizarre. The commit also removes `SourceMap::span_to_relative_line_string`, which is unused.
2023-11-02Remove support for alias `-Z symbol-mangling-version`Zalathar-1/+0