Allow visits from both visitor and VisitorMut at the same time without using trait disambiguation - #2389
Open
docteurklein wants to merge 1 commit into
Open
Allow visits from both visitor and VisitorMut at the same time without using trait disambiguation#2389docteurklein wants to merge 1 commit into
docteurklein wants to merge 1 commit into
Conversation
LucaCappelletti94
suggested changes
Aug 5, 2026
LucaCappelletti94
left a comment
Contributor
There was a problem hiding this comment.
Not a maintainer, just fellow contributor.
Consider rebasing on main, so the branch is up to speed. It is current some 20+ commits behind.
| #[cfg(test)] | ||
| mod visit_mut_tests { | ||
| use crate::ast::{Ident, Statement, Value, ValueWithSpan, VisitMut, VisitorMut}; | ||
| use crate::ast::{Ident, Statement, Value, ValueWithSpan, Visit, VisitMut, Visitor, VisitorMut}; |
Contributor
There was a problem hiding this comment.
Just eyeballing, but I would wager you need to run a cargo fmt --all -- --check.
| } | ||
|
|
||
| struct DummyVisitor; | ||
| impl Visitor for DummyVisitor { |
Contributor
There was a problem hiding this comment.
I suggest you have the dummy visitor do something, like count nodes
| } | ||
|
|
||
| struct DummyVisitorMut; | ||
| impl VisitorMut for DummyVisitorMut { |
Contributor
There was a problem hiding this comment.
And the dummy visitor mut to edit the nodes it visits.
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.
Closes #2067 .
Hello! I just now realize that I could have used overlapping trait Disambiguation:
But here I am with this proposition anyway.