-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Improve inference for conditional dispatch #17901
Labels
A-trait-system
Area: Trait system
Comments
nikomatsakis
added a commit
to nikomatsakis/rust
that referenced
this issue
Nov 6, 2014
…type variables in the intracrate case. This requires a deeper distinction between inter- and intra-crate so as to keep coherence working. I suspect the best fix is to generalize the recursion check that exists today, but this requires a bit more refactoring to achieve. (In other words, where today it says OK for an exact match, we'd want to not detect exact matches but rather skolemize each trait-reference fresh and return AMBIG -- but that requires us to make builtin bounds work shallowly like everything else and move the cycle detection into the fulfillment context.)
MoveItems is now gone, so I'm not sure what code sample constructs this. |
I think I'm going to close this. There are certainly improvements to be made but I think the pressing need for this particular example is past. |
cc me |
lnicola
pushed a commit
to lnicola/rust
that referenced
this issue
Oct 8, 2024
…art-debug, r=Veykril Building before a debugging session was restarted # Background Resolves rust-lang#17901. It adds support for rebuilding after debugging a test was restarted. This means the test doesn't have to be aborted and manually re-ran again. # How this is tested First, all the Visual Studio Code extensions are loaded into an Extension Host window. Then, a sample test like below was ran and restarted to see if it was correctly rebuild. ```rust #[test] fn test_x() { assert_eq!("1.1.1", "1.1.0"); } ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the comments on PR #17669, @japaric raised this example:
This comment describes why inference fails: #17669 (comment)
It's plausible we could infer a result here. More concretely, it would mean changing the logic in
evaluate_stack
to not be so eager to declare a trait-reference ambiguous it it contains an unbound variable. However, we have to be careful:impl IntoIter<Vec<u8>> for Vec<u8>
would be a coherence violation.impl<T:Eq> Eq for Vec<T>
, when matching against an inference variable$0
, would unify and yield a subconstraint$1 : Eq
for some fresh variable$1
, which would then unify withVec<$2>
and repeat into a horrible cycle. This rule was what evades that cycle and made the whole patch work.So I'm not 100% sure this can be fixed, but I suspect it could if we made the rule more subtle.
The text was updated successfully, but these errors were encountered: