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?
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 toVariantDef(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 thehir::Tyin addition torustc_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::Tystores spans of nested types in variant fields data and function argument types.My main question is: does it make sense for
rustc_publicto have two set of types, likeSpannedTyandTy, in the future? How farrustc_publicis going to go deep in the details of spans it reports?