Commit Graph

770 Commits

Author SHA1 Message Date
Zalathar ff331d2cc8 Rename HandleCycleError to CycleErrorHandling 2026-01-23 13:58:17 +11:00
Zalathar 395ca3be21 Remove #[derive(Clone)] from DepsType 2026-01-21 12:02:26 +11:00
Zalathar 154255698a Make Deps::name lookup a non-self associated function
The dep names needed here are statically available from `rustc_middle`.
2026-01-21 12:02:26 +11:00
bors 7981818138 Auto merge of #151076 - cuviper:compiler-hashbrown-0.16.1, r=Amanieu
compiler: upgrade to hashbrown 0.16.1

See also rust-lang/rust#135634, rust-lang/rust#149159, and rust-lang/hashbrown#662.

This includes an in-tree upgrade of `indexmap` as well, which uses the
new `HashTable` buckets API internally, hopefully impacting performance
for the better.

And finally, we can remove `#[rustc_unsafe_specialization_marker]` on `Copy`!

cc @joboet
r? @Amanieu
2026-01-20 05:44:13 +00:00
Jonathan Brouwer 0ee7d96253 Remove all allows for diagnostic_outside_of_impl and untranslatable_diagnostic throughout the codebase
This PR was mostly made by search&replacing
2026-01-19 17:39:49 +01:00
Zalathar 7ec34defe9 Temporarily re-export assert_matches! to reduce stabilization churn 2026-01-19 18:26:53 +11:00
Matthias Krüger 57e950bc98 Rollup merge of #151203 - revert-QueryStackFrame-split, r=oli-obk
Revert `QueryStackFrame` split

PR rust-lang/rust#138672 fixed a query cycle OOM reported in rust-lang/rust#124901. The fix involved delaying computation of some query stack frame elements and was very complex. It involved the addition of two new types, the addition of a generic `I` parameter to eleven(!) other types, a `PhantomData` field, and even required an unsafe transmute of a closure. [This comment](https://github.com/rust-lang/rust/issues/124901#issuecomment-2104852065) had suggested a much simpler fix, but it was ignored. The PR also failed to add a test case.

This PR adds a test case, reverts the complex fix, applies the simpler fix, and does a few other minor cleanups.

r? @oli-obk
2026-01-16 13:57:47 +01:00
Nicholas Nethercote 48bcaf7ed1 Revert the QueryStackFrameExtra/QueryStackDeferred split.
PR #138672 introduced a complex and invasive split of `QueryStackFrame`
to avoid a query cycle. This commit reverts that change because there is
a much simpler change that fixes the problem, which will be in the next
commit.
2026-01-16 19:18:42 +11:00
Felix Rath 8fa2f693bb Implement incremental caching for derive macro expansions 2026-01-16 07:36:36 +01:00
Josh Stone 348bfe3e35 compiler: upgrade to hashbrown 0.16.1
See also #135634, #149159, and rust-lang/hashbrown#662.

This includes an in-tree upgrade of `indexmap` as well, which uses the
new `HashTable` buckets API internally, hopefully impacting performance
for the better!
2026-01-13 11:18:09 -08:00
rust-bors[bot] 08f833aa17 Auto merge of #150540 - JonathanBrouwer:incremental_test, r=cjgillot
Also hash spans inside the same file as relative (V2)

Hashes spans relatively to their parent, even if they are not contained inside their parent.

Fixes https://github.com/rust-lang/rust/issues/150400

Closes https://github.com/rust-lang/rust/pull/143882, as this is a successor PR
This PR is very closely based on that PR with a few minor changes, so to give proper credit I made @cjgillot coauthor of the commit.
2026-01-11 08:54:50 +00:00
Jonathan Brouwer dc505a51a4 Hash all spans relatively to their parent
Co-authored-by: Camille Gillot <gillot.camille@gmail.com>
2026-01-08 21:20:17 +01:00
Jonathan Brouwer 7afba2977d Make attr path symbols rather than idents 2025-12-22 16:26:14 +01:00
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
Stuart Cook 6f490f7ae1 Rollup merge of #146112 - scrabsha:push-utkysktvulto, r=WaffleLapkin
don't uppercase error messages
2025-09-04 10:01:59 +10:00
Sasha Pourcelot 5c4b61b4b4 don't uppercase error messages
a more general version of https://github.com/rust-lang/rust/pull/146080.

after a bit of hacking in [`fluent.rs`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_fluent_macro/src/fluent.rs), i discovered that i'm not the only one that is bad at following guidelines 😅. this pr lowercases the first letter of all the error messages in the codebase.

(i did not change things that are traditionally uppercased such as _MIR_, _ABI_ or _C_)

i think it's reasonable to run a `@bors try` so all the test suite is checked, as i cannot run some of the tests on my machine. i double checked (and replaced manually) all the old error messages, but better be safe than sorry.

in the future i will try to add a check in `x test tidy` that errors if an error message starts with an uppercase letter.
2025-09-03 15:24:49 +02:00
Nicholas Nethercote 301655eafe Revert introduction of [workspace.dependencies].
This was done in #145740 and #145947. It is causing problems for people
using r-a on anything that uses the rustc-dev rustup package, e.g. Miri,
clippy.

This repository has lots of submodules and subtrees and various
different projects are carved out of pieces of it. It seems like
`[workspace.dependencies]` will just be more trouble than it's worth.
2025-09-02 19:12:54 +10:00
Nicholas Nethercote c50d2cc807 Add tracing to [workspace.dependencies]. 2025-08-27 14:21:19 +10: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