Refactor TokenStream to hold Vec<TokenTree> instead of tt::Subtree

`TokenStream` assumes that its subtree's delimeter is `None`, and this
should be encoded in the type system instead of having a delimiter field
that is mostly ignored.

`tt::Subtree` is just `pub delimiter: Option<Delimiter>, pub
token_trees: Vec<TokenTree>`, so a Subtree that is statically guaranteed
not to have a delimiter is just Vec<TokenTree>.
This commit is contained in:
Kevin Mehall 2021-03-06 09:46:32 -07:00
parent 632fa8ef4a
commit 62f594b390
3 changed files with 56 additions and 65 deletions

View file

@ -52,7 +52,7 @@ pub fn assert_expand(
let expander = dylib::Expander::new(&path).unwrap();
let fixture = parse_string(ra_fixture).unwrap();
let res = expander.expand(macro_name, &fixture.subtree, None).unwrap();
let res = expander.expand(macro_name, &fixture.into_subtree(), None).unwrap();
assert_eq_text!(&expect.trim(), &format!("{:?}", res));
}