-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
resolve: Support imports of associated types and glob imports from traits #138712
base: master
Are you sure you want to change the base?
Conversation
r? @wesleywiser rustbot has assigned @wesleywiser. Use |
HIR ty lowering was modified cc @fmease |
if path.segments.len() < 2 { | ||
let guar = self | ||
.dcx() | ||
.struct_span_err(span, "cannot infer type, type annotations needed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#138711 is an issue for reporting some proper error here instead of this stub.
if path.segments.len() < 2 { | ||
let guar = self | ||
.dcx() | ||
.struct_span_err(span, "cannot infer type, type annotations needed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.struct_span_err(span, "cannot infer type, type annotations needed") | |
.struct_span_err(span, "cannot infer value from uninitialized type") |
from what I can tell of tests/ui/use/import_trait_associated_item_bad.rs
the error isn't really type related?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error is copypasted from the non-min_generic_const_args
case, see #138711.
(It's the Self
type that cannot be inferred here.)
This comment has been minimized.
This comment has been minimized.
The job Click to see the possible cause of the failure (guessed by this bot)
|
Follow up to #134754, part of #134691.
This PR also fixes an ICE in #138711.
Prohibiting
use Trait::AssocType;
at name resolution stage doesn't make sense, the name itself is perfectly resolveable.It's a type checker's problem that the necessary generic args are not passed when the imported
AssocType
is used, so an error should be reported there.And since we can import associated trait items now, glob imports from traits can also be allowed.