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

Check built-in operator obligation before the method's WF obligations so as to not incompletely guide inference #137811

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Feb 28, 2025

Fixes #137781

See the test description. Let me know if you want a more detailed step by step explanation for why this is failing.

We could alternatively fix this by trying to make Sized obligation checking less incomplete in the old solver... but that seems like a much larger change.

r? lcnr

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 28, 2025
@compiler-errors
Copy link
Member Author

compiler-errors commented Feb 28, 2025

We could alternatively fix this by trying to make Sized obligation checking less incomplete in the old solver... but that seems like a much larger change.

Which would fix #137812.

@compiler-errors
Copy link
Member Author

honestly E0284 kinda sucks lol, it's an error code for when a projection is ambiguous but when is a projection ever ambiguous without the corresponding trait goal being ambiguous?

There is no functional difference between these two predicates. We used
to only use E0284 for projection preds, and E0283 for trait preds. But
we also use E0284 for ConstParamHasTy and other const predicates...

Users don't really know the type system enough to be able to distinguish
this and E0283, so let's merge them.
@compiler-errors compiler-errors force-pushed the incompletely-guide-async-fn branch from 19695df to 8a458c8 Compare March 4, 2025 01:56
@rustbot rustbot added the WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) label Mar 4, 2025
@rustbot
Copy link
Collaborator

rustbot commented Mar 4, 2025

Some changes occurred in need_type_info.rs

cc @lcnr

@lcnr
Copy link
Contributor

lcnr commented Mar 5, 2025

cc rust-lang/trait-system-refactor-initiative#162

I would like to change the old solver to consider all builtin Sized candidates to be trivial (and no other builtin impls) and types FCP it. This would cause the old solver to match the new one while fixing this issue.

I am not opposed to this more localized fix but it feels kinda disappointing that it is necessary and don't have an immediate understanding of what happens here. Would need to look at it for more than 1 minute to approve this PR

@bors
Copy link
Contributor

bors commented Mar 7, 2025

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

@compiler-errors
Copy link
Member Author

I can give that a try. Kinda would like to land this just for the diagnostic changes, but maybe afterwards 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding Self: Sized alters AsyncFnOnce bounds
4 participants