diff options
| author | bors <bors@rust-lang.org> | 2014-02-19 21:56:51 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-02-19 21:56:51 -0800 |
| commit | 0cc8ba0c2030720750c6166ad898ca192c695ffc (patch) | |
| tree | d421ed57c72eb552ba07f0b423fda54ada33efa8 /src/libsyntax/parse/mod.rs | |
| parent | 801f8f67f81c06891964dec0d0930029fb203b89 (diff) | |
| parent | 33923f47e3f90442ae3c604d8ea80992b71611f7 (diff) | |
| download | rust-0cc8ba0c2030720750c6166ad898ca192c695ffc.tar.gz rust-0cc8ba0c2030720750c6166ad898ca192c695ffc.zip | |
auto merge of #12244 : pcwalton/rust/deuniquevectorpatterns, r=pcwalton
Preparatory work for removing unique vectors from the language, which is itself preparatory work for dynamically sized types. r? @brson
Diffstat (limited to 'src/libsyntax/parse/mod.rs')
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 58 |
1 files changed, 33 insertions, 25 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 6ddb4bbc11f..b4139714a2e 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -363,40 +363,48 @@ mod test { // check the token-tree-ization of macros #[test] fn string_to_tts_macro () { let tts = string_to_tts(~"macro_rules! zip (($a)=>($a))"); + let tts: &[ast::TokenTree] = tts; match tts { [ast::TTTok(_,_), ast::TTTok(_,token::NOT), ast::TTTok(_,_), - ast::TTDelim(delim_elts)] => - match *delim_elts { - [ast::TTTok(_,token::LPAREN), - ast::TTDelim(first_set), - ast::TTTok(_,token::FAT_ARROW), - ast::TTDelim(second_set), - ast::TTTok(_,token::RPAREN)] => - match *first_set { + ast::TTDelim(delim_elts)] => { + let delim_elts: &[ast::TokenTree] = *delim_elts; + match delim_elts { [ast::TTTok(_,token::LPAREN), - ast::TTTok(_,token::DOLLAR), - ast::TTTok(_,_), - ast::TTTok(_,token::RPAREN)] => - match *second_set { - [ast::TTTok(_,token::LPAREN), - ast::TTTok(_,token::DOLLAR), - ast::TTTok(_,_), - ast::TTTok(_,token::RPAREN)] => - assert_eq!("correct","correct"), - _ => assert_eq!("wrong 4","correct") + ast::TTDelim(first_set), + ast::TTTok(_,token::FAT_ARROW), + ast::TTDelim(second_set), + ast::TTTok(_,token::RPAREN)] => { + let first_set: &[ast::TokenTree] = *first_set; + match first_set { + [ast::TTTok(_,token::LPAREN), + ast::TTTok(_,token::DOLLAR), + ast::TTTok(_,_), + ast::TTTok(_,token::RPAREN)] => { + let second_set: &[ast::TokenTree] = + *second_set; + match second_set { + [ast::TTTok(_,token::LPAREN), + ast::TTTok(_,token::DOLLAR), + ast::TTTok(_,_), + ast::TTTok(_,token::RPAREN)] => { + assert_eq!("correct","correct") + } + _ => assert_eq!("wrong 4","correct") + } + }, + _ => { + error!("failing value 3: {:?}",first_set); + assert_eq!("wrong 3","correct") + } + } }, _ => { - error!("failing value 3: {:?}",first_set); - assert_eq!("wrong 3","correct") + error!("failing value 2: {:?}",delim_elts); + assert_eq!("wrong","correct"); } - }, - _ => { - error!("failing value 2: {:?}",delim_elts); - assert_eq!("wrong","correct"); } - }, _ => { error!("failing value: {:?}",tts); |
