-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rustc: implement a pretty mode to print ident/name's ctxt & gensyms.
`--pretty expanded,hygiene` is helpful with debugging macro issues, since two identifiers/names can be textually the same, but different internally (resulting in weird "undefined variable" errors).
- Loading branch information
Showing
6 changed files
with
111 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
-include ../tools.mk | ||
|
||
all: | ||
$(RUSTC) -o $(TMPDIR)/input.out --pretty expanded,hygiene input.rs | ||
cp input.pp.rs $(TMPDIR)/input.pp.rs | ||
|
||
# the name/ctxt numbers are very internals-dependent and thus | ||
# change relatively frequently, and testing for their exact values | ||
# them will fail annoyingly, so we just check their positions | ||
# (using a non-constant replacement like this will make it less | ||
# likely the compiler matches whatever other dummy value we | ||
# choose). | ||
sed -i "s/[0-9]*#[0-9]*/$(shell date)/g" $(TMPDIR)/input.out $(TMPDIR)/input.pp.rs | ||
|
||
diff -u $(TMPDIR)/input.out $(TMPDIR)/input.pp.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
#![feature(macro_rules)] | ||
// minimal junk | ||
#![no_std] | ||
|
||
|
||
fn bar /* 62#0 */() { let x /* 59#2 */ = 1; y /* 61#4 */ + x /* 59#5 */ } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
#![feature(macro_rules)] | ||
// minimal junk | ||
#![no_std] | ||
|
||
macro_rules! foo { | ||
($x: ident) => { y + $x } | ||
} | ||
|
||
fn bar() { | ||
let x = 1; | ||
foo!(x) | ||
} |
d79047e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from pnkfelix
at huonw@d79047e
d79047e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging huonw/rust/pretty-expanded-hygiene = d79047e into auto
d79047e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huonw/rust/pretty-expanded-hygiene = d79047e merged ok, testing candidate = 80f0ed04
d79047e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some tests failed:
failure: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/1077
exception: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/1077
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/1076
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/1077
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/1072
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/1073
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/1072
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/1078
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/1073
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/1072
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/1075
exception: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/1076
exception: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/1074
exception: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/1075