librustc: Remove unique vector patterns from the language.

Preparatory work for removing unique vectors from the language, which is
itself preparatory work for dynamically sized types.
This commit is contained in:
Patrick Walton 2014-02-13 09:46:46 -08:00
parent ea0058281c
commit 33923f47e3
25 changed files with 229 additions and 198 deletions

View file

@ -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);