-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make untracked incr. comp. information inaccessible #90317
Comments
Can these items be done one at a time? |
Of course! |
Will give this a go and see what happens. @rustbot claim |
I started experimenting with |
Update: No. 😄 |
Looks like removing rust/compiler/rustc_index/src/vec.rs Line 107 in 473eaa4
|
Most of them are already "tracked" by discarding the entire incr comp cache if they change. The ones that aren't tracked are explicitly not tracked. See the |
This comment has been minimized.
This comment has been minimized.
@cjgillot It looks like (So does |
I think it would be useful to enforce that |
This comment has been minimized.
This comment has been minimized.
@Aaron1011 Did you have someplace specific in mind for where to add this check? |
The fields could be made private and instead a getter for each option could be exposed that run |
That is, fields of rust/compiler/rustc_session/src/options.rs Line 165 in 3b263ce
rust/compiler/rustc_session/src/options.rs Line 1176 in 3b263ce
|
This moves us a step closer to removing the `PartialOrd/`Ord` impls for `DefId`. See rust-lang#90317
…ochenkov Remove (transitive) reliance on sorting by DefId in pretty-printer This moves us a step closer to removing the `PartialOrd/`Ord` impls for `DefId`. See rust-lang#90317
…ochenkov Remove (transitive) reliance on sorting by DefId in pretty-printer This moves us a step closer to removing the `PartialOrd/`Ord` impls for `DefId`. See rust-lang#90317
This implementation is unused. Helps with rust-lang#90317.
Stop sorting via `DefId`s in region resolution hopefully maintains the perf improvement from rust-lang#118824 works towards rust-lang#90317
Remove `DefId`'s `Partial/Ord` impls work towards rust-lang#90317 based on rust-lang#122824 and rust-lang#122820 r? `@michaelwoerister`
…ichaelwoerister Stop sorting via `DefId`s in region resolution hopefully maintains the perf improvement from rust-lang#118824 works towards rust-lang#90317
Stop using `<DefId as Ord>` in various diagnostic situations work towards rust-lang#90317 Reverts part of rust-lang#106281, as it sorts constants and that's problematic since it can contain `ParamConst`, which contains `DefId`s
Rollup merge of rust-lang#122820 - oli-obk:no_ord_def_id, r=estebank Stop using `<DefId as Ord>` in various diagnostic situations work towards rust-lang#90317 Reverts part of rust-lang#106281, as it sorts constants and that's problematic since it can contain `ParamConst`, which contains `DefId`s
…rister Remove `DefId`'s `Partial/Ord` impls work towards rust-lang#90317 based on rust-lang#122824 and rust-lang#122820 r? `@michaelwoerister`
Stop sorting `Span`s' `SyntaxContext`, as that is incompatible with incremental work towards rust-lang#90317 Luckily no one actually needed these to be sorted, so it didn't even affect diagnostics. I'm guessing they'd have been sorted by creation time anyway, so it wouldn't really have mattered. r? `@cjgillot`
Stop sorting `Span`s' `SyntaxContext`, as that is incompatible with incremental work towards rust-lang/rust#90317 Luckily no one actually needed these to be sorted, so it didn't even affect diagnostics. I'm guessing they'd have been sorted by creation time anyway, so it wouldn't really have mattered. r? `@cjgillot`
Stop sorting `Span`s' `SyntaxContext`, as that is incompatible with incremental work towards rust-lang/rust#90317 Luckily no one actually needed these to be sorted, so it didn't even affect diagnostics. I'm guessing they'd have been sorted by creation time anyway, so it wouldn't really have mattered. r? `@cjgillot`
Stop sorting `Span`s' `SyntaxContext`, as that is incompatible with incremental work towards rust-lang/rust#90317 Luckily no one actually needed these to be sorted, so it didn't even affect diagnostics. I'm guessing they'd have been sorted by creation time anyway, so it wouldn't really have mattered. r? `@cjgillot`
When iterating over a collection, be it a Vec, a HashMap or an IndexMap, the order of items influences the value of the resulting hash:
[a, b]
and[b, a]
have different hashes.Meanwhile, there is some information we do not want to track. This is the case of the value of
LocalDefId
. Inserting a function in a file will change other functionsLocalDefId
, but it will not change theirDefPathHash
.My concern is about controlling this information flow. In order to do that
ToStableHashKey
trait replaces the iteration order of the collection (which for hash maps is based on the key and the allocated memory capacity and should be irrelevant to the compilation), by the order of a stable hash key (theDefPathHash
when the key isLocalDefId
). By sorting the vectors by stable key, we manage the information flow.Using
IndexMap
, the iteration order is the insertion order. Normally, this insertion order should only depend on tracked information obtained by depending on another query. For instance, a HIR visitor will create a query dependency onhir_owner_nodes
, which hashes the in-code declaration order of functions. However, and this is my concern, the order ofLocalDefId
is freely available without using a query and is purposely untracked.In order to make
IndexMap
s safe for incr. comp., we need to ensure untracked information is inaccessible.Known issues:
PartialOrd
andOrd
onDefId
;PartialOrd
,Ord
andIdx
forLocalDefId
;PartialOrd
,Ord
andIdx
forLocalExpnId
;PartialOrd
andOrd
forSyntaxContext
;Originally posted by @cjgillot in #90253 (comment)
The text was updated successfully, but these errors were encountered: