Skip to content

Conversation

Veykril
Copy link
Member

@Veykril Veykril commented Mar 30, 2021

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

@@ -2564,3 +2564,46 @@ fn f() {
"#,
)
}

#[test]
fn qualified_as_trait_cast() {
Copy link
Member Author

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?

Copy link
Contributor

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.

Copy link
Member Author

@Veykril Veykril Mar 30, 2021

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)

Copy link
Member

@flodiebold flodiebold Mar 30, 2021

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.)

Copy link
Member Author

@Veykril Veykril Mar 30, 2021

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)

Copy link
Contributor

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.

Copy link
Member Author

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.

@flodiebold
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented Mar 31, 2021

@bors bors bot merged commit c69f6f3 into rust-lang:master Mar 31, 2021
@Veykril Veykril deleted the as-ty-cast branch March 31, 2021 10:11
@lnicola
Copy link
Member

lnicola commented Mar 31, 2021

Looks like this turned type mismatches into unknown types in diesel 😄:

image

@lnicola
Copy link
Member

lnicola commented Mar 31, 2021

changelog fix fix generic argument lowering in qualified trait casts (helps with .await).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The return of .await is not typed as the Output of a BoxFuture, but as a Future::Output<...>
4 participants