You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, the existing test uses <Foo>::THEBAR and passes, even though the two syntaxes should be equivalent. There is no particularly deep issue here, I just seem to have been misunderstanding UFCS on the day when I wrote the resolve code involved, and as a result only inherent impls are picked up unless you use angle brackets. I plan to have a PR to fix this and a few other easy issues this weekend.
For future reference, this should be the case for associated constants:
Type::CONST // Equivalent to `<Type>::CONST`
<Type>::CONST // Resolves to `CONST` in an inherent impl if there is one, else a trait impl if not ambiguous.
Trait::CONST // Meaningless; there is absolutely no way to resolve this.
<Trait>::CONST // Currently meaningless, but may be useful if we add constants to the vtable for trait objects in the future.
<Type as Trait>::CONST // Resolves to the particular impl of `Trait for Type`.
The text was updated successfully, but these errors were encountered:
…age, r=nikomatsakis
This fixes#24922 and #25017, and reduces the number of error messages that talk about "methods" when associated constants rather than methods are involved.
I will admit that I haven't thought very carefully about the error messages. My goal has been to make more of the messages technically correct in all situations, and to avoid ICEs. But in some cases we could probably talk specifically about "methods" rather than "items".
Note that the following addition to the
associated-const-match-patterns
test would fail:However, the existing test uses
<Foo>::THEBAR
and passes, even though the two syntaxes should be equivalent. There is no particularly deep issue here, I just seem to have been misunderstanding UFCS on the day when I wrote theresolve
code involved, and as a result only inherent impls are picked up unless you use angle brackets. I plan to have a PR to fix this and a few other easy issues this weekend.For future reference, this should be the case for associated constants:
The text was updated successfully, but these errors were encountered: