refactor: In alter_ty_path, return on failed unpack#1820
Open
Rua wants to merge 1 commit into
Open
Conversation
ahomescu
reviewed
May 22, 2026
| } | ||
|
|
||
| unpack!([&mut t.kind] TyKind::Path(qself, path)); | ||
| unpack!([&mut t.kind] TyKind::Path(qself, path); return); |
Contributor
There was a problem hiding this comment.
Silencing errors isn't really the way to fix issues, let's investigate this.
Any idea why a type would appear as hir::TyKind::Path in the HIR, but as an Rptr in the AST? Maybe an alias? Could you print out which type this is?
Contributor
Author
There was a problem hiding this comment.
I printed out qpath when t.kind isn't TyKind::Path:
if !matches!(t.kind, TyKind::Path(..)) {
panic!("{qpath:?}");
}and got:
Resolved(
None,
Path {
span: Span {
lo: BytePos(129233),
hi: BytePos(129242),
ctxt: #57
},
res: PrimTy(
Bool
),
segments: [
PathSegment {
ident: bool#57,
hir_id: HirId {
owner: OwnerId {
def_id: DefId {
krate: crate0,
index: DefIndex(
50254
)
}
},
local_id: 25
},
res: PrimTy(
Bool
),
args: None,
infer_args: false
}
]
}
)So it's... bool? Not sure how to make sense of that one.
Contributor
Author
There was a problem hiding this comment.
Random thought: if the refactorer is making modifications to the AST, what happens to the HIR? Is it modified in parallel? If not, what keeps the two in sync? Could that be the issue here?
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.
derive(PartialEq, Eq)#1818This is a fix, but I don't know if it's actually the correct fix.