aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_proc_macro_srv
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-08-12 15:49:48 +0100
committerGitHub <[email protected]>2020-08-12 15:49:48 +0100
commit6dba0e1c4de3b225556f7fce70518c8ebff170a6 (patch)
tree1bf923c652e0bdb325240e27bb07e3c552a1aa07 /crates/ra_proc_macro_srv
parent147547e7b85e80e2e30aa1a5ba4d9d0969908398 (diff)
parent550d7fbe3cbf2af4a47fca6c9bbefaf798cd7b7b (diff)
Merge #5725
5725: Rename ra_tt -> tt r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_proc_macro_srv')
-rw-r--r--crates/ra_proc_macro_srv/Cargo.toml2
-rw-r--r--crates/ra_proc_macro_srv/src/dylib.rs6
-rw-r--r--crates/ra_proc_macro_srv/src/lib.rs2
-rw-r--r--crates/ra_proc_macro_srv/src/rustc_server.rs8
4 files changed, 9 insertions, 9 deletions
diff --git a/crates/ra_proc_macro_srv/Cargo.toml b/crates/ra_proc_macro_srv/Cargo.toml
index bc119a6c7..a690cc044 100644
--- a/crates/ra_proc_macro_srv/Cargo.toml
+++ b/crates/ra_proc_macro_srv/Cargo.toml
@@ -10,7 +10,7 @@ license = "MIT OR Apache-2.0"
10doctest = false 10doctest = false
11 11
12[dependencies] 12[dependencies]
13ra_tt = { path = "../ra_tt" } 13tt = { path = "../tt" }
14ra_mbe = { path = "../ra_mbe" } 14ra_mbe = { path = "../ra_mbe" }
15ra_proc_macro = { path = "../ra_proc_macro" } 15ra_proc_macro = { path = "../ra_proc_macro" }
16goblin = "0.2.1" 16goblin = "0.2.1"
diff --git a/crates/ra_proc_macro_srv/src/dylib.rs b/crates/ra_proc_macro_srv/src/dylib.rs
index 1addbbd54..9b6cc91ef 100644
--- a/crates/ra_proc_macro_srv/src/dylib.rs
+++ b/crates/ra_proc_macro_srv/src/dylib.rs
@@ -128,9 +128,9 @@ impl Expander {
128 pub fn expand( 128 pub fn expand(
129 &self, 129 &self,
130 macro_name: &str, 130 macro_name: &str,
131 macro_body: &ra_tt::Subtree, 131 macro_body: &tt::Subtree,
132 attributes: Option<&ra_tt::Subtree>, 132 attributes: Option<&tt::Subtree>,
133 ) -> Result<ra_tt::Subtree, bridge::PanicMessage> { 133 ) -> Result<tt::Subtree, bridge::PanicMessage> {
134 let parsed_body = TokenStream::with_subtree(macro_body.clone()); 134 let parsed_body = TokenStream::with_subtree(macro_body.clone());
135 135
136 let parsed_attributes = attributes 136 let parsed_attributes = attributes
diff --git a/crates/ra_proc_macro_srv/src/lib.rs b/crates/ra_proc_macro_srv/src/lib.rs
index 922bb84bb..1fc2eef82 100644
--- a/crates/ra_proc_macro_srv/src/lib.rs
+++ b/crates/ra_proc_macro_srv/src/lib.rs
@@ -5,7 +5,7 @@
5//! 5//!
6//! But we adapt it to better fit RA needs: 6//! But we adapt it to better fit RA needs:
7//! 7//!
8//! * We use `ra_tt` for proc-macro `TokenStream` server, it is easier to manipulate and interact with 8//! * We use `tt` for proc-macro `TokenStream` server, it is easier to manipulate and interact with
9//! RA than `proc-macro2` token stream. 9//! RA than `proc-macro2` token stream.
10//! * By **copying** the whole rustc `lib_proc_macro` code, we are able to build this with `stable` 10//! * By **copying** the whole rustc `lib_proc_macro` code, we are able to build this with `stable`
11//! rustc rather than `unstable`. (Although in gerenal ABI compatibility is still an issue) 11//! rustc rather than `unstable`. (Although in gerenal ABI compatibility is still an issue)
diff --git a/crates/ra_proc_macro_srv/src/rustc_server.rs b/crates/ra_proc_macro_srv/src/rustc_server.rs
index cc32d5a6d..d534d1337 100644
--- a/crates/ra_proc_macro_srv/src/rustc_server.rs
+++ b/crates/ra_proc_macro_srv/src/rustc_server.rs
@@ -1,15 +1,14 @@
1//! Rustc proc-macro server implementation with ra_tt 1//! Rustc proc-macro server implementation with tt
2//! 2//!
3//! Based on idea from https://github.com/fedochet/rust-proc-macro-expander 3//! Based on idea from https://github.com/fedochet/rust-proc-macro-expander
4//! The lib-proc-macro server backend is `TokenStream`-agnostic, such that 4//! The lib-proc-macro server backend is `TokenStream`-agnostic, such that
5//! we could provide any TokenStream implementation. 5//! we could provide any TokenStream implementation.
6//! The original idea from fedochet is using proc-macro2 as backend, 6//! The original idea from fedochet is using proc-macro2 as backend,
7//! we use ra_tt instead for better intergation with RA. 7//! we use tt instead for better intergation with RA.
8//! 8//!
9//! FIXME: No span and source file information is implemented yet 9//! FIXME: No span and source file information is implemented yet
10 10
11use crate::proc_macro::bridge::{self, server}; 11use crate::proc_macro::bridge::{self, server};
12use ra_tt as tt;
13 12
14use std::collections::{Bound, HashMap}; 13use std::collections::{Bound, HashMap};
15use std::hash::Hash; 14use std::hash::Hash;
@@ -153,9 +152,10 @@ pub struct TokenStreamBuilder {
153 152
154/// Public implementation details for the `TokenStream` type, such as iterators. 153/// Public implementation details for the `TokenStream` type, such as iterators.
155pub mod token_stream { 154pub mod token_stream {
156 use super::{tt, TokenStream, TokenTree};
157 use std::str::FromStr; 155 use std::str::FromStr;
158 156
157 use super::{TokenStream, TokenTree};
158
159 /// An iterator over `TokenStream`'s `TokenTree`s. 159 /// An iterator over `TokenStream`'s `TokenTree`s.
160 /// The iteration is "shallow", e.g., the iterator doesn't recurse into delimited groups, 160 /// The iteration is "shallow", e.g., the iterator doesn't recurse into delimited groups,
161 /// and returns whole groups as token trees. 161 /// and returns whole groups as token trees.