Rename various query cycle things.#153979
Conversation
|
cc @Zalathar @Zoxc @zetanumbers I know this has high conflict potential so I'm happy to wait on merging this if it will cause problems for any other current work. But I did want to see what it would look like. I think it turned out well. |
|
No, I don't like renamings. I have to adjust every time. Thanks for notifying beforehand at least. But about the matter. The word "handle" seems like one of those fit-everything words like "data", etc. |
This comment has been minimized.
This comment has been minimized.
Not for the parallel case though, it's a list of edges labeled with |
Suggestion for a better name for that field? |
|
|
|
But if |
|
|
In this case it reflects the messiness of the code. Each
The existing name |
18f8c15 to
b357d7a
Compare
|
@rustbot ready |
|
@bors r+ |
…=petrochenkov Rename various query cycle things. The existing names have bugged me for a while. Changes: - `CycleError` -> `Cycle`. Because we normally use "error" for a `Diag` with `Level::Error`, and this type is just a precursor to that. Also, many existing locals of this type are already named `cycle`. - `CycleError::cycle` -> `Cycle::frames`. Because it is a sequence of frames, and we want to avoid `Cycle::cycle` (and `cycle.cycle`). - `cycle_error` -> `find_and_handle_cycle`. Because that's what it does. The existing name is just a non-descript noun phrase. - `mk_cycle` -> `handle_cycle`. Because it doesn't make the cycle; the cycle is already made. It handles the cycle, which involves (a) creating the error, and (b) handling the error. - `report_cycle` -> `create_cycle_error`. Because that's what it does: creates the cycle error (i.e. the `Diag`). - `value_from_cycle_error` -> `handle_cycle_error_fn`. Because most cases don't produce a value, they just emit an error and quit. And the `_fn` suffix is for consistency with other vtable fns. - `from_cycle_error` -> `handle_cycle_error`. A similar story for this module. r? @petrochenkov
This comment has been minimized.
This comment has been minimized.
The existing names have bugged me for a while. Changes: - `CycleError` -> `Cycle`. Because we normally use "error" for a `Diag` with `Level::Error`, and this type is just a precursor to that. Also, many existing locals of this type are already named `cycle`. - `CycleError::cycle` -> `Cycle::frames`. Because it is a sequence of frames, and we want to avoid `Cycle::cycle` (and `cycle.cycle`). - `cycle_error` -> `find_and_handle_cycle`. Because that's what it does. The existing name is just a non-descript noun phrase. - `mk_cycle` -> `handle_cycle`. Because it doesn't make the cycle; the cycle is already made. It handles the cycle, which involves (a) creating the error, and (b) handling the error. - `report_cycle` -> `create_cycle_error`. Because that's what it does: creates the cycle error (i.e. the `Diag`). - `value_from_cycle_error` -> `handle_cycle_error_fn`. Because most cases don't produce a value, they just emit an error and quit. And the `_fn` suffix is for consistency with other vtable fns. - `from_cycle_error` -> `handle_cycle_error`. A similar story for this module.
b357d7a to
90ea993
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
I rebased. @bors r=petrochenkov |
…=petrochenkov Rename various query cycle things. The existing names have bugged me for a while. Changes: - `CycleError` -> `Cycle`. Because we normally use "error" for a `Diag` with `Level::Error`, and this type is just a precursor to that. Also, many existing locals of this type are already named `cycle`. - `CycleError::cycle` -> `Cycle::frames`. Because it is a sequence of frames, and we want to avoid `Cycle::cycle` (and `cycle.cycle`). - `cycle_error` -> `find_and_handle_cycle`. Because that's what it does. The existing name is just a non-descript noun phrase. - `mk_cycle` -> `handle_cycle`. Because it doesn't make the cycle; the cycle is already made. It handles the cycle, which involves (a) creating the error, and (b) handling the error. - `report_cycle` -> `create_cycle_error`. Because that's what it does: creates the cycle error (i.e. the `Diag`). - `value_from_cycle_error` -> `handle_cycle_error_fn`. Because most cases don't produce a value, they just emit an error and quit. And the `_fn` suffix is for consistency with other vtable fns. - `from_cycle_error` -> `handle_cycle_error`. A similar story for this module. r? @petrochenkov
Rollup of 10 pull requests Successful merges: - #153964 (Fix `doc_cfg` not working as expected on trait impls) - #153979 (Rename various query cycle things.) - #154132 (Add missing num_internals feature gate to coretests/benches) - #154153 (core: Implement `unchecked_funnel_{shl,shr}`) - #154236 (Clean up query-forcing functions) - #154252 (Don't store current-session side effects in `OnDiskCache`) - #154017 ( Fix invalid add of duplicated call locations for the rustdoc scraped examples feature) - #154163 (enzyme submodule update) - #154264 (Update books) - #154282 (rustc-dev-guide subtree update)
|
I believe this broke query cycle handling. I'm seeing the following crash in ferrocene/ferrocene#2239: I think this is because rust/compiler/rustc_middle/src/query/plumbing.rs Lines 439 to 442 in 8a70352 |
|
the TaggedQueryKey that recurses infinitely is rust/tests/ui/delegation/bad-resolve.rs Line 33 in 8a70352 |
|
There have been a number of cycle-handling changes recently, so it’s plausible that something broke, but this particular PR seems to be a fairly clean renaming, so the cause might be elsewhere. |
The existing names have bugged me for a while. Changes:
CycleError->Cycle. Because we normally use "error" for aDiagwithLevel::Error, and this type is just a precursor to that. Also, many existing locals of this type are already namedcycle.CycleError::cycle->Cycle::frames. Because it is a sequence of frames, and we want to avoidCycle::cycle(andcycle.cycle).cycle_error->find_and_handle_cycle. Because that's what it does. The existing name is just a non-descript noun phrase.mk_cycle->handle_cycle. Because it doesn't make the cycle; the cycle is already made. It handles the cycle, which involves (a) creating the error, and (b) handling the error.report_cycle->create_cycle_error. Because that's what it does: creates the cycle error (i.e. theDiag).value_from_cycle_error->handle_cycle_error_fn. Because most cases don't produce a value, they just emit an error and quit. And the_fnsuffix is for consistency with other vtable fns.from_cycle_error->handle_cycle_error. A similar story for this module.r? @petrochenkov