Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
huonw opened this issue Aug 11, 2014 · 4 comments · Fixed by #64486
Closed
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`) C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@huonw
Copy link
Member

huonw commented Aug 11, 2014

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.

@huonw huonw changed the title Syntax context output in --pretty expanded,hygiene could contain more information Syntax context output in --pretty expanded,hygiene doesn't represent linked syntax contexts Aug 11, 2014
@steveklabnik steveklabnik added the A-pretty Area: Pretty printing (including `-Z unpretty`) label Jan 27, 2015
@steveklabnik
Copy link
Member

There is no more pretty=hygene, was it replaced with something?

@Mark-Simulacrum
Copy link
Member

Closing. pretty=hygiene is apparently no longer a thing, and the output looks sufficiently different with pretty=expanded,identified that I don't think it's the same.

@Eh2406
Copy link
Contributor

Eh2406 commented Sep 6, 2017

There is a FIXME related to this issue,
https://github.com/rust-lang/rust/blob/master/src/librustc_driver/pretty.rs#L459
Now that the issue is closed can the FIXME be fix, or made more specific?

@Mark-Simulacrum
Copy link
Member

Looks like pretty=expanded,hygiene is a thing though so reopening... output today is below. I'm not completely sure whether this is fixed or not --- the output looks the same for the two xs, I guess? Not sure which are being referred to either...

error[E0425]: cannot find value `y` in this scope
  --> test.rs:5:22
   |
5  |     ($x: ident) => { y + $x }
   |                      ^ did you mean `x`?
...
10 |     foo!(x)
   |     ------- in this macro invocation

#![feature(prelude_import)]
#![no_std]
// minimal junk
#![no_std]
#[prelude_import]
use core /* 94#0 */::prelude /* 98#0 */::v1 /* 99#0 */::*;
#[macro_use]
extern crate core /* 94 */ as core /* 94#0 */;

macro_rules! foo /* 87#0 */(( $ x : ident ) => { y + $ x });

fn bar /* 91#0 */() { let x /* 88#0 */ = 1; y /* 90#2 */ + x /* 88#0 */ }
error: aborting due to previous error

@alexcrichton alexcrichton added the C-bug Category: This is a bug. label Sep 7, 2017
@jonas-schievink jonas-schievink added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 15, 2019
tmandry added a commit to tmandry/rust that referenced this issue Sep 18, 2019
…petrochenkov

Print out more information for `-Zunpretty=expanded,hygiene`

I've found this helpful when trying to understand how hygiene works.

Closes rust-lang#16420
tmandry added a commit to tmandry/rust that referenced this issue Sep 18, 2019
…petrochenkov

Print out more information for `-Zunpretty=expanded,hygiene`

I've found this helpful when trying to understand how hygiene works.

Closes rust-lang#16420
@bors bors closed this as completed in a8aa511 Sep 18, 2019
lnicola pushed a commit to lnicola/rust that referenced this issue Jan 28, 2024
…is, r=Veykril

Use upstream exhaustiveness checker!

Because it has been librarified!

The extra `Apache-2.0 WITH LLVM-exception` license is for `rustc_apfloat`. Also this duplicates `rustc_index` because the other upstream deps are still on an earlier version. They should be bumpable now though. Good thing is that we don't need this new crate to be synchronized with the others, which will make our lives easier.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`) C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants