Guillaume Gomez
f0987ab45b
Rollup merge of #114772 - fee1-dead-contrib:typed-did, r=b-naber
...
Add `{Local}ModDefId` to more strongly type DefIds`
Based on #110862 by `@Nilstrieb`
2023-08-15 14:29:45 +02:00
bjorn3
980143b50c
Pass WorkProductMap to build_dep_graph instead of FxIndexMap
...
Constructing an FxIndexMap is useless work as the iteration order never
matters.
2023-08-13 16:07:48 +00:00
Nilstrieb
40de40e094
Add typed {Local}DefId
for modules
...
This allows for better type safety in the compiler and also improves the
documentation for many things, making it clear that they expect modules.
2023-08-13 05:54:50 +00:00
Vadim Petrochenkov
907aa440cf
rustc: Move stable_crate_id
from Session
to GlobalCtxt
...
Removes a piece of mutable state.
Follow up to #114578 .
2023-08-09 14:35:23 +08:00
Matthias Krüger
23815467a2
inline format!() args up to and including rustc_middle
2023-07-30 13:18:33 +02:00
Oli Scherer
1ce80e210d
Allow LocalDefId
as the argument to def_path_str
2023-04-21 22:27:20 +00:00
Ben Kimock
0445fbdd83
Store hashes in special types so they aren't accidentally encoded as numbers
2023-04-18 10:52:47 -04:00
Camille GILLOT
5d8161c570
Hide warning.
2023-04-03 15:59:21 +00:00
John Kåre Alsaker
b3a4fe7d4e
Pass DepContext
and QueryContext
by value when practical
2023-02-14 17:21:18 +01:00
Nicholas Nethercote
f7b3e39502
Simplify tls::enter_context
.
2023-02-09 15:25:45 +11:00
Jeremy Stucki
3dde32ca97
rustc: Remove needless lifetimes
2022-12-20 22:10:40 +01:00
Camille GILLOT
6019cbbfd3
Allow query system to recover a HirId.
2022-10-01 15:58:42 +02:00
Joshua Nelson
00cde6d4b9
Move the codegen_unit
debug assert from rustc_query_system
to query_impl
...
This allows removing a function from the `DepKind` trait.
2022-09-25 12:08:36 -05:00
Joshua Nelson
ccc8d000f2
Move some more code from rustc_middle to rustc_query_system
2022-09-25 12:08:36 -05:00
Joshua Nelson
f3f91bb514
Move functions on DepKindStruct
from rustc_middle to rustc_query_system
2022-09-25 12:07:17 -05:00
Joshua Nelson
93a0fb190e
Move DepKindStruct
from rustc_middle to rustc_query_system
2022-09-25 11:56:23 -05:00
Takayuki Maeda
8fe936099a
separate definitions and HIR
owners
...
fix a ui test
use `into`
fix clippy ui test
fix a run-make-fulldeps test
implement `IntoQueryParam<DefId>` for `OwnerId`
use `OwnerId` for more queries
change the type of `ParentOwnerIterator::Item` to `(OwnerId, OwnerNode)`
2022-09-24 23:21:19 +09:00
Camille GILLOT
fc43df0333
Revert "Auto merge of #101620 - cjgillot:compute_lint_levels_by_def, r=oli-obk"
...
This reverts commit 2cb9a65684
, reversing
changes made to 750bd1a7ff
.
2022-09-22 19:36:11 +02:00
bors
294f0eef73
Auto merge of #101173 - jyn514:simplify-macro-arguments, r=cjgillot
...
Further simplify the macros generated by `rustc_queries`
This doesn't actually move anything outside the macros, but it makes them simpler to read.
- Add a new `rustc_query_names` macro. This allows a much simpler syntax for the matchers in the macros passed to it as a callback.
- Convert `define_dep_nodes` and `alloc_once` to use `rustc_query_names`. This is possible because they only use the names
(despite the quite complicated matchers in `define_dep_nodes`, none of the other arguments are used).
- Get rid of `rustc_dep_node_append`.
r? `@cjgillot`
2022-09-15 11:54:03 +00:00
Camille GILLOT
bd45139cb0
Allow query system to recover a HirId.
2022-09-14 19:04:13 +02:00
Joshua Nelson
3a4e3c7788
Get rid of the emitted rustc_query_names
and rustc_cached_queries
macro
...
We can avoid these by adding slightly more information to `rustc_query_append` instead.
2022-09-06 21:46:31 -05:00
Joshua Nelson
c630c87ceb
Support doc-comments in define_dep_nodes
2022-09-06 21:43:15 -05:00
Joshua Nelson
05886e28a4
Further simplify the macros generated by rustc_queries
...
- Add a new `rustc_query_names` macro. This allows a much simpler syntax for the matchers in the macros passed to it as a callback.
- Convert `define_dep_nodes` and `alloc_once` to use `rustc_query_names`. This is possible because they only use the names
(despite the quite complicated matchers in `define_dep_nodes`, none of the other arguments are used).
- Get rid of `rustc_dep_node_append`.
2022-09-06 21:43:15 -05:00
Joshua Nelson
4e09a13bb8
Don't create two new closures for each query
...
- Parameterize DepKindStruct over `'tcx`
This allows passing in an invariant function pointer in `query_callback`,
rather than having to try and make it work for any lifetime.
- Add a new `execute_query` function to `QueryDescription` so we can call `tcx.$name` without needing to be in a macro context
2022-09-01 18:47:54 -05:00
Joshua Nelson
7b8e2a52ff
Simplify the syntax for macros generated by rustc_queries
...
- Disallow multiple macros callbacks in the same invocation. In practice, this was never used.
- Remove the `[]` brackets around the macro name
- Require an `ident`, not an arbitrary `tt`
2022-08-24 00:37:49 -05:00
Joshua Nelson
b53761969f
Remove $tcx
metavariable from rustc_query_append
...
It's not actually necessary and it makes the code harder to read.
2022-08-23 21:33:19 -05:00
Camille GILLOT
e912c8dfe0
Use a dedicated DepKind for the forever-red node.
2022-07-06 23:20:12 +02:00
Camille GILLOT
43bb31b954
Allow to create definitions inside the query system.
2022-07-06 22:50:55 +02:00
Jacob Pratt
49c82f31a8
Remove crate
visibility usage in compiler
2022-05-20 20:04:54 -04:00
Camille GILLOT
07ee031763
Stop using CRATE_DEF_INDEX.
...
`CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want.
2022-04-17 12:14:42 +02:00
est31
60f969a4f2
Adopt let_else in even more places
2022-02-16 22:43:39 +01:00
Aaron Hill
70d36a05bc
Show a more informative panic message when DefPathHash
does not exist
...
This should hopefully make it easier to debug incremental compilation
bugs like #93096 without affecting performance.
2022-01-19 17:36:44 -05:00
Aaron Hill
f64cd87ca6
Introduce new TaskDepsRef
enum to track allow/ignore/forbid status
2022-01-08 18:22:06 -05:00
Aaron Hill
070bf94a6f
Remove in_band_lifetimes
from rustc_middle
...
See #91867
This was mostly straightforward. In several places, I take advantage
of the fact that lifetimes are non-hygenic: a macro declares the
'tcx' lifetime, which is then used in types passed in as macro
arguments.
2021-12-15 19:50:43 -05:00
Camille GILLOT
b11ec29e28
Address review.
2021-10-20 18:51:15 +02:00
Camille GILLOT
8785b70774
Inline DepNodeParams methods.
2021-10-20 18:46:25 +02:00
Camille GILLOT
bd5c107672
Build jump table at runtime.
2021-10-20 18:32:29 +02:00
Camille GILLOT
602d3cbce3
Invoke callbacks from rustc_middle.
2021-10-20 18:29:33 +02:00
Camille GILLOT
b09de95fab
Merge two query callbacks arrays.
2021-10-20 18:29:27 +02:00
Camille GILLOT
dc7143367c
Drop has_params.
2021-10-20 18:29:22 +02:00
Camille GILLOT
e53404cca6
Move def_path_hash_to_def_id to rustc_middle.
2021-10-20 18:28:54 +02:00
Mark Rousskov
6f78eed1c7
Query the fingerprint style during key reconstruction
...
Keys can be reconstructed from fingerprints that are not DefPathHash, but then
we cannot extract a DefId from them.
2021-10-06 22:19:48 -04:00
bors
55111d656f
Auto merge of #89266 - cjgillot:session-ich, r=michaelwoerister
...
Move ICH to rustc_query_system
Based on https://github.com/rust-lang/rust/pull/89183
The StableHashingContext does not need to be in rustc_middle.
This PR moves it to rustc_query_system. This will avoid a dependency between rustc_ast_lowering and rustc_middle in https://github.com/rust-lang/rust/pull/89124 .
2021-10-05 09:45:11 +00:00
Camille GILLOT
fedd7785fe
Access StableHashingContext in rustc_query_system.
2021-10-03 16:08:55 +02:00
Camille GILLOT
02025d86ac
Remove re-export.
2021-10-03 16:08:54 +02:00
bjorn3
e2d3e09b9c
Prevent macro ambiguity errors
...
The previous macro_rules! parsers failed when an additional modifier was added
with ambiguity errors. The error is pretty unclear as to what exactly the cause
here is, but this change simplifies the argument parsing code such that the
error is avoided.
2021-10-02 13:00:19 -04:00
Michael Woerister
2b60338ee9
Make DefPathHash->DefId panic for if the mapping fails.
...
We only use this mapping for cases where we know that it must succeed.
Letting it panic otherwise makes it harder to use the API in unsupported
ways.
2021-09-14 13:56:33 +02:00
Michael Woerister
5445715c20
Remove RawDefId tracking infrastructure from incr. comp. framework.
...
This infrastructure is obsolete now with the new encoding scheme for
the DefPathHash->DefIndex maps in crate metadata.
2021-09-14 13:56:33 +02:00
Aaron Hill
6fd6624045
Fix rebase fallout
2021-06-04 12:54:28 -05:00
Camille GILLOT
0e71283495
Restrict access to crate_name.
...
Also remove original_crate_name, which had the exact same implementation
2021-06-02 18:35:32 +02:00