Merged
Conversation
Collaborator
|
r? @davidtwco (rustbot has picked a reviewer for you, use r? to override) |
fee1-dead
reviewed
Oct 31, 2022
Comment on lines
+478
to
+486
| pub fn walk_generic_arg<'v, V: Visitor<'v>>(visitor: &mut V, generic_arg: &'v GenericArg<'v>) { | ||
| match generic_arg { | ||
| GenericArg::Lifetime(lt) => visitor.visit_lifetime(lt), | ||
| GenericArg::Type(ty) => visitor.visit_ty(ty), | ||
| GenericArg::Const(ct) => visitor.visit_anon_const(&ct.value), | ||
| GenericArg::Infer(inf) => visitor.visit_infer(inf), | ||
| } | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
This should probably be after walk_inf instead of here.
Contributor
Author
There was a problem hiding this comment.
I would be happy to make that change.
But here are the visit_ methods in the order they appear in intravisit.rs:
visit_ methods
nested_item nested_trait_item nested_impl_item nested_foreign_item nested_body param item body id name ident mod foreign_item local block stmt arm pat pat_field array_length anon_const expr let_expr expr_field ty generic_param const_param_default generics where_predicate fn_decl fn use trait_item trait_item_ref impl_item foreign_item_ref impl_item_ref trait_ref param_bound poly_trait_ref variant_data field_def enum_def variant label infer generic_arg lifetime qpath path path_segment generic_args assoc_type_binding attribute associated_item_kind defaultness inline_asm
And here are the walk_ functions in the order they appear in intravisit.rs:
walk_ functions
mod body local ident label generic_arg lifetime poly_trait_ref trait_ref param item inline_asm use enum_def variant ty inf qpath path path_segment generic_args assoc_type_binding pat pat_field foreign_item param_bound generic_param const_param_default generics where_predicate fn_ret_ty fn_decl fn_kind fn trait_item trait_item_ref impl_item foreign_item_ref impl_item_ref struct_def field_def block stmt array_len anon_const let_expr expr_field expr arm associated_item_kind defaultness
Would it be better if I reordered the walk_ functions to match the order of the visit_ functions?
Member
Yeah, that would be desirable. But that seems okay as a followup. @bors r+ rollup |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Nov 1, 2022
Rollup of 10 pull requests Successful merges: - rust-lang#103007 (Add better python discovery) - rust-lang#103674 (Update note about unstable split-debuginfo flag.) - rust-lang#103692 (Add `walk_generic_arg`) - rust-lang#103749 (Reduce span of let else irrefutable_let_patterns warning) - rust-lang#103772 (better error for `rustc_strict_coherence` misuse) - rust-lang#103788 (Fix ICE in checking transmutability of NaughtyLenArray) - rust-lang#103793 (rustdoc: add margins to all impl-item toggles, not just methods) - rust-lang#103798 (interpret: move type_name implementation to an interpreter-independent helper file) - rust-lang#103799 (Remove generation of tuple struct fields in the search index) - rust-lang#103805 (Enable RUSTC_BOOTSTRAP for a few steps) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Dylan-DPC
added a commit
to Dylan-DPC/rust
that referenced
this pull request
Nov 2, 2022
…=fee1-dead Reorder `walk_` functions in intravisit.rs Reorder the `walk_` functions to match the order of the `visit_` methods. This is a follow up to rust-lang#103692. Note that there are some oddballs. I put them where I thought made the most sense: ```diff $ diff \ <(sed -n 's/^.*\<fn visit_\([^(]*\).*$/\1/;T;p' compiler/rustc_hir/src/intravisit.rs) \ <(sed -n 's/^.*\<fn walk_\([^<]*\).*$/\1/;T;p' compiler/rustc_hir/src/intravisit.rs) 1,5d0 < nested_item < nested_trait_item < nested_impl_item < nested_foreign_item < nested_body 9,10d3 < id < name 20c13 < array_length --- > array_len 30a24 > fn_ret_ty 31a26 > fn_kind 41c36 < variant_data --- > struct_def 46c41 < infer --- > inf 54d48 < attribute ``` Also, as some weak evidence that i did things correctly, I get the following before and after the change: ```sh $ sort compiler/rustc_hir/src/intravisit.rs | openssl sha256 SHA256(stdin)= cac13d2545731ef442f318e2b4286490d7ac5494f4ad10c4cf4c5d4f50d21641 ``` r? `@fee1-dead`
bors
added a commit
to rust-lang/rust-clippy
that referenced
this pull request
Nov 22, 2022
Use `walk_generic_arg` This is a tiny followup to to #9743, now that rust-lang/rust#103692 has landed. r? `@Alexendoo` changelog: none
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Could this please be added?
I could use it for a Clippy lint.