update ambiguous_glob_imported_trait lint explanation and example. - #160354
update ambiguous_glob_imported_trait lint explanation and example.#160354LorrensP-2158466 wants to merge 1 commit into
ambiguous_glob_imported_trait lint explanation and example.#160354Conversation
|
rustbot has assigned @ShoyuVanilla. Use Why was this reviewer chosen?The reviewer was selected based on:
|
729e069 to
1ea66a6
Compare
| /// usable at all, but this is allowed for backwards compatibility (for now). | ||
| /// | ||
| /// When a trait and a non-trait item with the same name are both glob imported (as in | ||
| /// `trait_and_non_trait`), the trait is always considered in scope, so method resolution is |
There was a problem hiding this comment.
The trait is either in scope or not in scope, depending on name resolution internals (it's unpredictable which of the glob imports will be selected in case of conflicts). That's why the lint is reported, not just for consistency.
There was a problem hiding this comment.
As of #159599 the trait is actually in scope so that we can report that lint. That way its independent of which glob import is resolved first. Ideally it is never in scope, but that requires turning this lint into an error.
Or am i missing something?
There was a problem hiding this comment.
I mean it's in scope only because we recover it from ambiguities and put it into scope just for the lint.
When the lint is turned into an error it will no longer be in scope.
The current wording looks like there's no actual issue here, and we report just for consistency with the trait-vs-trait cases.
There was a problem hiding this comment.
Changed the phrasing.
1ea66a6 to
b6edc07
Compare
In the tracking issue for the
ambiguous_glob_imported_trait#152822 someone reported that the explanation is lacking/confusing since #159599.Explanation and example are extended in this pr.