about summary refs log tree commit diff
path: root/compiler/rustc_driver_impl/src
AgeCommit message (Collapse)AuthorLines
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-11Fix #128930: Print documentation of CLI options missing their argGeorge Bateman-2/+15
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-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/+11
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-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-0/+1
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)-41/+12
2024-04-08Ensure we do not accidentally insert new early aborts in the analysis passesOli Scherer-2/+4
2024-03-26Auto merge of #111769 - saethlin:ctfe-backtrace-ctrlc, r=RalfJungbors-0/+19
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`. ```
2024-03-22Rollup merge of #122847 - ↵Matthias Krüger-1/+5
workingjubilee:suggest-rust-min-stack-workaround-on-overflow, r=TaKO8Ki Suggest `RUST_MIN_STACK` workaround on overflow For some Rust crates, like p384, we can't do a whole lot about it even if the stack overflow is reported like in rust-lang/rust#122357 because the problem may be inside LLVM or another codegen backend. We can, however, suggest people set a new `RUST_MIN_STACK` value while handling the SIGSEGV, as that stack-setting will carry forward into the dylib. As a bonus, this also leads to cleaning up the stack-setting code a bit.
2024-03-21Suggest using RUST_MIN_STACK if rustc overflowedJubilee Young-1/+5
2024-03-21Remove `CodegenBackend::target_override`.Nicholas Nethercote-2/+2
Backend and target selection is a mess: the target can override the backend (via `Target::default_codegen_backend`), *and* the backend can override the target (via `CodegenBackend::target_override`). The code that handles this is ugly. It calls `build_target_config` twice, once before getting the backend and once again afterward. It also must check that both overrides aren't triggering at the same time. This commit removes the latter override. It's used in rust-gpu but @eddyb said via Zulip that removing it would be ok. This simplifies the code greatly, and will allow some nice follow-up refactorings.
2024-03-17Print a backtrace in const eval if interruptedBen Kimock-0/+19
2024-03-14Rollup merge of #121764 - Zoxc:incr-sess-no-source, r=oli-obkMatthias Krüger-1/+2
Make incremental sessions identity no longer depend on the crate names provided by source code This makes incremental sessions identity no longer depend on the crate names provided by source code, implementing https://github.com/rust-lang/compiler-team/issues/726. r? ````@oli-obk````
2024-03-14Auto merge of #122347 - oli-obk:track_errors13, r=compiler-errorsbors-4/+2
Revert "Auto merge of #122140 - oli-obk:track_errors13, r=davidtwco" This reverts commit 65cd843ae06ad00123c131a431ed5304e4cd577a, reversing changes made to d255c6a57c393db6221b1ff700daea478436f1cd. reverts https://github.com/rust-lang/rust/pull/122140 It was a large regression in wall time due to trashing CPU caches
2024-03-13Make incremental sessions identity no longer depend on the crate names ↵John Kåre Alsaker-1/+2
provided by source code
2024-03-12Auto merge of #122218 - Zoxc:no-interleave-panics, r=michaelwoeristerbors-0/+3
Lock stderr in panic handler Fixes https://github.com/rust-lang/rust/issues/119789.
2024-03-11Revert "Auto merge of #122140 - oli-obk:track_errors13, r=davidtwco"Oli Scherer-4/+2
This reverts commit 65cd843ae06ad00123c131a431ed5304e4cd577a, reversing changes made to d255c6a57c393db6221b1ff700daea478436f1cd.
2024-03-11Auto merge of #122338 - workingjubilee:rollup-xzpt4v4, r=workingjubileebors-3/+12
Rollup of 15 pull requests Successful merges: - #116791 (Allow codegen backends to opt-out of parallel codegen) - #116793 (Allow targets to override default codegen backend) - #117458 (LLVM Bitcode Linker: A self contained linker for nvptx and other targets) - #119385 (Fix type resolution of associated const equality bounds (take 2)) - #121438 (std support for wasm32 panic=unwind) - #121893 (Add tests (and a bit of cleanup) for interior mut handling in promotion and const-checking) - #122080 (Clarity improvements to `DropTree`) - #122152 (Improve diagnostics for parenthesized type arguments) - #122166 (Remove the unused `field_remapping` field from `TypeLowering`) - #122249 (interpret: do not call machine read hooks during validation) - #122299 (Store backtrace for `must_produce_diag`) - #122318 (Revision-related tweaks for next-solver tests) - #122320 (Use ptradd for vtable indexing) - #122328 (unix_sigpipe: Replace `inherit` with `sig_dfl` in syntax tests) - #122330 (bootstrap readme: fix, improve, update) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-11Rollup merge of #116793 - WaffleLapkin:target_rules_the_backend, r=cjgillotJubilee-3/+12
Allow targets to override default codegen backend Implements https://github.com/rust-lang/compiler-team/issues/670.