-
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
Support const args in type dependent paths (Take 2) #74113
Conversation
0c5695a
to
1e02449
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Queued e4220b3fb9c17c338cf69c14e8f91a7803b0d0b5 with parent 0c03aee, future comparison URL. |
Finished benchmarking try commit (e4220b3fb9c17c338cf69c14e8f91a7803b0d0b5): comparison url. |
6fa206c
to
26ad65e
Compare
@bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit 26ad65e7ac660a24f37813cb754fcaa1db0d9940 with merge b68a4014ccd7f0a6a24bd4662f34b565ca658c28... |
@rust-timer build b68a4014ccd7f0a6a24bd4662f34b565ca658c28 |
Queued b68a4014ccd7f0a6a24bd4662f34b565ca658c28 with parent 70f9d23, future comparison URL. |
Finished benchmarking try commit (b68a4014ccd7f0a6a24bd4662f34b565ca658c28): comparison url. |
@bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit 26f789f87b073a641d599e24c47d69d22b27c5a0 with merge 38457fb462ba475360cbcca5d21700c4e9b76596... |
☀️ Try build successful - checks-actions, checks-azure |
…=eddyb test caching opt_const_param_of on disc Followup to rust-lang#74113, implements parts of rust-lang#74360 Tried caching `opt_const_param_of` on disk and adding an early exit if `tcx.dep_kind(def_id) != DefKind::AnonConst`. Ended up causing a perf regression instead, so we just remove the FIXME and a short note to `opt_const_param_of`. r? @eddyb
This was a small perf loss, as expected. |
remove some const arg in ty dep path boilerplate followup to rust-lang#74113, together with rust-lang#74376, this closes rust-lang#74360. r? @eddyb
add `slice::array_chunks` to std Now that rust-lang#74113 has landed, these methods are suddenly usable. A rebirth of rust-lang#72334 Tests are directly copied from `chunks_exact` and some additional tests for type inference. r? @withoutboats as you are both part of t-libs and working on const generics. closes rust-lang#60735
once more, except it is sound this time 🥰 previously #71154
When calling
type_of
for generic const arguments, we now use theTypeckTables
of the surrounding body to get the expected type.This alone causes cycle errors though, as we now have
typeck_tables_of(main)
->...
->type_of(main_ANON0 := 7)
->typeck_tables_of(main)
⚡ (see #68400 (comment))To prevent this we must not call
type_of(const_arg)
duringtypeck_tables_of
. This is achieved bycalling
type_of(param_def_id)
instead.We have to somehow remember the
DefId
of the param through all of typeck, which is done using thestruct
ty::WithOptConstParam<DefId>
, which replacesDefId
where needed and contains anOption<DefId>
tobe able to store the const parameter in case it exists.
Queries which are currently cached on disk are split into two variants:
query_name
(cached) andquery_name_(of|for)_const_arg
(not cached), withquery_name_of_const_arg
taking a pair(did, param_did): (LocalDefId, DefId)
.For some queries a method
query_name_of_opt_const_arg
is added toTyCtxt
which takes aty::WithOptConstParam
and either callsquery_name
orquery_name_of_const_arg
depending on the value ofconst_param_did
.r? @eddyb @varkor