Skip to content

Syntax context output in --pretty expanded,hygiene doesn't represent linked syntax contexts #16420

Closed
@huonw

Description

@huonw

E.g.

#![feature(macro_rules)]
// minimal junk
#![no_std]

macro_rules! foo {
    ($x: ident) => { y + $x }
}

fn bar() {
    let x = 1;
    foo!(x)
}

becomes

#![feature(macro_rules)]
// minimal junk
#![no_std]


fn bar /* 61#0 */() { let x /* 58#2 */ = 1; y /* 60#4 */ + x /* 58#5 */ }

Specifically, the syntax contexts of x /* 58#2 */ and x /* 58#5 */ are linked (the xs refer to the same identifier, even with hygiene) but this is not represented in the output at all, so one might interpret them as being distinct identifiers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-prettyArea: Pretty printing (including `-Z unpretty`)C-bugCategory: This is a bug.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