-Zunpretty=identified runs too early

bc8f97c
Opened by Huon Wilson at 2024-12-06 13:51:38
$ rustc --pretty identified hello-world.rs
fn main() { ((println /* -1 */)(("hello world" /* -1 */)) /* -1 */); } /*
block -1 */ /* -1 */

Clearly it's useless if the NodeIds are all -1 (I think it may just have to be removed in favour of --pretty expanded,identified since the NodeIds are only assigned after macro expansion, and only correspond to elements of that AST, not the pre-expansion one).

  1. fn main() { println!("hello world"); }
    

    rustc -Zunpretty=identified:

    fn main() { println!("hello world"); } /* block 4294967040 */ /* 4294967040 */
    

    Clearly it's useless if the NodeIds are all NodeId::MAX_AS_U32 (4294967040 aka -256_i32 as u32) (I think it may just have to be removed in favour of -Zunpretty=expanded,identified since the NodeIds are only assigned after macro expansion, and only correspond to elements of that AST, not the pre-expansion one).

    León Orell Valerian Liehr at 2024-09-03 05:05:55

  2. Running this on our stock Hello world gives

    fn main() { println!("Hello, world"); } /* block 4294967295 */ /* 4294967295
    */
    

    I would think that this would be okay to close, then. What do you think, @huonw ? I mean, the future of --pretty is in question too, isn't it?

    Steve Klabnik at 2015-01-20 20:37:45

  3. It's still useless, that number is just (-1) as u32; these sorts of compiler-internals flags like --pretty are likely to stick around (at least as "unstable" options) for compiler hacking/debugging.

    Huon Wilson at 2015-01-20 21:44:37

  4. Visiting for triage: the output has not changed

    coreyf@frewbook-air /tmp> cat hello-world.rs
    fn main() {
        println!("Hello world!");
    }
    
    coreyf@frewbook-air /tmp> rustc -Z unstable-options --pretty identified hello-world.rs
    fn main() { println!("Hello world!"); } /* block 4294967295 */ /* 4294967295
    */
    

    Corey Farwell at 2015-08-20 01:49:21

  5. Triage; still no change

    Steve Klabnik at 2017-02-07 20:24:33

  6. Triage: no changes

    Steve Klabnik at 2018-09-24 16:48:12

  7. Triage: this now prints

    fn main() { println!("Hello world!"); } /* block 4294967040 */ /* 4294967040
    */
    

    which is -256 as u32 and still pretty unhelpful.

    jyn at 2021-08-16 05:14:03

  8. Triage: no changes

    许杰友 Jieyou Xu (Joe) at 2024-12-06 13:51:38