Skip to content
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

fix: #12247 fully qualified call required to determine trait method type #13754

Closed
wants to merge 5 commits into from

Conversation

bitgaoshu
Copy link
Contributor

@bitgaoshu bitgaoshu commented Dec 10, 2022

under standard core
截屏2022-12-10 15 26 53

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 10, 2022
@jonas-schievink jonas-schievink added the A-ty type system / type inference / traits / method resolution label Dec 13, 2022
@lnicola
Copy link
Member

lnicola commented Jan 13, 2023

r? @flodiebold

@flodiebold
Copy link
Member

Maybe I'm misunderstanding the change, but I'm a bit confused. The test code doesn't actually work under rustc. Also, we would actually need to call (or simulate calling) Into::into on the error type, not do a coercion, I think?

@bitgaoshu
Copy link
Contributor Author

bitgaoshu commented Jan 20, 2023 via email

@bitgaoshu bitgaoshu force-pushed the fix_12247 branch 2 times, most recently from e9e0910 to 605b616 Compare January 28, 2023 14:32
@bitgaoshu
Copy link
Contributor Author

bitgaoshu commented Jan 28, 2023

Sorry I don't know what the detail difference between From and Into. And I changed test code to Into, the test code work under rustc. Actually, The code does not coercion, just unify. @flodiebold

@bors
Copy link
Contributor

bors commented Feb 1, 2023

☔ The latest upstream changes (presumably #14036) made this pull request unmergeable. Please resolve the merge conflicts.

let residual = self.resolve_ops_try_err();
let expect_err = self.resolve_associated_type(self.return_ty.clone(), residual);
let actual_err = self.resolve_associated_type(actual_ret, residual);
self.table.unify(&actual_err, &expect_err);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would cause a false positive type mismatch in this code:

fn x() -> Result<(), E2> {
    let a: Result<i32, _> = Ok(2);
    let b = a?;
    let c: Result<i32, E1> = a;
    Ok(())
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

截屏2023-02-17 20 43 46

截屏2023-02-17 20 47 06

I use rustc 1.66.1, it's a type mismatch and ra with the patch give a hint.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the from impl, it works (playground).

@HKalbasi HKalbasi added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 17, 2023
@bors
Copy link
Contributor

bors commented Mar 21, 2023

☔ The latest upstream changes (presumably #14368) made this pull request unmergeable. Please resolve the merge conflicts.

@Veykril
Copy link
Member

Veykril commented May 4, 2023

What is the status of this PR? I am still not sure what this is trying to fix.

@HKalbasi
Copy link
Member

HKalbasi commented May 4, 2023

I think this is now in an unrecoverable / irrelevant state, as we now desugar ? and there is no Expr::Try anymore. So let's closing.

@HKalbasi HKalbasi closed this May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ty type system / type inference / traits / method resolution S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants