-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fix generic arguments being incorrectly offset in qualified trait casts #8266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
crates/hir_ty/src/tests/simple.rs
Outdated
@@ -2564,3 +2564,46 @@ fn f() { | |||
"#, | |||
) | |||
} | |||
|
|||
#[test] | |||
fn qualified_as_trait_cast() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this test belong here or in regressions? or maybe somewhere else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it doesn’t matter if you add a cov-mark here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do cov-marks not work across crates? The test(check) is in hir_ty
but the fix(hit) is in hir_def
and it isnt being hit(but the branch is definitely being executed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd put it in traits.rs
since it's not that simple 😄 (Also this isn't really a cast, just a qualified path.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I never know how to call/name this, cause qualified path isn't specific enough in my eyes 😄 (guess I repeated the same mistake I did in the qualify path
assist)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oups, indeed, cov-marks work only within a single crate. That's because they rely on cfg(test)
to emit the code, and that is set only for the leaf crate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah that makes sense, figured it had to be something like that.
bors r+ |
changelog fix fix generic argument lowering in qualified trait casts (helps with |
We reverse the segments and generic args of the lowered path after building it, this wasn't accounted for when inserting the self parameter in
Type as Trait
segments.Fixes #5886