-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
rustc: collapse relevant DefPathData variants into {Type,Value,Macro,Lifetime}Ns. #60525
Conversation
cb610a0
to
60f1944
Compare
| DefPathData::ClosureExpr | ||
| DefPathData::Ctor => Namespace::ValueNS, | ||
|
||
DefPathData::MacroNs(..) => Namespace::MacroNS, | ||
|
||
_ => Namespace::TypeNS, |
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.
Nit: could you use an exhaustive match here.
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.
Intentionally not using it because this are not really in the type namespace.
Maybe I should've made this function return -> Option<Namespace>
, but it's really just a private hack.
ctor: variant.ctor_def_id.map(|did| did.index), | ||
ctor_sig: None, |
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.
Not sure how this worked before.
@@ -157,13 +158,27 @@ crate fn program_clauses_for<'a, 'tcx>( | |||
tcx: TyCtxt<'a, 'tcx, 'tcx>, | |||
def_id: DefId, | |||
) -> Clauses<'tcx> { | |||
// FIXME(eddyb) this should only be using `def_kind`. |
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.
Do you mean introducing DefKind::Impl
or something else?
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.
Yeah, I think DefKind
should be able to describe everything with a DefId
.
@bors r+ |
📌 Commit 60f1944 has been approved by |
rustc: collapse relevant DefPathData variants into {Type,Value,Macro,Lifetime}Ns. `DefPathData` was meant to disambiguate within each namespace, but over the years, that purpose was overlooked, and it started to serve a double-role as a sort of `DefKind` (which #60462 properly adds). Now, we can go back to *only* categorizing namespaces (at least for the variants with names in them). r? @petrochenkov or @nikomatsakis cc @michaelwoerister
☀️ Test successful - checks-travis, status-appveyor |
DefPathData
was meant to disambiguate within each namespace, but over the years, that purpose was overlooked, and it started to serve a double-role as a sort ofDefKind
(which #60462 properly adds).Now, we can go back to only categorizing namespaces (at least for the variants with names in them).
r? @petrochenkov or @nikomatsakis cc @michaelwoerister