diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-07 00:32:56 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-07 00:32:56 +0000 |
commit | f0b7c02f16f717744e7edc79a405db14110393cf (patch) | |
tree | c0aaf8373aa42ce3b4037fad2f42efba07680f53 /crates/hir_ty/src/tests/traits.rs | |
parent | 07a54f7ae451451292e3282f1e7defb4391b766f (diff) | |
parent | aea974939064b0f7b83de371a93ee4190c80e544 (diff) |
Merge #7892
7892: Fix TokenStream::from_str for input consisting of a single group with delimiter r=edwin0cheng a=kevinmehall
TokenStream holds a `tt::Subtree` but assumes its `delimiter` is always `None`. In particular, the iterator implementation iterates over the inner `token_trees` and ignores the `delimiter`.
However, `TokenStream::from_str` violated this assumption when the input consists of a single group by producing a Subtree with an outer delimiter, which was ignored as seen by a procedural macro.
`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>`.
Fixes #7810
Fixes #7875
Co-authored-by: Kevin Mehall <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/tests/traits.rs')
0 files changed, 0 insertions, 0 deletions