Enable "jump to def" feature on patterns#134216
Conversation
| } | ||
| } | ||
|
|
||
| fn handle_pat(&mut self, p: &Pat<'_>) { |
There was a problem hiding this comment.
This function very closely mirrors intravisit::walk_pat. The only difference is the QPath handling. The more general and cleaner solution would be to explicitly implement visit_qself. This would automatically handle paths in expression, pattern and type contexts.
For example, rn we don't linkify Self::Var (ExprKind::Path(qpath)):
impl Trait for Ty { fn f() { let _ = Self::Var; } }
pub enum Ty { Var }
pub trait Trait { fn f(); }Moreover, I presume we don't linkify Self::Assoc in impl ... for ... { type Ty = Self::Assoc; } (TyKind::Path(qpath)) but I can't check, I'm commuting atm.
However, this would require this "maybe_typeck_results/qpath_res " setup I mentioned on Zulip. Furthermore, it would support fully-qualified paths <Ty as TraitRef>::assoc which we don't on master.
Anyway, if you don't want to do that in this PR, I can send a follup-up PR that impls that.
My 2¢ – won't say more rn, I'm still commuting lol.
There was a problem hiding this comment.
It was not in hurry for review you know. 😅 (But thanks!)
So do you want me to implement visit_qself in this PR or in a follow-up?
There was a problem hiding this comment.
Let me get back home, then I'm going to answer that xD
|
@bors r+ rollup |
…=fmease Enable "jump to def" feature on patterns Part of rust-lang#89095. Pattern (as in "patterns in pattern matching") were not handled by the feature, it's now added. It all started when I realized that prelude values like `Some` or `Err` were not getting a link generated either (added support for it in the first commit). r? `@fmease`
…llaumeGomez Rollup of 5 pull requests Successful merges: - rust-lang#134216 (Enable "jump to def" feature on patterns) - rust-lang#134353 (Treat safe target_feature functions as unsafe by default [less invasive variant]) - rust-lang#134880 (Made `Path::name` only have item name rather than full name) - rust-lang#135466 (Leak check in `impossible_predicates` to avoid monomorphizing impossible instances) - rust-lang#135476 (Remove remnant of asmjs) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#134216 (Enable "jump to def" feature on patterns) - rust-lang#134880 (Made `Path::name` only have item name rather than full name) - rust-lang#135466 (Leak check in `impossible_predicates` to avoid monomorphizing impossible instances) - rust-lang#135476 (Remove remnant of asmjs) - rust-lang#135479 (mir borrowck: cleanup late-bound region handling) - rust-lang#135493 (Fix legacy symbol mangling of closures) - rust-lang#135495 (Add missing closing backtick in commit hook message 🐸) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#134216 - GuillaumeGomez:jump-to-def-pats, r=fmease Enable "jump to def" feature on patterns Part of rust-lang#89095. Pattern (as in "patterns in pattern matching") were not handled by the feature, it's now added. It all started when I realized that prelude values like `Some` or `Err` were not getting a link generated either (added support for it in the first commit). r? ``@fmease``
Part of #89095.
Pattern (as in "patterns in pattern matching") were not handled by the feature, it's now added.
It all started when I realized that prelude values like
SomeorErrwere not getting a link generated either (added support for it in the first commit).r? @fmease