Refactor definitions of ADTs in rustc::middle::def#31010
Refactor definitions of ADTs in rustc::middle::def#31010bors merged 3 commits intorust-lang:masterfrom
Conversation
|
r? @arielb1 (rust_highfive has picked a reviewer for you, use r? to override) |
src/librustc/middle/def.rs
Outdated
There was a problem hiding this comment.
Since you’re refactoring here, might it also be a good time to move from tuple-variants to struct-variants, so comments like these aren’t necessary anymore?
There was a problem hiding this comment.
Yeah, and rename DefVariant to Def::Variant etc.
It would be a huge code churn and I'd like to separate changes done in this PR from pure renaming. But I can do it in this PR in separate commits if reviewer agrees.
|
Renaming Also, test needed. r+ modulo test. |
|
Updated with a test and renamed variants. @nagisa |
|
@bors r+ |
|
📌 Commit 2084c2c has been approved by |
All structs and their constructors are defined as `DefStruct`. `DefTy` is splitted into `DefEnum` and `DefTyAlias`. Ad hoc flag `bool is_structure` is removed from `DefVariant`, it was required in one place in resolve and could be obtained by other means. Flag `bool is_ctor` is removed from `DefFn`, it wasn't really used for constructors outside of metadata decoding. Observable effects: More specific error messages are selected in some cases. Two name resolution bugs fixed (#30992 and FIXME in compile-fail/empty-struct-braces-expr.rs). Fixes #30992 Closes #30361
All structs and their constructors are defined as
DefStruct.DefTyis splitted intoDefEnumandDefTyAlias.Ad hoc flag
bool is_structureis removed fromDefVariant, it was required in one place in resolve and could be obtained by other means.Flag
bool is_ctoris removed fromDefFn, it wasn't really used for constructors outside of metadata decoding.Observable effects:
More specific error messages are selected in some cases.
Two name resolution bugs fixed (#30992 and FIXME in compile-fail/empty-struct-braces-expr.rs).
Fixes #30992
Closes #30361