Commit Graph

714 Commits

Author SHA1 Message Date
Daria Sukhonina c7b5fb5695 Also check in case it tries to mark red node as green 2025-12-12 16:44:17 +03:00
Daria Sukhonina 02bace8476 Add a sanity check in case of any duplicate nodes 2025-12-12 16:35:48 +03:00
Weihang Lo cf57b9b292 fix(span): track unnormalized source len for dep-info
Add `unnormalized_source_len` field to track the byte length
of source files before normalization (the original length).

`unnormalized_source_len` is for writing the correct file length
to dep-info for `-Zchecksum-hash-algorithm`
2025-11-15 09:05:08 -05:00
Weihang Lo 5f385829e2 refactor(span): rename source_len to normalized_source_len
This is a preparation for introducing a unnormalized source length field
2025-11-15 09:05:08 -05:00
ywxt a4d0507af7 Lock shards while collecting active jobs.
Co-authored-by: Zoxc <zoxc32@gmail.com>
2025-11-14 09:01:22 +08:00
Vyacheslav e77e5d1bc1 fix dev guide link in rustc_query_system/dep_graph/README.MD 2025-11-06 17:17:03 +05:00
Jacob Pratt 6353350d14 Rollup merge of #147830 - Noratrieb:reword-unstable-fingerprint-ice, r=jackh726
Reword unstable fingerprints ICE to ask for reproduction

When the unstable fingerprints error was added, Rust was on fire, and we needed a quick way for people to sort of understand what's going on, follow the tracking issue, and leave some information without overwhelming the issue tracker and focusing on getting their code working.

This is what motivated the previous message. It called this a "known issue", provided help on how to fix it, and only secondarily asked for a bug report.

This is no longer true. These days incremental compilation is fairly solid and these issues are supposed to be rare, we expect *none* of them to exist (but obviously know that's not true). As such, it's time to reword this message.

Recently someone mentioned how they didn't bother reporting this issue because it said that it was a "known issue", and I only got awareness of their problem because they complained about all the rustc-ice files hanging around their directories (https://github.com/rust-lang/rust/issues/147825#issuecomment-3417297842). This is not at all what we want, we want reports from people, ideally with a reproduction.

To get this, I reworded the error. It now explicitly asks for a reproduction (and explaining what that means) and no longer calls it a "known issue". It also does not link to the tracking issue anymore, because I don't think this tracking issue is useful. It should probably be closed.

I still mention the workaround, but explicitly call it a "workaround". People should report a reproduction and only *then* use the workaround.
2025-10-22 13:20:23 -04:00
Scott Schafer 12f6b9697f chore: Update typos to 1.38.1 2025-10-20 12:20:15 -06:00
Noratrieb d66647ba2c Reword unstable finterprint ICE to ask for reproduction
When the unstable finterprint error was added, Rust was on fire, and we
needed a quick way for people to sort of understand what's going on,
follow the tracking issue, and leave some information without
overwhelming the issue tracker and focusing on getting their code
working.

This is what motivated the previous message. It called this a "known
issue", provided help on how to fix it, and only secondarily asked for a
bug report.

This is no longer true. These days incremental compilation is fairly
solid and these issues are supposed to be rare, we expect *none* of them
to exist (but obviously know that's not true). As such, it's time to
reword this message.

Recently someone mentioned how they didn't bother reporting this issue
because it said that it was a "known issue", and I only got awareness of
their problem because they complained about all the rustc-ice files
hanging around their directories. This is not at all what we want, we
want reports from people, ideally with a reproduction.

To get this, I reworded the error. It now explicitly asks for a
reproduction (and explaining what that means) and no longer calls it a
"known issue". It also does not link to the tracking issue anymore,
because I don't think this tracking issue is useful. It should probably
be closed.

I still mention the workaround, but explicitly call it a "workaround".
People should report a reproduction and only *then* use the workaround.
2025-10-17 23:28:54 +02:00
bors 28c4c7d7ab Auto merge of #147508 - nnethercote:TaskDeps-improvements, r=saethlin
`TaskDeps` improvements

Some cleanups and minor perf improvements relating to `TaskDeps`.

r? `@saethlin`
2025-10-17 04:47:43 +00:00
Jana Dönszelmann 3941b42993 return spans out of is_doc_comment to reduce reliance on .span() on attrs 2025-10-14 15:36:09 +02:00
Stuart Cook 9ace0de26b Rollup merge of #147489 - chenyukang:yukang-prefer-repeat-n, r=Kivooeo,oli-obk
Prefer to use repeat_n over repeat().take()

More from https://github.com/rust-lang/rust/pull/147464, but batch processed with `ast-grep` to find and replace.

second commit add notes for library: https://github.com/rust-lang/rust/commit/affaf532f923df7ee1fb5a4aae1d844913ca1c74

r? ``@RalfJung``
2025-10-09 18:43:26 +11:00
Nicholas Nethercote 5d0007627a Clarify and improve EdgesVec::INLINE_CAPACITY use.
`INLINE_CAPACITY` has two different uses:
- It dictates the inline capacity of `EdgesVec::edges`, which is a
  `SmallVec`.
- It dictates when `TaskDeps` switches from a linear scan lookup to a
  hashset lookup to determine if an edge has been seen before.

These two uses are in the same part of the code, but they're
fundamentally separate and don't need to use the same constant.

This commit separates the two uses, and adds some helpful comments,
making the code clearer. It also changes the value used for the
linear/hashset threshold from 8 to 16, which gives slightly better perf.
2025-10-09 16:12:50 +11:00
Nicholas Nethercote 43e813c559 Replace TaskDeps::default() with TaskDeps::new().
There are only two places that create a `TaskDeps`. One constructs it
manually, the other uses `default`. It's weird that `default()` uses a
capacity of 128.

This commit just gets rid of `default` and introduces `new` so that
both construction sites can be equivalent.
2025-10-09 14:03:11 +11:00
Nicholas Nethercote 38d7e8b502 Rename a badly-named variable. 2025-10-09 13:22:43 +11:00
Nicholas Nethercote cc69b42519 Use contains with task_deps.reads. 2025-10-09 11:18:49 +11:00
yukang 1654cce210 prefer to use repeat_n over repeat and take 2025-10-09 01:24:55 +08:00
Nicholas Nethercote 19423b7f7f Simplify DepNodeColorMap::try_mark_green.
It uses a different implementation depending on whether the compiler
front-end is running single-threaded or multi-threaded. The two
implementations are equivalent and I think the multi-threaded one
expresses the intent more clearly, and I imagine the perf is similar. So
this commit removes the single-threaded code.
2025-10-07 15:32:34 +11:00
Nicholas Nethercote ed6a137a32 Tweak DepNodeColorMap::get.
The most common `get` case is green. This commit changes `get` to use
use `if`/`else` instead of match, so that getting green requires one
comparison instead of two.
2025-10-07 15:32:33 +11:00
Nicholas Nethercote 659b758be7 Make DepNodeColor tri-value.
Currently it's binary, either `Green` or `Red`. But it's almost always
used within an `Option`. So it's a bit neater, and possibly slightly
faster, to make it tri-value with `Unknown` as a first-class variant.
2025-10-07 09:37:45 +11:00
Nicholas Nethercote a4162d9a82 Change DepNodeColorMap::insert to insert_red.
Because it's only ever used for inserting red. (`None` is only used as a
starting value, and `Green` is inserted by `try_mark_green` and
friends.)
2025-10-07 09:33:33 +11:00
Nicholas Nethercote f644f2c1f3 Avoid passing Option<&MarkFrame<'_>>.
Two functions take arguments of this type, but the `Option` is always
`Some`, so we can just pass `&MarkFrame<'_>` instead.
2025-10-07 09:32:15 +11:00
Nicholas Nethercote 3a287e6034 Remove some unnecessary locals.
They both have a single use. (They can't be united, though, because
`self.colors` might change between the two `get` calls.)
2025-10-03 20:36:21 +10:00
Nicholas Nethercote cb0f969b62 Avoid getting dep_dep_node unnecessarily.
It's gotten on a hot path but only for use within `debug!`.
2025-10-03 20:34:56 +10:00
Jana Dönszelmann 6087d89004 fixup limit handling code 2025-09-08 15:07:12 -07:00
Jana Dönszelmann e1d3ad89c7 remove rustc_attr_data_structures 2025-07-31 14:19:27 +02:00
bors d242a8bd5a Auto merge of #144469 - Kivooeo:chains-cleanup, r=SparrowLii
Some `let chains` clean-up

Not sure if this kind of clean-up is welcoming because of size, but I decided to try out one

r? compiler
2025-07-28 05:25:23 +00:00
Kivooeo b8eb046e6e use let chains in mir, resolve, target 2025-07-28 06:10:36 +05:00
Cameron Steffen b8d628c1e1 Use LocalKey<Cell> methods more 2025-07-24 13:21:25 -05:00
Folkert de Vries 226b0fbe11 use is_multiple_of instead of manual modulo 2025-07-05 10:55:35 +02:00
klensy c76d032f01 setup CI and tidy to use typos for spellchecking and fix few typos 2025-07-03 10:51:06 +03:00
Trevor Gross 7b355110df Rollup merge of #142384 - celinval:chores-rayon-mv, r=oli-obk
Bringing `rustc_rayon_core` in tree as `rustc_thread_pool`

This PR moves [`rustc_rayon_core`](https://github.com/rust-lang/rustc-rayon/tree/5fadf44/rayon-core) from commit `5fadf44` as suggested in [this zulip thread](https://rust-lang.zulipchat.com/#narrow/channel/187679-t-compiler.2Fparallel-rustc/topic/Bringing.20.60rustc_rayon_core.60.20in.20tree). I tried to split the work into separate commits so it is easy to review. The first commit is a simple copy and paste from the fork, and subsequent changes were made to use the new crate and to ensure the new crate complies with different format and lint expectations.

**Call-out:** I was also wondering if I need to make any further changes to accommodate licensing requirements.

r? oli-obk
2025-06-20 23:25:54 -04:00
Camille GILLOT a5ff3cc3f5 Do not clone Arc when hashing span. 2025-06-11 23:44:22 +00:00
Celina G. Val 4aa62ea9e9 Use rustc_thread_pool instead of rustc-rayon-core 2025-06-11 12:26:42 -07:00
bjorn3 9223704f4b Remove all unused feature gates from the compiler 2025-06-08 14:50:42 +00:00
Michael Goulet cbb3a847d2 Ensure query keys are printed with reduced queries 2025-06-03 20:56:52 +00:00
ismailarilik 85efae7302 Handle rustc_query_system cases of rustc::potential_query_instability lint 2025-05-14 08:59:55 +03:00
Pietro Albini 2ce08ca5d6 update cfg(bootstrap) 2025-05-12 15:33:37 +02:00
bors 3ef8e64ce9 Auto merge of #139758 - Zoxc:thread-local-graph, r=oli-obk
Use thread local dep graph encoding

This adds thread local encoding of dep graph nodes. Each thread has a `MemEncoder` that gets flushed to the global `FileEncoder` when it exceeds 64 kB. Each thread also has a local cache of dep indices. This means there can now be empty gaps in `SerializedDepGraph`.

Indices are marked green and also allocated by the new atomic operation `DepNodeColorMap::try_mark_green` as the encoder lock is removed.
2025-05-07 12:39:54 +00:00
John Kåre Alsaker cdd104922d Use the portable AtomicU64 2025-05-06 18:36:14 +02:00
Zalathar 9e7fb67838 Rename graph::implementation::Graph to LinkedGraph 2025-05-06 14:35:06 +10:00
John Kåre Alsaker e1e8857d54 Add some comments about thread local indices 2025-05-05 21:01:43 +02:00
John Kåre Alsaker aeab2819f6 Tweak index chunk allocation 2025-05-05 20:50:32 +02:00
John Kåre Alsaker c43a6f05d6 Add some comments 2025-05-01 10:20:34 +02:00
John Kåre Alsaker d3ec14bbec Use thread local dep graph encoding 2025-05-01 10:20:31 +02:00
John Kåre Alsaker 08b27ffbe8 Add some comments 2025-04-29 12:04:33 +02:00
John Kåre Alsaker cff9efde74 Add a jobserver proxy to ensure at least one token is always held 2025-04-29 07:20:13 +02:00
bors e3e432d4d6 Auto merge of #139756 - Zoxc:out-of-order-dep-graph, r=oli-obk
Allow out of order dep graph node encoding

This allows out of order dep graph node encoding by also encoding the index instead of using the file node order as the index.

`MemEncoder` is also brought back to life and used for encoding.

Both of these are done to enable thread-local encoding of dep graph nodes.

This is based on https://github.com/rust-lang/rust/pull/139636.
2025-04-25 15:38:58 +00:00
est31 7493e1cdf6 Make #![feature(let_chains)] bootstrap conditional in compiler/ 2025-04-23 16:40:30 +02:00
John Kåre Alsaker 9a6e8b3807 Make sure there's no duplicate indices in the dep graph 2025-04-22 16:57:28 +02:00