summary refs log tree commit diff
path: root/compiler/rustc_driver_impl
AgeCommit message (Collapse)AuthorLines
2024-08-28Rollup merge of #129667 - dev-ardi:rustc_driver-cleanup, r=michaelwoeristerMatthias Krüger-29/+36
Rustc driver cleanup This adds a few comments to the driver to clarify a bit what's happening and does some cleanup.
2024-08-28clarify a few thingsOrion Gonzalez-4/+8
2024-08-28cleanup make_inputOrion Gonzalez-19/+26
2024-08-28replace is_some() -> unwrap with if letOrion Gonzalez-6/+2
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-27Add `warn(unreachable_pub)` to `rustc_driver_impl`.Nicholas Nethercote-0/+1
2024-08-26Use unsafe extern blocks throughout the compilerMichael Goulet-1/+2
2024-08-11Rollup merge of #128762 - fmease:use-more-slice-pats, r=compiler-errorsMatthias Krüger-30/+25
Use more slice patterns inside the compiler Nothing super noteworthy. Just replacing the common 'fragile' pattern of "length check followed by indexing or unwrap" with slice patterns for legibility and 'robustness'. r? ghost
2024-08-07Add -Zerror-metrics=PATH to save diagnostic metadata to diskJane Losare-Lusby-8/+29
2024-08-07Use more slice patterns inside the compilerLeón Orell Valerian Liehr-30/+25
2024-07-30Make RUSTC_OVERRIDE_VERSION_STRING overwrite the rendered version output, tooOli Scherer-0/+9
2024-07-29Reformat `use` declarations.Nicholas Nethercote-23/+25
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-01Move codegen_and_build_linker from Queries to Linkerbjorn3-2/+4
2024-06-30Move -Zprint-type-sizes and -Zprint-vtable-sizes into codegen_and_build_linkerbjorn3-16/+1
2024-06-25Auto merge of #126834 - bjorn3:interface_refactor, r=michaelwoeristerbors-13/+16
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-24Rollup merge of #124712 - Enselic:deprecate-inline-threshold, r=pnkfelixMichael Goulet-1/+5
Deprecate no-op codegen option `-Cinline-threshold=...` This deprecates `-Cinline-threshold` since using it has no effect. This has been the case since the new LLVM pass manager started being used, more than 2 years ago. Recommend using `-Cllvm-args=--inline-threshold=...` instead. Closes #89742 which is E-help-wanted.
2024-06-22Avoid a couple of unnecessary EarlyDiagCtxt usesbjorn3-10/+9
2024-06-22Inline write_dep_info querybjorn3-3/+7
2024-06-18Use a dedicated type instead of a reference for the diagnostic contextOli Scherer-1/+2
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-14Deprecate no-op codegen option `-Cinline-threshold=...`Martin Nordholts-0/+4
This deprecates `-Cinline-threshold` since using it has no effect. This has been the case since the new LLVM pass manager started being used, more than 2 years ago.
2024-06-14Fix typo in `-Cno-stack-check` deprecation warningMartin Nordholts-1/+1
The flag `--no-stack-check` does not exist: $ rustc --no-stack-check error: Unrecognized option: 'no-stack-check'. Did you mean `-C no-stack-check`?
2024-06-12Use `tidy` to sort crate attributes for all compiler crates.Nicholas Nethercote-2/+4
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-11Rename std::panic::PanicInfo to PanicHookInfo.Mara Bos-5/+4
2024-06-10Remove some unused crate dependencies.Nicholas Nethercote-1/+0
I found these by setting the `unused_crate_dependencies` lint temporarily to `Warn`.
2024-06-05Make top-level `rustc_parse` functions fallible.Nicholas Nethercote-3/+3
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-4/+6
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-04Rollup merge of #125953 - nnethercote:streamline-nested-calls, r=lqdMichael Goulet-8/+2
Streamline `nested` calls. `TyCtxt` impls `PpAnn` in `compiler/rustc_middle/src/hir/map/mod.rs`. We can call that impl, which then calls the one on `intravisit::Map`, instead of calling the one on `intravisit::Map` directly, avoiding a cast and extra references. r? `@lqd`
2024-06-04Streamline `nested` calls.Nicholas Nethercote-8/+2
`TyCtxt` impls `PpAnn` in `compiler/rustc_middle/src/hir/map/mod.rs`. We can call that impl, which then calls the one on `intravisit::Map`, instead of calling the one on `intravisit::Map` directly, avoiding a cast and extra references.
2024-06-02Handle no values cfg with --print=check-cfgUrgau-7/+11
2024-05-29Make `body_owned_by` return the body directly.Oli Scherer-1/+1
Almost all callers want this anyway, and now we can use it to also return fed bodies
2024-05-29Rollup merge of #124320 - Urgau:print-check-cfg, r=petrochenkov许杰友 Jieyou Xu (Joe)-0/+33
Add `--print=check-cfg` to get the expected configs This PR adds a new `--print` variant `check-cfg` to get the expected configs. Details and rational can be found on the MCP: https://github.com/rust-lang/compiler-team/issues/743 ``@rustbot`` label +F-check-cfg +S-waiting-on-MCP r? ``@petrochenkov``
2024-05-24Exit the process a short time after entering our ctrl-c handlerBen Kimock-9/+8
2024-05-21PR feedbackBen Kimock-3/+3
2024-05-21Add a footer in FileEncoder and check for it in MemDecoderBen Kimock-3/+13
2024-05-13Don't call `env::set_var` in `rustc_driver::install_ice_hook`Tobias Bucher-2/+3
Modifying an environment variable would make the function unsafe to call.
2024-05-04compiler: upgrade time from 0.3.34 to 0.3.36Caleb Sander-1/+1
This ensures the version of time used in rustc includes this change: https://github.com/time-rs/time/pull/671. This fix is a necessary prerequisite for #99969, which adds FromIterator implementations for Box<str>. Previously, time had an Into::into that resolved to the identity impl followed by a collect::<Result<Box<_>, _>>(). With the new FromIterator implementations for Box<str>, the Into::into resolution is ambiguous and time fails to compile. The fix removes the identity Into::into conversion, allowing time to compile with the new FromIterator implementations. This version of time also matches what cargo recently switched to in https://github.com/rust-lang/cargo/pull/13834.
2024-05-03Fix `Cargo.toml` whitespace.Nicholas Nethercote-1/+1
2024-05-03Remove some unneeded `Cargo.toml` dependencies.Nicholas Nethercote-1/+0
I found these with a hacky shell script.
2024-04-30Rollup merge of #124511 - nnethercote:rm-extern-crates, r=fee1-deadMatthias Krüger-5/+2
Remove many `#[macro_use] extern crate foo` items This requires the addition of more `use` items, which often make the code more verbose. But they also make the code easier to read, because `#[macro_use]` obscures where macros are defined. r? `@fee1-dead`
2024-04-30Remove `extern crate tracing` from numerous crates.Nicholas Nethercote-5/+2
2024-04-29[Refactor] Rename Lint and LintGroup\'s is_loaded to is_externally_loadedblyxyas-1/+1
2024-04-25Add `--print=check-cfg` to get the expected configsUrgau-0/+33
2024-04-15Fix pretty hir for anon consts in diagnosticsMichael Goulet-18/+1
2024-04-11Disable Ctrl-C handling on WASMbjorn3-1/+6
WASM fundamentally doesn't support signals. If WASI ever gets support for notifying the guest process of a Ctrl-C that happened, this would have to be done through the guest process polling for the signal, which will require thread support in WASI too to be compatible with the api provided by the ctrlc crate.
2024-04-09driver: unconditionally show update nightly hint许杰友 Jieyou Xu (Joe)-45/+13
2024-04-09Auto merge of #123631 - oli-obk:fail_slow, r=jieyouxubors-2/+4
Ensure we do not accidentally insert new early aborts in the analysis passes pulling the infallible part out into a separate function makes sure that someone needs to change the signature in order to regress this. We only want to stop compilation in the presence of errors after all analyses are done, but before we start running lints. per-item we can still stop doing work if previous queries returned errors, but that's a separate story.
2024-04-08Ensure we do not accidentally insert new early aborts in the analysis passesOli Scherer-2/+4
2024-04-08Rollup merge of #122807 - danielhuang:fix-1, r=davidtwcoMatthias Krüger-1/+1
Add consistency with phrases "meantime" and "mean time" "mean time" is used in a few places while "meantime" is used everywhere else; this would make usage consistent throughout the codebase.
2024-04-03update messagesDan-1/+1
2024-03-26Auto merge of #111769 - saethlin:ctfe-backtrace-ctrlc, r=RalfJungbors-0/+20
Print a backtrace in const eval if interrupted Demo: ```rust #![feature(const_eval_limit)] #![const_eval_limit = "0"] const OW: u64 = { let mut res: u64 = 0; let mut i = 0; while i < u64::MAX { res = res.wrapping_add(i); i += 1; } res }; fn main() { println!("{}", OW); } ``` ``` ╭ ➜ ben@archlinux:~/rust ╰ ➤ rustc +stage1 spin.rs ^Cerror[E0080]: evaluation of constant value failed --> spin.rs:8:33 | 8 | res = res.wrapping_add(i); | ^ Compilation was interrupted note: erroneous constant used --> spin.rs:15:20 | 15 | println!("{}", OW); | ^^ note: erroneous constant used --> spin.rs:15:20 | 15 | println!("{}", OW); | ^^ | = note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error For more information about this error, try `rustc --explain E0080`. ```