about summary refs log tree commit diff
path: root/compiler/rustc_driver_impl/src
AgeCommit message (Collapse)AuthorLines
2025-02-18Rollup merge of #137151 - Urgau:register-more-signals, r=workingjubileeUrgau-11/+39
Install more signal stack trace handlers This PR install the signal stack handler to more signals (`SIGILL`, ~~`SIGTRAP`~~, ~~`SIGABRT`~~, ~~`SIGFPE`~~, `SIGBUS`, ~~`SIGQUIT`~~). Noticed in https://github.com/rust-lang/rust/issues/137138 that we didn't print anything for `SIGILL`, so I though we could just handle more signals. r? `````@workingjubilee````` since you last touched it
2025-02-18Move methods from `Map` to `TyCtxt`, part 2.Nicholas Nethercote-4/+3
Continuing the work started in #136466. Every method gains a `hir_` prefix, though for the ones that already have a `par_` or `try_par_` prefix I added the `hir_` after that.
2025-02-17Install more signal stack trace handlersUrgau-11/+39
2025-02-17Remove `TyCtxt::hir_krate`.Nicholas Nethercote-1/+1
It's a trivial wrapper around the `hir_crate` query with a small number of uses.
2025-02-17Move some `Map` methods onto `TyCtxt`.Nicholas Nethercote-2/+2
The end goal is to eliminate `Map` altogether. I added a `hir_` prefix to all of them, that seemed simplest. The exceptions are `module_items` which became `hir_module_free_items` because there was already a `hir_module_items`, and `items` which became `hir_free_items` for consistency with `hir_module_free_items`.
2025-02-15Reject macro calls inside of `#![crate_name]`León Orell Valerian Liehr-5/+5
2025-02-11compiler: compare and hash ExternAbi like its stringJubilee Young-2/+1
Directly map each ExternAbi variant to its string and back again. This has a few advantages: - By making the ABIs compare equal to their strings, we can easily lexicographically sort them and use that sorted slice at runtime. - We no longer need a workaround to make sure the hashes remain stable, as they already naturally are (by being the hashes of unique strings). - The compiler can carry around less &str wide pointers
2025-02-09compiler: remove rustc_target::spec::abi reexportsJubilee Young-1/+1
2025-02-06Rollup merge of #136636 - bjorn3:error_cleanup, r=compiler-errorsMatthias Krüger-1/+1
Couple of minor cleanups to the diagnostic infrastructure
2025-02-06Avoid manually producing FatalError in a couple of placesbjorn3-1/+1
2025-02-05Couple of changes to run rustc in miribjorn3-3/+3
2025-02-03Use a different hir type for patterns in pattern types than we use in match ↵Oli Scherer-0/+4
patterns
2025-02-02Rollup merge of #136445 - bjorn3:diag_ctxt_cleanup, r=oli-obkMatthias Krüger-16/+13
Couple of cleanups to DiagCtxt and EarlyDiagCtxt
2025-02-02Some cleanups around EarlyDiagCtxtbjorn3-16/+13
All callers of EarlyDiagCtxt::early_error now emit a fatal error.
2025-02-01Rename `tcx.ensure()` to `tcx.ensure_ok()`Zalathar-3/+3
2025-01-31Remove the `thir_{tree,flat}` hooks.Nicholas Nethercote-2/+3
They were downgraded from queries in #123995 but they can just be vanilla functions because they are not called in `rustc_middle`.
2025-01-28Make crate AST mutation accessible for driver callbackMohammad Omidvar-3/+3
2025-01-23Rollup merge of #135880 - bjorn3:misc_driver_refactors, r=oli-obkMatthias Krüger-100/+11
Get rid of RunCompiler The various `set_*` methods that have been removed can be replaced by setting the respective fields in the `Callbacks::config` implementation. `set_using_internal_features` was often forgotten and it's equivalent is now done automatically.
2025-01-23Remove RunCompilerbjorn3-18/+2
It has become nothing other than a wrapper around run_compiler.
2025-01-23Remove set_make_codegen_backend and set_file_loaderbjorn3-45/+5
They can both be set inside the config callback too.
2025-01-23Remove the need to manually call set_using_internal_featuresbjorn3-43/+10
2025-01-22Rollup merge of #135596 - compiler-errors:stack, r=oli-obkMatthias Krüger-2/+2
Properly note when query stack is being cut off cc #70953 also, i'm not certain whether we should even limit this at all. i don't see the problem with printing the full query stack, apparently it was limited b/c we used to ICE? but we're already printing the full stack to disk since #108714. r? oli-obk
2025-01-20Rollup merge of #135330 - bjorn3:respect_sysroot_in_version_printing, r=lqdMatthias Krüger-15/+22
Respect --sysroot for rustc -vV and -Cpasses=list This is necessary when the specified codegen backend is in a custom sysroot. Fixes https://github.com/rust-lang/rust/issues/135165
2025-01-20Respect --target in get_backend_from_raw_matchesbjorn3-5/+6
2025-01-19Don't skip argument parsing when running `rustc` with no argumentsZalathar-10/+1
Setting up the argument parser to parse no arguments is a tiny bit of wasted work, but avoids an otherwise-unnecessary special case. In particular, this lets us avoid having to deal with multiple different APIs to determine whether the compiler is nightly or not.
2025-01-16Properly note when query stack is being cut offMichael Goulet-2/+2
2025-01-10Respect --sysroot for rustc -vV and -Cpasses=listbjorn3-14/+20
This is necessary when the specified codegen backend is in a custom sysroot.
2025-01-06add deprecated and do nothing flag to options tableklensy-20/+10
inline_threshold mark deprecated no-stack-check print deprecation message for -Car too inline_threshold deprecated and do nothing: make in untracked make OptionDesc struct from tuple
2025-01-01Rollup merge of #131439 - mu001999-contrib:cleanup/static-mut, r=estebankStuart Cook-9/+11
Remove allowing static_mut_refs lint
2024-12-25fix default-backtrace-ice testjyn-1/+3
when running `tests/ui/panics/default-backtrace-ice.rs locally it gave this error: ``` failures: ---- [ui] tests/ui/panics/default-backtrace-ice.rs stdout ---- Saved the actual stderr to "/home/jyn/src/rust3/build/x86_64-unknown-linux-gnu/test/ui/panics/default-backtrace-ice/default-backtrace-ice.stderr" diff of stderr: 7 8 aborting due to `-Z treat-err-as-bug=1` 9 stack backtrace: - (end_short_backtrace) - (begin_short_backtrace) - (end_short_backtrace) - (begin_short_backtrace) + [... omitted 22 frames ...] + ``` this is a regression from setting RUST_BACKTRACE=1 by default. we need to turn off the new behavior when running UI tests so that they reflect our dist compiler. normally that's done by checking `sess.unstable_opts.ui_testing`, but this happens extremely early in the compiler before we've expanded arg files. do an extremely simple hack that doesn't work in all cases - we don't need it to work in all cases, only when running UI tests.
2024-12-24Default to short backtraces for dev builds of rustc itselfjyn-1/+5
A dev build almost certainly means that whoever's built the compiler has the opportunity to rerun it to collect a more complete trace. So we don't need to default to a complete trace; we should hide irrelevant details by default.
2024-12-20Reduce the amount of explicit FatalError.raise()bjorn3-7/+2
Instead use dcx.abort_if_error() or guar.raise_fatal() instead. These guarantee that an error actually happened previously and thus we don't silently abort.
2024-12-18Rollup merge of #134420 - Integral-Tech:pathbuf-refactor, r=compiler-errors许杰友 Jieyou Xu (Joe)-2/+2
refactor: replace &PathBuf with &Path to enhance generality - According to [style.md](https://github.com/rust-lang/rust/blob/master/src/tools/rust-analyzer/docs/dev/style.md#useless-types): > More generally, always prefer types on the left ```rust // GOOD BAD &[T] &Vec<T> &str &String Option<&T> &Option<T> &Path &PathBuf ```
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-2/+1
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-12-17Auto merge of #134381 - jdonszelmann:move-attribute-types, r=oli-obkbors-1/+1
Split up attribute parsing code and move data types to `rustc_attr_data_structures` This change renames `rustc_attr` to `rustc_attr_parsing`, and splits up the parsing code. At the same time, all the data types used move to `rustc_attr_data_structures`. This is in preparation of also having a third crate: `rustc_attr_validation` I initially envisioned this as two separate PRs, but I think doing it in one go reduces the number of ways others would have to rebase their changes on this. However, I can still split them. r? `@oli-obk` (we already discussed how this is a first step in a larger plan) For a more detailed plan on how attributes are going to change, see https://github.com/rust-lang/rust/issues/131229 Edit: this looks like a giant PR, but the changes are actually rather trivial. Each commit is reviewable on its own, and mostly moves code around. No new logic is added.
2024-12-18refactor: replace &PathBuf with &Path to enhance generalityIntegral-2/+2
2024-12-16rename rustc_attr to rustc_attr_parsing and create rustc_attr_data_structuresJonathan Dönszelmann-1/+1
2024-12-14Remove two unnecessary referencesbjorn3-2/+2
2024-12-14Remove the parse querybjorn3-55/+44
2024-12-14Get rid of of the global_ctxt querybjorn3-3/+7
2024-12-14Rollup merge of #134251 - bjorn3:various_cleanups2, r=oli-obkMatthias Krüger-3/+5
A bunch of cleanups (part 2) Just like https://github.com/rust-lang/rust/pull/133567 these were all found while looking at the respective code, but are not blocking any other changes I want to make in the short term.
2024-12-13Remove registered_lints field from Sessionbjorn3-3/+5
It only exists to pass some information from one part of the driver to another part. We can directly pass this information to the function that needs it to reduce the amount of mutation of the Session.
2024-12-12Pass rustc_ast::Crate rather than Queries to after_crate_root_parsingbjorn3-8/+6
2024-12-12Pass TyCtxt rather than Queries to after_expansionbjorn3-10/+10
2024-12-08Use ensure for analysis callsbjorn3-2/+2
2024-12-06Remove all threading through of ErrorGuaranteed from the driverbjorn3-45/+41
It was inconsistently done (sometimes even within a single function) and most of the rest of the compiler uses fatal errors instead, which need to be caught using catch_with_exit_code anyway. Using fatal errors instead of ErrorGuaranteed everywhere in the driver simplifies things a bit.
2024-12-06Move some timers aroundbjorn3-2/+1
2024-12-04Rollup merge of #133847 - nnethercote:rm-Z-show-span, r=compiler-errorsMatthias Krüger-3/+1
Remove `-Zshow-span`. It's very old (added in #12087). It's strange, and it's not clear what its use cases are. It only works with the crate root file because it runs before expansion. I suspect it won't be missed. r? `@estebank`
2024-12-04Remove `-Zshow-span`.Nicholas Nethercote-3/+1
It's very old (added in #12087). It's strange, and it's not clear what its use cases are. It only works with the crate root file because it runs before expansion. I suspect it won't be missed.
2024-12-03Rollup merge of #133041 - madsmtm:print-deployment-target-env-var, r=davidtwcoMatthias Krüger-2/+3
Print name of env var in `--print=deployment-target` The deployment target environment variable is OS-specific, and if you're in a place where you're asking `rustc` for the deployment target, you're likely to also wanna know the name of the environment variable. I myself wanted this for some code I'm working on in bootstrap, for example. Behaviour before this PR: ```console $ rustc --print=deployment-target --target=aarch64-apple-darwin deployment_target=11.0 $ rustc --print=deployment-target --target=aarch64-apple-visionos deployment_target=1.0 ``` Behaviour after this PR: ```console $ rustc --print=deployment-target --target=aarch64-apple-darwin MACOSX_DEPLOYMENT_TARGET=11.0 $ rustc --print=deployment-target --target=aarch64-apple-visionos XROS_DEPLOYMENT_TARGET=1.0 ``` My _belief_ is that this option is extremely rarely used in general, and a GitHub search for "rustc print deployment-target" seems to confirm this, it revealed only the following actual pieces of code using this: - https://github.com/PyO3/maturin/blob/b292ef69349f2a56cb8ab1b59fda0be3d3b9f138/src/build_context.rs#L1199-L1220 - https://github.com/rust-lang/cc-rs/blob/daab9244b03e244c4f2511944870d719c443f61f/src/lib.rs#L3422-L3426 `maturin` does `.split('=').last()`, so it will continue to work after this change, but `cc v1.0.84` did `.strip_prefix("deployment_target=")` since [this PR](https://github.com/rust-lang/cc-rs/pull/848), so it would break. That's _probably_ fine though, it was broken in a lot of scenarios anyway, and [got](https://github.com/rust-lang/cc-rs/pull/901) [reverted](https://github.com/rust-lang/cc-rs/pull/943) in `v1.0.85`. So while this is _technically_ a breaking change, I really doubt that anyone is going to observe it, so it's probably fine. ``@BlackHoleFox`` wdyt? ``@rustbot`` label O-apple r? compiler