Skip to content

rustc: Structures and their constructors have different definitions when defined locally and in other crate #30361

Closed
@petrochenkov

Description

@petrochenkov

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 */) into DefEnum(DefId) and DefTypeAlias(DefId). I have and impression that type aliases may be not always treated correctly, or at least consciously.

cc @arielb1 @eddyb

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions