@@ -14,7 +14,6 @@ use ast::{item_mac, Mrk, Stmt_, StmtDecl, StmtMac, StmtExpr, StmtSemi};
14
14
use ast:: { token_tree} ;
15
15
use ast;
16
16
use ast_util:: { mtwt_outer_mark, new_rename, new_mark} ;
17
- use ast_util;
18
17
use attr;
19
18
use attr:: AttrMetaMethods ;
20
19
use codemap;
@@ -1549,6 +1548,7 @@ mod test {
1549
1548
use ast;
1550
1549
use ast:: { Attribute_ , AttrOuter , MetaWord , EMPTY_CTXT } ;
1551
1550
use ast_util:: { get_sctable, mtwt_marksof, mtwt_resolve, new_rename} ;
1551
+ use ast_util;
1552
1552
use codemap;
1553
1553
use codemap:: Spanned ;
1554
1554
use fold;
@@ -1557,8 +1557,7 @@ mod test {
1557
1557
use parse:: token;
1558
1558
use print:: pprust;
1559
1559
use std;
1560
- use std:: vec;
1561
- use util:: parser_testing:: { string_to_crate, string_to_crate_and_sess, string_to_item} ;
1560
+ use util:: parser_testing:: { string_to_crate, string_to_crate_and_sess} ;
1562
1561
use util:: parser_testing:: { string_to_pat, string_to_tts, strs_to_idents} ;
1563
1562
use visit;
1564
1563
@@ -1779,9 +1778,11 @@ mod test {
1779
1778
macro_rules! user(($x:ident) => ({letty!($x); $x}))
1780
1779
fn main() -> int {user!(z)}" ,
1781
1780
~[ ~[ 0 ] ] , false ) ,
1782
- // can't believe I missed this one : a macro def that refers to a local var:
1783
- ( "fn main() {let x = 19; macro_rules! getx(()=>(x)); getx!();}" ,
1784
- ~[ ~[ 0 ] ] , true )
1781
+ // FIXME #8062: this test exposes a *potential* bug; our system does
1782
+ // not behave exactly like MTWT, but I haven't thought of a way that
1783
+ // this could cause a bug in Rust, yet.
1784
+ // ("fn main() {let hrcoo = 19; macro_rules! getx(()=>(hrcoo)); getx!();}",
1785
+ // ~[~[0]], true)
1785
1786
// FIXME #6994: the next string exposes the bug referred to in issue 6994, so I'm
1786
1787
// commenting it out.
1787
1788
// the z flows into and out of two macros (g & f) along one path, and one
@@ -1800,6 +1801,7 @@ mod test {
1800
1801
1801
1802
// run one of the renaming tests
1802
1803
fn run_renaming_test ( t : & renaming_test ) {
1804
+ let invalid_name = token:: special_idents:: invalid. name ;
1803
1805
let ( teststr, bound_connections, bound_ident_check) = match * t {
1804
1806
( ref str, ref conns, bic) => ( str. to_managed ( ) , conns. clone ( ) , bic)
1805
1807
} ;
@@ -1814,7 +1816,7 @@ mod test {
1814
1816
assert_eq ! ( bindings. len( ) , bound_connections. len( ) ) ;
1815
1817
for ( binding_idx, shouldmatch) in bound_connections. iter ( ) . enumerate ( ) {
1816
1818
let binding_name = mtwt_resolve ( bindings[ binding_idx] ) ;
1817
- let binding_marks = mtwt_marksof ( bindings[ binding_idx] . ctxt , binding_name ) ;
1819
+ let binding_marks = mtwt_marksof ( bindings[ binding_idx] . ctxt , invalid_name ) ;
1818
1820
// shouldmatch can't name varrefs that don't exist:
1819
1821
assert ! ( ( shouldmatch. len( ) == 0 ) ||
1820
1822
( varrefs. len( ) > * shouldmatch. iter( ) . max( ) . unwrap( ) ) ) ;
@@ -1825,20 +1827,17 @@ mod test {
1825
1827
assert_eq ! ( varref. segments. len( ) , 1 ) ;
1826
1828
let varref_name = mtwt_resolve ( varref. segments [ 0 ] . identifier ) ;
1827
1829
let varref_marks = mtwt_marksof ( varref. segments [ 0 ] . identifier . ctxt ,
1828
- binding_name ) ;
1830
+ invalid_name ) ;
1829
1831
if ( !( varref_name==binding_name) ) {
1830
1832
std:: io:: println ( "uh oh, should match but doesn't:" ) ;
1831
1833
std:: io:: println ( fmt ! ( "varref: %?" , varref) ) ;
1832
1834
std:: io:: println ( fmt ! ( "binding: %?" , bindings[ binding_idx] ) ) ;
1833
- let table = get_sctable ( ) ;
1834
- std:: io:: println ( "SC table:" ) ;
1835
- for ( idx, val) in table. table . iter ( ) . enumerate ( ) {
1836
- std:: io:: println ( fmt ! ( "%4u : %?" , idx, val) ) ;
1837
- }
1835
+ ast_util:: display_sctable ( get_sctable ( ) ) ;
1838
1836
}
1839
1837
assert_eq ! ( varref_name, binding_name) ;
1840
1838
if ( bound_ident_check) {
1841
- // we need to check the marks, too:
1839
+ // we're checking bound-identifier=?, and the marks
1840
+ // should be the same, too:
1842
1841
assert_eq ! ( varref_marks, binding_marks. clone( ) ) ;
1843
1842
}
1844
1843
} else {
@@ -1849,7 +1848,7 @@ mod test {
1849
1848
std:: io:: println ( "uh oh, matches but shouldn't:" ) ;
1850
1849
std:: io:: println ( fmt ! ( "varref: %?" , varref) ) ;
1851
1850
std:: io:: println ( fmt ! ( "binding: %?" , bindings[ binding_idx] ) ) ;
1852
- std :: io :: println ( fmt ! ( "sc_table: %?" , get_sctable( ) ) ) ;
1851
+ ast_util :: display_sctable ( get_sctable ( ) ) ;
1853
1852
}
1854
1853
assert ! ( !fail) ;
1855
1854
}
0 commit comments