Skip to content

incr.comp.: Possible cross-session instability in DefPath #42550

Closed
@michaelwoerister

Description

@michaelwoerister

It seems problematic to me that DefPathData (the components of a DefPath) use Ident for storing their string fields because Ident contains SyntaxContext, which, if I understand it correctly, is a monotonically increasing interning key/ID. As a consequence, changing something somewhere involving a new SyntaxContext might have non-local effects, as the u32 in there possibly gets shifted for all subsequent Idents. This would be unfortunate because avoiding issues of this kind is the reason we introduced DefPath for in the first place.

My question is: Why do we even use Ident here in the first place? Wouldn't InternedString or Symbol be sufficient? DefPath already has a mechanism for disambiguating things that have the same string value (see DisambiguatedDefPathData).

cc @jseyfried and the rest of @rust-lang/compiler

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-incr-compArea: Incremental compilationA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions