rustc: Structures and their constructors have different definitions when defined locally and in other crate #30361
Labels
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Local
struct
-def::DefTy
,struct
from some other crate -def::DefStruct
Local
struct
constructor -def::DefStruct
,struct
constructor from some other crate -def::DefFn
Is there any rationale for these discrepancies?
I made some quick experiment and fixed the first discrepancy by using
DefStruct
in both cases. It resulted in better error diagnostics and one discovered bug. Seems like a win.I'd also like to split
DefTy(DefId, bool /* is_enum */)
intoDefEnum(DefId)
andDefTypeAlias(DefId)
. I have and impression that type aliases may be not always treated correctly, or at least consciously.cc @arielb1 @eddyb
The text was updated successfully, but these errors were encountered: