Skip to content

Span for variant data / function arguments #118

@HKalbasi

Description

@HKalbasi

Currently, we can retrieve the span of a DefId, but not the span of its parts (e.g. fields of a struct). I guess we can easily add a span to VariantDef (I can make a PR if it is desired) but it is not the end. For getting span of the types of the fields (and nested types in their generic), rustc has the hir::Ty in addition to rustc_middle::Ty. The former is a type with syntactical presence in the source code, and contains span, and the latter is a conceptual type that is maybe generated during inference or MIR generation. hir::Ty stores spans of nested types in variant fields data and function argument types.

My main question is: does it make sense for rustc_public to have two set of types, like SpannedTy and Ty, in the future? How far rustc_public is going to go deep in the details of spans it reports?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions