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/proc_macro_srv/src/proc_macro/bridge | |
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/proc_macro_srv/src/proc_macro/bridge')
-rw-r--r-- | crates/proc_macro_srv/src/proc_macro/bridge/client.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/proc_macro_srv/src/proc_macro/bridge/client.rs b/crates/proc_macro_srv/src/proc_macro/bridge/client.rs index ca6749b9b..b036d4e20 100644 --- a/crates/proc_macro_srv/src/proc_macro/bridge/client.rs +++ b/crates/proc_macro_srv/src/proc_macro/bridge/client.rs | |||
@@ -238,7 +238,7 @@ macro_rules! define_client_side { | |||
238 | $(impl $name { | 238 | $(impl $name { |
239 | #[allow(unused)] | 239 | #[allow(unused)] |
240 | $(pub(crate) fn $method($($arg: $arg_ty),*) $(-> $ret_ty)* { | 240 | $(pub(crate) fn $method($($arg: $arg_ty),*) $(-> $ret_ty)* { |
241 | panic!("hello"); | 241 | panic!("crates should be linked against the sysroot version of proc_macro, not this one from rust-analyzer"); |
242 | // Bridge::with(|bridge| { | 242 | // Bridge::with(|bridge| { |
243 | // let mut b = bridge.cached_buffer.take(); | 243 | // let mut b = bridge.cached_buffer.take(); |
244 | 244 | ||