about summary refs log tree commit diff
path: root/compiler/rustc_query_system
AgeCommit message (Collapse)AuthorLines
2025-01-16Properly note when query stack is being cut offMichael Goulet-3/+3
2025-01-13remove code duplication when hashing query result and interning nodeMartin Zacho-42/+36
Refactored the duplicated code into a function. `with_feed_task` currently passes the query key to `debug_assert!`. This commit changes that, so it debug prints the `DepNode`, as in `with_task`.
2025-01-07don't return an Option from try_find_dep_kindMartin Zacho-5/+5
2025-01-06improve diagnostics for const eval query overflowMartin Zacho-15/+13
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-3/+2
`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-15Add hir::AttributeJonathan Dönszelmann-18/+10
2024-12-13Rename ty_def_id so people will stop using it by accidentMichael Goulet-3/+3
2024-12-04Make sure to record deps from cached task in new solver on first runMichael Goulet-5/+20
2024-11-19Auto merge of #124780 - Mark-Simulacrum:lockless-cache, r=lcnrbors-62/+33
Improve VecCache under parallel frontend This replaces the single Vec allocation with a series of progressively larger buckets. With the cfg for parallel enabled but with -Zthreads=1, this looks like a slight regression in i-count and cycle counts (~1%). With the parallel frontend at -Zthreads=4, this is an improvement (-5% wall-time from 5.788 to 5.4688 on libcore) than our current Lock-based approach, likely due to reducing the bouncing of the cache line holding the lock. At -Zthreads=32 it's a huge improvement (-46%: 8.829 -> 4.7319 seconds). try-job: i686-gnu-nopt try-job: dist-x86_64-linux
2024-11-15Improve VecCache under parallel frontendMark Rousskov-62/+33
This replaces the single Vec allocation with a series of progressively larger buckets. With the cfg for parallel enabled but with -Zthreads=1, this looks like a slight regression in i-count and cycle counts (<0.1%). With the parallel frontend at -Zthreads=4, this is an improvement (-5% wall-time from 5.788 to 5.4688 on libcore) than our current Lock-based approach, likely due to reducing the bouncing of the cache line holding the lock. At -Zthreads=32 it's a huge improvement (-46%: 8.829 -> 4.7319 seconds).
2024-11-12Auto merge of #132282 - Noratrieb:it-is-the-end-of-serial, r=cjgillotbors-81/+16
Delete the `cfg(not(parallel))` serial compiler Since it's inception a long time ago, the parallel compiler and its cfgs have been a maintenance burden. This was a necessary evil the allow iteration while not degrading performance because of synchronization overhead. But this time is over. Thanks to the amazing work by the parallel working group (and the dyn sync crimes), the parallel compiler has now been fast enough to be shipped by default in nightly for quite a while now. Stable and beta have still been on the serial compiler, because they can't use `-Zthreads` anyways. But this is quite suboptimal: - the maintenance burden still sucks - we're not testing the serial compiler in nightly Because of these reasons, it's time to end it. The serial compiler has served us well in the years since it was split from the parallel one, but it's over now. Let the knight slay one head of the two-headed dragon! #113349 Note that the default is still 1 thread, as more than 1 thread is still fairly broken. cc `@onur-ozkan` to see if i did the bootstrap field removal correctly, `@SparrowLii` on the sync parts
2024-11-12Delete the `cfg(not(parallel))` serial compilerNoratrieb-81/+16
Since it's inception a long time ago, the parallel compiler and its cfgs have been a maintenance burden. This was a necessary evil the allow iteration while not degrading performance because of synchronization overhead. But this time is over. Thanks to the amazing work by the parallel working group (and the dyn sync crimes), the parallel compiler has now been fast enough to be shipped by default in nightly for quite a while now. Stable and beta have still been on the serial compiler, because they can't use `-Zthreads` anyways. But this is quite suboptimal: - the maintenance burden still sucks - we're not testing the serial compiler in nightly Because of these reasons, it's time to end it. The serial compiler has served us well in the years since it was split from the parallel one, but it's over now. Let the knight slay one head of the two-headed dragon!
2024-11-03replace manual time convertions with std onesklensy-1/+1
2024-10-28fix clippy::clone_on_ref_ptr for compilerklensy-2/+2
2024-10-25Introduce `Enabled{Lang,Lib}Feature`许杰友 Jieyou Xu (Joe)-0/+17
Instead of passing around random n-tuples of e.g. `(gate_name, attr_sp, since)`.
2024-10-23stop hashing compile-time constantRalf Jung-6/+1
2024-10-23rename lang feature lists to include LANGRalf Jung-1/+1
2024-10-23remove no longer needd UnstableFeature typeRalf Jung-1/+1
2024-10-23nightly feature tracking: get rid of the per-feature bool fieldsRalf Jung-1/+1
2024-10-22make some rustc_feature internals private, and ensure invariants with debug ↵Ralf Jung-2/+2
assertions
2024-10-22terminology: #[feature] *enables* a feature (instead of "declaring" or ↵Ralf Jung-3/+3
"activating" it)
2024-10-01add unstable support for outputting file checksums for use in cargoJacob Kiesel-0/+2
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-13/+13
2024-09-02chore: Fix typos in 'compiler' (batch 2)Alexander Cyon-1/+1
2024-08-29Add `warn(unreachable_pub)` to `rustc_query_system`.Nicholas Nethercote-10/+11
2024-08-20fix: simple typo in compiler directoryc8ef-1/+1
2024-08-19Prevent double panic in query system, improve diagnosticsFelix Rath-2/+9
2024-08-07Use more slice patterns inside the compilerLeón Orell Valerian Liehr-6/+5
2024-08-02chore: use shorthand initializerYuri Astrakhan-1/+1
2024-07-29Reformat `use` declarations.Nicholas Nethercote-83/+89
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-18Be more accurate about calculating `display_col` from a `BytePos`Esteban Küber-6/+0
No longer track "zero-width" chars in `SourceMap`, read directly from the line when calculating the `display_col` of a `BytePos`. Move `char_width` to `rustc_span` and use it from the emitter. This change allows the following to properly align in terminals (depending on the font, the replaced control codepoints are rendered as 1 or 2 width, on my terminal they are rendered as 1, on VSCode text they are rendered as 2): ``` error: this file contains an unclosed delimiter --> $DIR/issue-68629.rs:5:17 | LL | ␜␟ts␀![{i | -- unclosed delimiter | | | unclosed delimiter LL | ␀␀ fn rݻoa>rݻm | ^ ```
2024-07-15Use dep: for crate dependenciesMichael Goulet-1/+1
2024-07-12enable fuzzing of `SearchGraph`lcnr-1/+1
fully move it into `rustc_type_ir` and make it independent of `Interner`.
2024-06-25Auto merge of #126326 - eggyal:ununsafe-StableOrd, r=michaelwoeristerbors-1/+4
Un-unsafe the `StableOrd` trait Whilst incorrect implementations of this trait can cause miscompilation, they cannot cause memory unsafety in rustc. [Discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Policy.20of.20.60unsafe.60.20within.20the.20compiler). cc [MCP 533](https://github.com/rust-lang/compiler-team/issues/533), #105175, `@michaelwoerister` r? `@Nilstrieb`
2024-06-22Ensure careful consideration is given by implsAlan Egerton-0/+3
Added an associated `const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED` to the `StableOrd` trait to ensure that implementors carefully consider whether the trait's contract is upheld, as incorrect implementations can cause miscompilations.
2024-06-19Allow for try_force_from_dep_node to failMichael Baikov-7/+11
The way it is implemented currently try_force_from_dep_node returns true as long as there's a function to force the query. It wasn't this way from the beginning, earlier version was producing forcing result and it was changed in https://github.com/rust-lang/rust/pull/89978, I couldn't find any comments addressing this change. One way it can fail is by failing to recover the query in DepNodeParams::recover - when we are trying to query something that no longer exists in the current environment
2024-06-18Use a dedicated type instead of a reference for the diagnostic contextOli Scherer-2/+2
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-12Un-unsafe the `StableOrd` traitAlan Egerton-1/+1
Whilst incorrect implementations of this trait can cause miscompilation, they cannot cause memory unsafety in rustc.
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-06Make the panic info more usefulOli Scherer-2/+1
2024-05-21Add a footer in FileEncoder and check for it in MemDecoderBen Kimock-7/+3
2024-05-03Remove some unneeded `Cargo.toml` dependencies.Nicholas Nethercote-1/+0
I found these with a hacky shell script.
2024-04-30Remove `extern crate tracing` from numerous crates.Nicholas Nethercote-6/+5
2024-04-29Remove `extern crate rustc_data_structures` from `rustc_query_system`.Nicholas Nethercote-18/+19
2024-04-29Remove `extern crate rustc_macros` from numerous crates.Nicholas Nethercote-4/+4
2024-04-22Rollup merge of #124252 - michaelwoerister:better-forbidden-read-ice, r=oli-obkGuillaume Gomez-1/+44
Improve ICE message for forbidden dep-graph reads. The new message mentions the main context that the ICE might occur in and it mentions the query/dep-node that is being read. cc https://github.com/rust-lang/rust/pull/123781, where this would have been helpful.
2024-04-22Stabilize generic `NonZero`.Markus Reiter-1/+0
2024-04-22Add more context to the forbidden dep-graph read ICE error message.Michael Woerister-1/+5
2024-04-22Improve ICE message for forbidden dep-graph reads.Michael Woerister-1/+40
2024-04-11remove some things that do not need to beMatthias Krüger-6/+1