From 550d7fbe3cbf2af4a47fca6c9bbefaf798cd7b7b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 12 Aug 2020 16:46:20 +0200 Subject: Rename ra_tt -> tt --- Cargo.lock | 32 ++-- crates/ra_cfg/Cargo.toml | 2 +- crates/ra_db/Cargo.toml | 2 +- crates/ra_db/src/input.rs | 4 +- crates/ra_hir_def/Cargo.toml | 2 +- crates/ra_hir_expand/Cargo.toml | 2 +- crates/ra_mbe/Cargo.toml | 2 +- crates/ra_mbe/src/lib.rs | 2 +- crates/ra_proc_macro/Cargo.toml | 2 +- crates/ra_proc_macro/src/lib.rs | 17 +- crates/ra_proc_macro/src/msg.rs | 3 +- crates/ra_proc_macro/src/process.rs | 38 ++--- crates/ra_proc_macro/src/rpc.rs | 13 +- crates/ra_proc_macro_srv/Cargo.toml | 2 +- crates/ra_proc_macro_srv/src/dylib.rs | 6 +- crates/ra_proc_macro_srv/src/lib.rs | 2 +- crates/ra_proc_macro_srv/src/rustc_server.rs | 8 +- crates/ra_tt/Cargo.toml | 15 -- crates/ra_tt/src/buffer.rs | 185 -------------------- crates/ra_tt/src/lib.rs | 246 --------------------------- crates/rust-analyzer/Cargo.toml | 2 +- crates/tt/Cargo.toml | 16 ++ crates/tt/src/buffer.rs | 185 ++++++++++++++++++++ crates/tt/src/lib.rs | 246 +++++++++++++++++++++++++++ xtask/tests/tidy.rs | 2 +- 25 files changed, 518 insertions(+), 518 deletions(-) delete mode 100644 crates/ra_tt/Cargo.toml delete mode 100644 crates/ra_tt/src/buffer.rs delete mode 100644 crates/ra_tt/src/lib.rs create mode 100644 crates/tt/Cargo.toml create mode 100644 crates/tt/src/buffer.rs create mode 100644 crates/tt/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index c2a0457c7..598b739c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -939,8 +939,8 @@ version = "0.1.0" dependencies = [ "ra_mbe", "ra_syntax", - "ra_tt", "rustc-hash", + "tt", ] [[package]] @@ -950,11 +950,11 @@ dependencies = [ "profile", "ra_cfg", "ra_syntax", - "ra_tt", "rustc-hash", "salsa", "stdx", "test_utils", + "tt", "vfs", ] @@ -1004,11 +1004,11 @@ dependencies = [ "ra_hir_expand", "ra_mbe", "ra_syntax", - "ra_tt", "rustc-hash", "smallvec", "stdx", "test_utils", + "tt", ] [[package]] @@ -1023,9 +1023,9 @@ dependencies = [ "ra_mbe", "ra_parser", "ra_syntax", - "ra_tt", "rustc-hash", "test_utils", + "tt", ] [[package]] @@ -1107,10 +1107,10 @@ dependencies = [ "log", "ra_parser", "ra_syntax", - "ra_tt", "rustc-hash", "smallvec", "test_utils", + "tt", ] [[package]] @@ -1127,9 +1127,9 @@ dependencies = [ "crossbeam-channel", "jod-thread", "log", - "ra_tt", "serde", "serde_json", + "tt", ] [[package]] @@ -1144,9 +1144,9 @@ dependencies = [ "ra_mbe", "ra_proc_macro", "ra_toolchain", - "ra_tt", "serde_derive", "test_utils", + "tt", ] [[package]] @@ -1217,14 +1217,6 @@ dependencies = [ "home", ] -[[package]] -name = "ra_tt" -version = "0.1.0" -dependencies = [ - "smol_str", - "stdx", -] - [[package]] name = "rayon" version = "1.3.1" @@ -1329,7 +1321,6 @@ dependencies = [ "ra_syntax", "ra_text_edit", "ra_toolchain", - "ra_tt", "rayon", "rustc-hash", "serde", @@ -1337,6 +1328,7 @@ dependencies = [ "stdx", "test_utils", "threadpool", + "tt", "vfs", "vfs-notify", "winapi 0.3.9", @@ -1706,6 +1698,14 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "tt" +version = "0.0.0" +dependencies = [ + "smol_str", + "stdx", +] + [[package]] name = "ungrammar" version = "1.1.1" diff --git a/crates/ra_cfg/Cargo.toml b/crates/ra_cfg/Cargo.toml index 6425cd6d6..770a40742 100644 --- a/crates/ra_cfg/Cargo.toml +++ b/crates/ra_cfg/Cargo.toml @@ -12,7 +12,7 @@ doctest = false rustc-hash = "1.1.0" ra_syntax = { path = "../ra_syntax" } -tt = { path = "../ra_tt", package = "ra_tt" } +tt = { path = "../tt" } [dev-dependencies] mbe = { path = "../ra_mbe", package = "ra_mbe" } diff --git a/crates/ra_db/Cargo.toml b/crates/ra_db/Cargo.toml index 9cb9ba11c..47a0f6248 100644 --- a/crates/ra_db/Cargo.toml +++ b/crates/ra_db/Cargo.toml @@ -15,7 +15,7 @@ rustc-hash = "1.1.0" ra_syntax = { path = "../ra_syntax" } ra_cfg = { path = "../ra_cfg" } profile = { path = "../profile" } -ra_tt = { path = "../ra_tt" } +tt = { path = "../tt" } test_utils = { path = "../test_utils" } vfs = { path = "../vfs" } stdx = { path = "../stdx" } diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs index 6f2e5cfc7..02a1abee0 100644 --- a/crates/ra_db/src/input.rs +++ b/crates/ra_db/src/input.rs @@ -10,8 +10,8 @@ use std::{fmt, iter::FromIterator, ops, str::FromStr, sync::Arc}; use ra_cfg::CfgOptions; use ra_syntax::SmolStr; -use ra_tt::TokenExpander; use rustc_hash::{FxHashMap, FxHashSet}; +use tt::TokenExpander; use vfs::file_set::FileSet; pub use vfs::FileId; @@ -156,7 +156,7 @@ impl CrateGraph { display_name: Option, cfg_options: CfgOptions, env: Env, - proc_macro: Vec<(SmolStr, Arc)>, + proc_macro: Vec<(SmolStr, Arc)>, ) -> CrateId { let proc_macro = proc_macro.into_iter().map(|(name, it)| ProcMacro { name, expander: it }).collect(); diff --git a/crates/ra_hir_def/Cargo.toml b/crates/ra_hir_def/Cargo.toml index adfd8c7b7..1a080a8b4 100644 --- a/crates/ra_hir_def/Cargo.toml +++ b/crates/ra_hir_def/Cargo.toml @@ -30,7 +30,7 @@ hir_expand = { path = "../ra_hir_expand", package = "ra_hir_expand" } test_utils = { path = "../test_utils" } mbe = { path = "../ra_mbe", package = "ra_mbe" } ra_cfg = { path = "../ra_cfg" } -tt = { path = "../ra_tt", package = "ra_tt" } +tt = { path = "../tt" } [dev-dependencies] expect = { path = "../expect" } diff --git a/crates/ra_hir_expand/Cargo.toml b/crates/ra_hir_expand/Cargo.toml index 711a93c56..7d8ccd56f 100644 --- a/crates/ra_hir_expand/Cargo.toml +++ b/crates/ra_hir_expand/Cargo.toml @@ -18,6 +18,6 @@ ra_db = { path = "../ra_db" } ra_syntax = { path = "../ra_syntax" } ra_parser = { path = "../ra_parser" } profile = { path = "../profile" } -tt = { path = "../ra_tt", package = "ra_tt" } +tt = { path = "../tt" } mbe = { path = "../ra_mbe", package = "ra_mbe" } test_utils = { path = "../test_utils"} diff --git a/crates/ra_mbe/Cargo.toml b/crates/ra_mbe/Cargo.toml index a26746a19..23315910c 100644 --- a/crates/ra_mbe/Cargo.toml +++ b/crates/ra_mbe/Cargo.toml @@ -11,7 +11,7 @@ doctest = false [dependencies] ra_syntax = { path = "../ra_syntax" } ra_parser = { path = "../ra_parser" } -tt = { path = "../ra_tt", package = "ra_tt" } +tt = { path = "../tt" } rustc-hash = "1.1.0" smallvec = "1.2.0" log = "0.4.8" diff --git a/crates/ra_mbe/src/lib.rs b/crates/ra_mbe/src/lib.rs index dec7ba22e..f854ca09a 100644 --- a/crates/ra_mbe/src/lib.rs +++ b/crates/ra_mbe/src/lib.rs @@ -1,5 +1,5 @@ //! `mbe` (short for Macro By Example) crate contains code for handling -//! `macro_rules` macros. It uses `TokenTree` (from `ra_tt` package) as the +//! `macro_rules` macros. It uses `TokenTree` (from `tt` package) as the //! interface, although it contains some code to bridge `SyntaxNode`s and //! `TokenTree`s as well! diff --git a/crates/ra_proc_macro/Cargo.toml b/crates/ra_proc_macro/Cargo.toml index c4b6e9e7b..d2d1bc228 100644 --- a/crates/ra_proc_macro/Cargo.toml +++ b/crates/ra_proc_macro/Cargo.toml @@ -10,7 +10,7 @@ license = "MIT OR Apache-2.0" doctest = false [dependencies] -ra_tt = { path = "../ra_tt" } +tt = { path = "../tt" } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" log = "0.4.8" diff --git a/crates/ra_proc_macro/src/lib.rs b/crates/ra_proc_macro/src/lib.rs index 004943b9e..15db57eb2 100644 --- a/crates/ra_proc_macro/src/lib.rs +++ b/crates/ra_proc_macro/src/lib.rs @@ -9,8 +9,6 @@ mod rpc; mod process; pub mod msg; -use process::{ProcMacroProcessSrv, ProcMacroProcessThread}; -use ra_tt::{SmolStr, Subtree}; use std::{ ffi::OsStr, io, @@ -18,6 +16,10 @@ use std::{ sync::Arc, }; +use tt::{SmolStr, Subtree}; + +use crate::process::{ProcMacroProcessSrv, ProcMacroProcessThread}; + pub use rpc::{ExpansionResult, ExpansionTask, ListMacrosResult, ListMacrosTask, ProcMacroKind}; #[derive(Debug, Clone)] @@ -36,12 +38,12 @@ impl PartialEq for ProcMacroProcessExpander { } } -impl ra_tt::TokenExpander for ProcMacroProcessExpander { +impl tt::TokenExpander for ProcMacroProcessExpander { fn expand( &self, subtree: &Subtree, _attr: Option<&Subtree>, - ) -> Result { + ) -> Result { self.process.custom_derive(&self.dylib_path, subtree, &self.name) } } @@ -72,10 +74,7 @@ impl ProcMacroClient { ProcMacroClient { kind: ProcMacroClientKind::Dummy } } - pub fn by_dylib_path( - &self, - dylib_path: &Path, - ) -> Vec<(SmolStr, Arc)> { + pub fn by_dylib_path(&self, dylib_path: &Path) -> Vec<(SmolStr, Arc)> { match &self.kind { ProcMacroClientKind::Dummy => vec![], ProcMacroClientKind::Process { process, .. } => { @@ -94,7 +93,7 @@ impl ProcMacroClient { match kind { ProcMacroKind::CustomDerive => { let name = SmolStr::new(&name); - let expander: Arc = + let expander: Arc = Arc::new(ProcMacroProcessExpander { process: process.clone(), name: name.clone(), diff --git a/crates/ra_proc_macro/src/msg.rs b/crates/ra_proc_macro/src/msg.rs index 95d9b8804..f84ebdbc5 100644 --- a/crates/ra_proc_macro/src/msg.rs +++ b/crates/ra_proc_macro/src/msg.rs @@ -5,11 +5,12 @@ use std::{ io::{self, BufRead, Write}, }; +use serde::{de::DeserializeOwned, Deserialize, Serialize}; + use crate::{ rpc::{ListMacrosResult, ListMacrosTask}, ExpansionResult, ExpansionTask, }; -use serde::{de::DeserializeOwned, Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize, Clone)] pub enum Request { diff --git a/crates/ra_proc_macro/src/process.rs b/crates/ra_proc_macro/src/process.rs index 37dd3f496..51ffcaa78 100644 --- a/crates/ra_proc_macro/src/process.rs +++ b/crates/ra_proc_macro/src/process.rs @@ -1,21 +1,22 @@ //! Handle process life-time and message passing for proc-macro client -use crossbeam_channel::{bounded, Receiver, Sender}; -use ra_tt::Subtree; - -use crate::msg::{ErrorCode, Message, Request, Response, ResponseError}; -use crate::rpc::{ExpansionResult, ExpansionTask, ListMacrosResult, ListMacrosTask, ProcMacroKind}; - -use io::{BufRead, BufReader}; use std::{ convert::{TryFrom, TryInto}, ffi::{OsStr, OsString}, - io::{self, Write}, + io::{self, BufRead, BufReader, Write}, path::{Path, PathBuf}, process::{Child, Command, Stdio}, sync::{Arc, Weak}, }; +use crossbeam_channel::{bounded, Receiver, Sender}; +use tt::Subtree; + +use crate::{ + msg::{ErrorCode, Message, Request, Response, ResponseError}, + rpc::{ExpansionResult, ExpansionTask, ListMacrosResult, ListMacrosTask, ProcMacroKind}, +}; + #[derive(Debug, Default)] pub(crate) struct ProcMacroProcessSrv { inner: Option>>, @@ -50,7 +51,7 @@ impl ProcMacroProcessSrv { pub fn find_proc_macros( &self, dylib_path: &Path, - ) -> Result, ra_tt::ExpansionError> { + ) -> Result, tt::ExpansionError> { let task = ListMacrosTask { lib: dylib_path.to_path_buf() }; let result: ListMacrosResult = self.send_task(Request::ListMacro(task))?; @@ -62,7 +63,7 @@ impl ProcMacroProcessSrv { dylib_path: &Path, subtree: &Subtree, derive_name: &str, - ) -> Result { + ) -> Result { let task = ExpansionTask { macro_body: subtree.clone(), macro_name: derive_name.to_string(), @@ -74,38 +75,35 @@ impl ProcMacroProcessSrv { Ok(result.expansion) } - pub fn send_task(&self, req: Request) -> Result + pub fn send_task(&self, req: Request) -> Result where R: TryFrom, { let sender = match &self.inner { - None => return Err(ra_tt::ExpansionError::Unknown("No sender is found.".to_string())), + None => return Err(tt::ExpansionError::Unknown("No sender is found.".to_string())), Some(it) => it, }; let (result_tx, result_rx) = bounded(0); let sender = match sender.upgrade() { None => { - return Err(ra_tt::ExpansionError::Unknown("Proc macro process is closed.".into())) + return Err(tt::ExpansionError::Unknown("Proc macro process is closed.".into())) } Some(it) => it, }; sender.send(Task { req, result_tx }).unwrap(); let res = result_rx .recv() - .map_err(|_| ra_tt::ExpansionError::Unknown("Proc macro thread is closed.".into()))?; + .map_err(|_| tt::ExpansionError::Unknown("Proc macro thread is closed.".into()))?; match res { Some(Response::Error(err)) => { - return Err(ra_tt::ExpansionError::ExpansionError(err.message)); + return Err(tt::ExpansionError::ExpansionError(err.message)); } Some(res) => Ok(res.try_into().map_err(|err| { - ra_tt::ExpansionError::Unknown(format!( - "Fail to get response, reason : {:#?} ", - err - )) + tt::ExpansionError::Unknown(format!("Fail to get response, reason : {:#?} ", err)) })?), - None => Err(ra_tt::ExpansionError::Unknown("Empty result".into())), + None => Err(tt::ExpansionError::Unknown("Empty result".into())), } } } diff --git a/crates/ra_proc_macro/src/rpc.rs b/crates/ra_proc_macro/src/rpc.rs index 4ce485926..5e5d78d06 100644 --- a/crates/ra_proc_macro/src/rpc.rs +++ b/crates/ra_proc_macro/src/rpc.rs @@ -1,17 +1,18 @@ //! Data struture serialization related stuff for RPC //! //! Defines all necessary rpc serialization data structures, -//! which includes `ra_tt` related data and some task messages. -//! Although adding `Serialize` and `Deserialize` traits to `ra_tt` directly seems -//! to be much easier, we deliberately duplicate `ra_tt` structs with `#[serde(with = "XXDef")]` +//! which includes `tt` related data and some task messages. +//! Although adding `Serialize` and `Deserialize` traits to `tt` directly seems +//! to be much easier, we deliberately duplicate `tt` structs with `#[serde(with = "XXDef")]` //! for separation of code responsibility. -use ra_tt::{ +use std::path::PathBuf; + +use serde::{Deserialize, Serialize}; +use tt::{ Delimiter, DelimiterKind, Ident, Leaf, Literal, Punct, SmolStr, Spacing, Subtree, TokenId, TokenTree, }; -use serde::{Deserialize, Serialize}; -use std::path::PathBuf; #[derive(Clone, Eq, PartialEq, Debug, Serialize, Deserialize)] pub struct ListMacrosTask { 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" doctest = false [dependencies] -ra_tt = { path = "../ra_tt" } +tt = { path = "../tt" } ra_mbe = { path = "../ra_mbe" } ra_proc_macro = { path = "../ra_proc_macro" } goblin = "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 { pub fn expand( &self, macro_name: &str, - macro_body: &ra_tt::Subtree, - attributes: Option<&ra_tt::Subtree>, - ) -> Result { + macro_body: &tt::Subtree, + attributes: Option<&tt::Subtree>, + ) -> Result { let parsed_body = TokenStream::with_subtree(macro_body.clone()); 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 @@ //! //! But we adapt it to better fit RA needs: //! -//! * We use `ra_tt` for proc-macro `TokenStream` server, it is easier to manipulate and interact with +//! * We use `tt` for proc-macro `TokenStream` server, it is easier to manipulate and interact with //! RA than `proc-macro2` token stream. //! * By **copying** the whole rustc `lib_proc_macro` code, we are able to build this with `stable` //! 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 @@ -//! Rustc proc-macro server implementation with ra_tt +//! Rustc proc-macro server implementation with tt //! //! Based on idea from https://github.com/fedochet/rust-proc-macro-expander //! The lib-proc-macro server backend is `TokenStream`-agnostic, such that //! we could provide any TokenStream implementation. //! The original idea from fedochet is using proc-macro2 as backend, -//! we use ra_tt instead for better intergation with RA. +//! we use tt instead for better intergation with RA. //! //! FIXME: No span and source file information is implemented yet use crate::proc_macro::bridge::{self, server}; -use ra_tt as tt; use std::collections::{Bound, HashMap}; use std::hash::Hash; @@ -153,9 +152,10 @@ pub struct TokenStreamBuilder { /// Public implementation details for the `TokenStream` type, such as iterators. pub mod token_stream { - use super::{tt, TokenStream, TokenTree}; use std::str::FromStr; + use super::{TokenStream, TokenTree}; + /// An iterator over `TokenStream`'s `TokenTree`s. /// The iteration is "shallow", e.g., the iterator doesn't recurse into delimited groups, /// and returns whole groups as token trees. diff --git a/crates/ra_tt/Cargo.toml b/crates/ra_tt/Cargo.toml deleted file mode 100644 index 3c45248c3..000000000 --- a/crates/ra_tt/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -edition = "2018" -name = "ra_tt" -version = "0.1.0" -authors = ["rust-analyzer developers"] -license = "MIT OR Apache-2.0" - -[lib] -doctest = false - -[dependencies] -stdx = { path = "../stdx" } -# ideally, `serde` should be enabled by `rust-analyzer`, but we enable it here -# to reduce number of compilations -smol_str = { version = "0.1.15", features = ["serde"] } diff --git a/crates/ra_tt/src/buffer.rs b/crates/ra_tt/src/buffer.rs deleted file mode 100644 index 02c771f70..000000000 --- a/crates/ra_tt/src/buffer.rs +++ /dev/null @@ -1,185 +0,0 @@ -//! FIXME: write short doc here - -use crate::{Subtree, TokenTree}; - -#[derive(Copy, Clone, Debug, Eq, PartialEq)] -struct EntryId(usize); - -#[derive(Copy, Clone, Debug, Eq, PartialEq)] -struct EntryPtr(EntryId, usize); - -/// Internal type which is used instead of `TokenTree` to represent a token tree -/// within a `TokenBuffer`. -#[derive(Debug)] -enum Entry<'t> { - // Mimicking types from proc-macro. - Subtree(&'t TokenTree, EntryId), - Leaf(&'t TokenTree), - // End entries contain a pointer to the entry from the containing - // token tree, or None if this is the outermost level. - End(Option), -} - -/// A token tree buffer -/// The safe version of `syn` [`TokenBuffer`](https://github.com/dtolnay/syn/blob/6533607f91686545cb034d2838beea338d9d0742/src/buffer.rs#L41) -#[derive(Debug)] -pub struct TokenBuffer<'t> { - buffers: Vec]>>, -} - -impl<'t> TokenBuffer<'t> { - pub fn new(tokens: &'t [TokenTree]) -> TokenBuffer<'t> { - let mut buffers = vec![]; - - let idx = TokenBuffer::new_inner(tokens, &mut buffers, None); - assert_eq!(idx, 0); - - TokenBuffer { buffers } - } - - fn new_inner( - tokens: &'t [TokenTree], - buffers: &mut Vec]>>, - next: Option, - ) -> usize { - // Must contain everything in tokens and then the Entry::End - let start_capacity = tokens.len() + 1; - let mut entries = Vec::with_capacity(start_capacity); - let mut children = vec![]; - - for (idx, tt) in tokens.iter().enumerate() { - match tt { - TokenTree::Leaf(_) => { - entries.push(Entry::Leaf(tt)); - } - TokenTree::Subtree(subtree) => { - entries.push(Entry::End(None)); - children.push((idx, (subtree, tt))); - } - } - } - - entries.push(Entry::End(next)); - let res = buffers.len(); - buffers.push(entries.into_boxed_slice()); - - for (child_idx, (subtree, tt)) in children { - let idx = TokenBuffer::new_inner( - &subtree.token_trees, - buffers, - Some(EntryPtr(EntryId(res), child_idx + 1)), - ); - buffers[res].as_mut()[child_idx] = Entry::Subtree(tt, EntryId(idx)); - } - - res - } - - /// Creates a cursor referencing the first token in the buffer and able to - /// traverse until the end of the buffer. - pub fn begin(&self) -> Cursor { - Cursor::create(self, EntryPtr(EntryId(0), 0)) - } - - fn entry(&self, ptr: &EntryPtr) -> Option<&Entry> { - let id = ptr.0; - self.buffers[id.0].get(ptr.1) - } -} - -/// A safe version of `Cursor` from `syn` crate https://github.com/dtolnay/syn/blob/6533607f91686545cb034d2838beea338d9d0742/src/buffer.rs#L125 -#[derive(Copy, Clone, Debug)] -pub struct Cursor<'a> { - buffer: &'a TokenBuffer<'a>, - ptr: EntryPtr, -} - -impl<'a> PartialEq for Cursor<'a> { - fn eq(&self, other: &Cursor) -> bool { - self.ptr == other.ptr && std::ptr::eq(self.buffer, other.buffer) - } -} - -impl<'a> Eq for Cursor<'a> {} - -impl<'a> Cursor<'a> { - /// Check whether it is eof - pub fn eof(self) -> bool { - matches!(self.buffer.entry(&self.ptr), None | Some(Entry::End(None))) - } - - /// If the cursor is pointing at the end of a subtree, returns - /// the parent subtree - pub fn end(self) -> Option<&'a Subtree> { - match self.entry() { - Some(Entry::End(Some(ptr))) => { - let idx = ptr.1; - if let Some(Entry::Subtree(TokenTree::Subtree(subtree), _)) = - self.buffer.entry(&EntryPtr(ptr.0, idx - 1)) - { - return Some(subtree); - } - - None - } - _ => None, - } - } - - fn entry(self) -> Option<&'a Entry<'a>> { - self.buffer.entry(&self.ptr) - } - - /// If the cursor is pointing at a `Subtree`, returns - /// a cursor into that subtree - pub fn subtree(self) -> Option> { - match self.entry() { - Some(Entry::Subtree(_, entry_id)) => { - Some(Cursor::create(self.buffer, EntryPtr(*entry_id, 0))) - } - _ => None, - } - } - - /// If the cursor is pointing at a `TokenTree`, returns it - pub fn token_tree(self) -> Option<&'a TokenTree> { - match self.entry() { - Some(Entry::Leaf(tt)) => Some(tt), - Some(Entry::Subtree(tt, _)) => Some(tt), - Some(Entry::End(_)) => None, - None => None, - } - } - - fn create(buffer: &'a TokenBuffer, ptr: EntryPtr) -> Cursor<'a> { - Cursor { buffer, ptr } - } - - /// Bump the cursor - pub fn bump(self) -> Cursor<'a> { - if let Some(Entry::End(exit)) = self.buffer.entry(&self.ptr) { - if let Some(exit) = exit { - Cursor::create(self.buffer, *exit) - } else { - self - } - } else { - Cursor::create(self.buffer, EntryPtr(self.ptr.0, self.ptr.1 + 1)) - } - } - - /// Bump the cursor, if it is a subtree, returns - /// a cursor into that subtree - pub fn bump_subtree(self) -> Cursor<'a> { - match self.entry() { - Some(Entry::Subtree(_, _)) => self.subtree().unwrap(), - _ => self.bump(), - } - } - - /// Check whether it is a top level - pub fn is_root(&self) -> bool { - let entry_id = self.ptr.0; - entry_id.0 == 0 - } -} diff --git a/crates/ra_tt/src/lib.rs b/crates/ra_tt/src/lib.rs deleted file mode 100644 index 20c3f5eab..000000000 --- a/crates/ra_tt/src/lib.rs +++ /dev/null @@ -1,246 +0,0 @@ -//! `tt` crate defines a `TokenTree` data structure: this is the interface (both -//! input and output) of macros. It closely mirrors `proc_macro` crate's -//! `TokenTree`. -use std::{ - fmt::{self, Debug}, - panic::RefUnwindSafe, -}; - -use stdx::impl_from; - -pub use smol_str::SmolStr; - -/// Represents identity of the token. -/// -/// For hygiene purposes, we need to track which expanded tokens originated from -/// which source tokens. We do it by assigning an distinct identity to each -/// source token and making sure that identities are preserved during macro -/// expansion. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub struct TokenId(pub u32); - -impl TokenId { - pub const fn unspecified() -> TokenId { - TokenId(!0) - } -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum TokenTree { - Leaf(Leaf), - Subtree(Subtree), -} -impl_from!(Leaf, Subtree for TokenTree); - -impl TokenTree { - pub fn empty() -> Self { - TokenTree::Subtree(Subtree::default()) - } -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum Leaf { - Literal(Literal), - Punct(Punct), - Ident(Ident), -} -impl_from!(Literal, Punct, Ident for Leaf); - -#[derive(Clone, PartialEq, Eq, Hash, Default)] -pub struct Subtree { - pub delimiter: Option, - pub token_trees: Vec, -} - -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] -pub struct Delimiter { - pub id: TokenId, - pub kind: DelimiterKind, -} - -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] -pub enum DelimiterKind { - Parenthesis, - Brace, - Bracket, -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Literal { - pub text: SmolStr, - pub id: TokenId, -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub struct Punct { - pub char: char, - pub spacing: Spacing, - pub id: TokenId, -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub enum Spacing { - Alone, - Joint, -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Ident { - pub text: SmolStr, - pub id: TokenId, -} - -fn print_debug_subtree(f: &mut fmt::Formatter<'_>, subtree: &Subtree, level: usize) -> fmt::Result { - let align = std::iter::repeat(" ").take(level).collect::(); - - let aux = match subtree.delimiter.map(|it| (it.kind, it.id.0)) { - None => "$".to_string(), - Some((DelimiterKind::Parenthesis, id)) => format!("() {}", id), - Some((DelimiterKind::Brace, id)) => format!("{{}} {}", id), - Some((DelimiterKind::Bracket, id)) => format!("[] {}", id), - }; - - if subtree.token_trees.is_empty() { - write!(f, "{}SUBTREE {}", align, aux)?; - } else { - writeln!(f, "{}SUBTREE {}", align, aux)?; - for (idx, child) in subtree.token_trees.iter().enumerate() { - print_debug_token(f, child, level + 1)?; - if idx != subtree.token_trees.len() - 1 { - writeln!(f)?; - } - } - } - - Ok(()) -} - -fn print_debug_token(f: &mut fmt::Formatter<'_>, tkn: &TokenTree, level: usize) -> fmt::Result { - let align = std::iter::repeat(" ").take(level).collect::(); - - match tkn { - TokenTree::Leaf(leaf) => match leaf { - Leaf::Literal(lit) => write!(f, "{}LITERAL {} {}", align, lit.text, lit.id.0)?, - Leaf::Punct(punct) => write!( - f, - "{}PUNCH {} [{}] {}", - align, - punct.char, - if punct.spacing == Spacing::Alone { "alone" } else { "joint" }, - punct.id.0 - )?, - Leaf::Ident(ident) => write!(f, "{}IDENT {} {}", align, ident.text, ident.id.0)?, - }, - TokenTree::Subtree(subtree) => { - print_debug_subtree(f, subtree, level)?; - } - } - - Ok(()) -} - -impl Debug for Subtree { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - print_debug_subtree(f, self, 0) - } -} - -impl fmt::Display for TokenTree { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - TokenTree::Leaf(it) => fmt::Display::fmt(it, f), - TokenTree::Subtree(it) => fmt::Display::fmt(it, f), - } - } -} - -impl fmt::Display for Subtree { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let (l, r) = match self.delimiter_kind() { - Some(DelimiterKind::Parenthesis) => ("(", ")"), - Some(DelimiterKind::Brace) => ("{", "}"), - Some(DelimiterKind::Bracket) => ("[", "]"), - None => ("", ""), - }; - f.write_str(l)?; - let mut needs_space = false; - for tt in self.token_trees.iter() { - if needs_space { - f.write_str(" ")?; - } - needs_space = true; - match tt { - TokenTree::Leaf(Leaf::Punct(p)) => { - needs_space = p.spacing == Spacing::Alone; - fmt::Display::fmt(p, f)? - } - tt => fmt::Display::fmt(tt, f)?, - } - } - f.write_str(r)?; - Ok(()) - } -} - -impl fmt::Display for Leaf { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - Leaf::Ident(it) => fmt::Display::fmt(it, f), - Leaf::Literal(it) => fmt::Display::fmt(it, f), - Leaf::Punct(it) => fmt::Display::fmt(it, f), - } - } -} - -impl fmt::Display for Ident { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::Display::fmt(&self.text, f) - } -} - -impl fmt::Display for Literal { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::Display::fmt(&self.text, f) - } -} - -impl fmt::Display for Punct { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::Display::fmt(&self.char, f) - } -} - -impl Subtree { - /// Count the number of tokens recursively - pub fn count(&self) -> usize { - let children_count = self - .token_trees - .iter() - .map(|c| match c { - TokenTree::Subtree(c) => c.count(), - _ => 0, - }) - .sum::(); - - self.token_trees.len() + children_count - } - - pub fn delimiter_kind(&self) -> Option { - self.delimiter.map(|it| it.kind) - } -} - -pub mod buffer; - -#[derive(Debug, PartialEq, Eq, Clone)] -pub enum ExpansionError { - IOError(String), - JsonError(String), - Unknown(String), - ExpansionError(String), -} - -pub trait TokenExpander: Debug + Send + Sync + RefUnwindSafe { - fn expand(&self, subtree: &Subtree, attrs: Option<&Subtree>) - -> Result; -} diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index 6cbf43bb2..9bc5cc631 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml @@ -61,4 +61,4 @@ winapi = "0.3.8" expect = { path = "../expect" } test_utils = { path = "../test_utils" } mbe = { path = "../ra_mbe", package = "ra_mbe" } -tt = { path = "../ra_tt", package = "ra_tt" } +tt = { path = "../tt" } diff --git a/crates/tt/Cargo.toml b/crates/tt/Cargo.toml new file mode 100644 index 000000000..dfcdcf03e --- /dev/null +++ b/crates/tt/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "tt" +version = "0.0.0" +license = "MIT OR Apache-2.0" +authors = ["rust-analyzer developers"] +edition = "2018" + +[lib] +doctest = false + +[dependencies] +# ideally, `serde` should be enabled by `rust-analyzer`, but we enable it here +# to reduce number of compilations +smol_str = { version = "0.1.15", features = ["serde"] } + +stdx = { path = "../stdx" } diff --git a/crates/tt/src/buffer.rs b/crates/tt/src/buffer.rs new file mode 100644 index 000000000..02c771f70 --- /dev/null +++ b/crates/tt/src/buffer.rs @@ -0,0 +1,185 @@ +//! FIXME: write short doc here + +use crate::{Subtree, TokenTree}; + +#[derive(Copy, Clone, Debug, Eq, PartialEq)] +struct EntryId(usize); + +#[derive(Copy, Clone, Debug, Eq, PartialEq)] +struct EntryPtr(EntryId, usize); + +/// Internal type which is used instead of `TokenTree` to represent a token tree +/// within a `TokenBuffer`. +#[derive(Debug)] +enum Entry<'t> { + // Mimicking types from proc-macro. + Subtree(&'t TokenTree, EntryId), + Leaf(&'t TokenTree), + // End entries contain a pointer to the entry from the containing + // token tree, or None if this is the outermost level. + End(Option), +} + +/// A token tree buffer +/// The safe version of `syn` [`TokenBuffer`](https://github.com/dtolnay/syn/blob/6533607f91686545cb034d2838beea338d9d0742/src/buffer.rs#L41) +#[derive(Debug)] +pub struct TokenBuffer<'t> { + buffers: Vec]>>, +} + +impl<'t> TokenBuffer<'t> { + pub fn new(tokens: &'t [TokenTree]) -> TokenBuffer<'t> { + let mut buffers = vec![]; + + let idx = TokenBuffer::new_inner(tokens, &mut buffers, None); + assert_eq!(idx, 0); + + TokenBuffer { buffers } + } + + fn new_inner( + tokens: &'t [TokenTree], + buffers: &mut Vec]>>, + next: Option, + ) -> usize { + // Must contain everything in tokens and then the Entry::End + let start_capacity = tokens.len() + 1; + let mut entries = Vec::with_capacity(start_capacity); + let mut children = vec![]; + + for (idx, tt) in tokens.iter().enumerate() { + match tt { + TokenTree::Leaf(_) => { + entries.push(Entry::Leaf(tt)); + } + TokenTree::Subtree(subtree) => { + entries.push(Entry::End(None)); + children.push((idx, (subtree, tt))); + } + } + } + + entries.push(Entry::End(next)); + let res = buffers.len(); + buffers.push(entries.into_boxed_slice()); + + for (child_idx, (subtree, tt)) in children { + let idx = TokenBuffer::new_inner( + &subtree.token_trees, + buffers, + Some(EntryPtr(EntryId(res), child_idx + 1)), + ); + buffers[res].as_mut()[child_idx] = Entry::Subtree(tt, EntryId(idx)); + } + + res + } + + /// Creates a cursor referencing the first token in the buffer and able to + /// traverse until the end of the buffer. + pub fn begin(&self) -> Cursor { + Cursor::create(self, EntryPtr(EntryId(0), 0)) + } + + fn entry(&self, ptr: &EntryPtr) -> Option<&Entry> { + let id = ptr.0; + self.buffers[id.0].get(ptr.1) + } +} + +/// A safe version of `Cursor` from `syn` crate https://github.com/dtolnay/syn/blob/6533607f91686545cb034d2838beea338d9d0742/src/buffer.rs#L125 +#[derive(Copy, Clone, Debug)] +pub struct Cursor<'a> { + buffer: &'a TokenBuffer<'a>, + ptr: EntryPtr, +} + +impl<'a> PartialEq for Cursor<'a> { + fn eq(&self, other: &Cursor) -> bool { + self.ptr == other.ptr && std::ptr::eq(self.buffer, other.buffer) + } +} + +impl<'a> Eq for Cursor<'a> {} + +impl<'a> Cursor<'a> { + /// Check whether it is eof + pub fn eof(self) -> bool { + matches!(self.buffer.entry(&self.ptr), None | Some(Entry::End(None))) + } + + /// If the cursor is pointing at the end of a subtree, returns + /// the parent subtree + pub fn end(self) -> Option<&'a Subtree> { + match self.entry() { + Some(Entry::End(Some(ptr))) => { + let idx = ptr.1; + if let Some(Entry::Subtree(TokenTree::Subtree(subtree), _)) = + self.buffer.entry(&EntryPtr(ptr.0, idx - 1)) + { + return Some(subtree); + } + + None + } + _ => None, + } + } + + fn entry(self) -> Option<&'a Entry<'a>> { + self.buffer.entry(&self.ptr) + } + + /// If the cursor is pointing at a `Subtree`, returns + /// a cursor into that subtree + pub fn subtree(self) -> Option> { + match self.entry() { + Some(Entry::Subtree(_, entry_id)) => { + Some(Cursor::create(self.buffer, EntryPtr(*entry_id, 0))) + } + _ => None, + } + } + + /// If the cursor is pointing at a `TokenTree`, returns it + pub fn token_tree(self) -> Option<&'a TokenTree> { + match self.entry() { + Some(Entry::Leaf(tt)) => Some(tt), + Some(Entry::Subtree(tt, _)) => Some(tt), + Some(Entry::End(_)) => None, + None => None, + } + } + + fn create(buffer: &'a TokenBuffer, ptr: EntryPtr) -> Cursor<'a> { + Cursor { buffer, ptr } + } + + /// Bump the cursor + pub fn bump(self) -> Cursor<'a> { + if let Some(Entry::End(exit)) = self.buffer.entry(&self.ptr) { + if let Some(exit) = exit { + Cursor::create(self.buffer, *exit) + } else { + self + } + } else { + Cursor::create(self.buffer, EntryPtr(self.ptr.0, self.ptr.1 + 1)) + } + } + + /// Bump the cursor, if it is a subtree, returns + /// a cursor into that subtree + pub fn bump_subtree(self) -> Cursor<'a> { + match self.entry() { + Some(Entry::Subtree(_, _)) => self.subtree().unwrap(), + _ => self.bump(), + } + } + + /// Check whether it is a top level + pub fn is_root(&self) -> bool { + let entry_id = self.ptr.0; + entry_id.0 == 0 + } +} diff --git a/crates/tt/src/lib.rs b/crates/tt/src/lib.rs new file mode 100644 index 000000000..20c3f5eab --- /dev/null +++ b/crates/tt/src/lib.rs @@ -0,0 +1,246 @@ +//! `tt` crate defines a `TokenTree` data structure: this is the interface (both +//! input and output) of macros. It closely mirrors `proc_macro` crate's +//! `TokenTree`. +use std::{ + fmt::{self, Debug}, + panic::RefUnwindSafe, +}; + +use stdx::impl_from; + +pub use smol_str::SmolStr; + +/// Represents identity of the token. +/// +/// For hygiene purposes, we need to track which expanded tokens originated from +/// which source tokens. We do it by assigning an distinct identity to each +/// source token and making sure that identities are preserved during macro +/// expansion. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub struct TokenId(pub u32); + +impl TokenId { + pub const fn unspecified() -> TokenId { + TokenId(!0) + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum TokenTree { + Leaf(Leaf), + Subtree(Subtree), +} +impl_from!(Leaf, Subtree for TokenTree); + +impl TokenTree { + pub fn empty() -> Self { + TokenTree::Subtree(Subtree::default()) + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum Leaf { + Literal(Literal), + Punct(Punct), + Ident(Ident), +} +impl_from!(Literal, Punct, Ident for Leaf); + +#[derive(Clone, PartialEq, Eq, Hash, Default)] +pub struct Subtree { + pub delimiter: Option, + pub token_trees: Vec, +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub struct Delimiter { + pub id: TokenId, + pub kind: DelimiterKind, +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub enum DelimiterKind { + Parenthesis, + Brace, + Bracket, +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct Literal { + pub text: SmolStr, + pub id: TokenId, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub struct Punct { + pub char: char, + pub spacing: Spacing, + pub id: TokenId, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub enum Spacing { + Alone, + Joint, +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct Ident { + pub text: SmolStr, + pub id: TokenId, +} + +fn print_debug_subtree(f: &mut fmt::Formatter<'_>, subtree: &Subtree, level: usize) -> fmt::Result { + let align = std::iter::repeat(" ").take(level).collect::(); + + let aux = match subtree.delimiter.map(|it| (it.kind, it.id.0)) { + None => "$".to_string(), + Some((DelimiterKind::Parenthesis, id)) => format!("() {}", id), + Some((DelimiterKind::Brace, id)) => format!("{{}} {}", id), + Some((DelimiterKind::Bracket, id)) => format!("[] {}", id), + }; + + if subtree.token_trees.is_empty() { + write!(f, "{}SUBTREE {}", align, aux)?; + } else { + writeln!(f, "{}SUBTREE {}", align, aux)?; + for (idx, child) in subtree.token_trees.iter().enumerate() { + print_debug_token(f, child, level + 1)?; + if idx != subtree.token_trees.len() - 1 { + writeln!(f)?; + } + } + } + + Ok(()) +} + +fn print_debug_token(f: &mut fmt::Formatter<'_>, tkn: &TokenTree, level: usize) -> fmt::Result { + let align = std::iter::repeat(" ").take(level).collect::(); + + match tkn { + TokenTree::Leaf(leaf) => match leaf { + Leaf::Literal(lit) => write!(f, "{}LITERAL {} {}", align, lit.text, lit.id.0)?, + Leaf::Punct(punct) => write!( + f, + "{}PUNCH {} [{}] {}", + align, + punct.char, + if punct.spacing == Spacing::Alone { "alone" } else { "joint" }, + punct.id.0 + )?, + Leaf::Ident(ident) => write!(f, "{}IDENT {} {}", align, ident.text, ident.id.0)?, + }, + TokenTree::Subtree(subtree) => { + print_debug_subtree(f, subtree, level)?; + } + } + + Ok(()) +} + +impl Debug for Subtree { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + print_debug_subtree(f, self, 0) + } +} + +impl fmt::Display for TokenTree { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + TokenTree::Leaf(it) => fmt::Display::fmt(it, f), + TokenTree::Subtree(it) => fmt::Display::fmt(it, f), + } + } +} + +impl fmt::Display for Subtree { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let (l, r) = match self.delimiter_kind() { + Some(DelimiterKind::Parenthesis) => ("(", ")"), + Some(DelimiterKind::Brace) => ("{", "}"), + Some(DelimiterKind::Bracket) => ("[", "]"), + None => ("", ""), + }; + f.write_str(l)?; + let mut needs_space = false; + for tt in self.token_trees.iter() { + if needs_space { + f.write_str(" ")?; + } + needs_space = true; + match tt { + TokenTree::Leaf(Leaf::Punct(p)) => { + needs_space = p.spacing == Spacing::Alone; + fmt::Display::fmt(p, f)? + } + tt => fmt::Display::fmt(tt, f)?, + } + } + f.write_str(r)?; + Ok(()) + } +} + +impl fmt::Display for Leaf { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + Leaf::Ident(it) => fmt::Display::fmt(it, f), + Leaf::Literal(it) => fmt::Display::fmt(it, f), + Leaf::Punct(it) => fmt::Display::fmt(it, f), + } + } +} + +impl fmt::Display for Ident { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&self.text, f) + } +} + +impl fmt::Display for Literal { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&self.text, f) + } +} + +impl fmt::Display for Punct { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&self.char, f) + } +} + +impl Subtree { + /// Count the number of tokens recursively + pub fn count(&self) -> usize { + let children_count = self + .token_trees + .iter() + .map(|c| match c { + TokenTree::Subtree(c) => c.count(), + _ => 0, + }) + .sum::(); + + self.token_trees.len() + children_count + } + + pub fn delimiter_kind(&self) -> Option { + self.delimiter.map(|it| it.kind) + } +} + +pub mod buffer; + +#[derive(Debug, PartialEq, Eq, Clone)] +pub enum ExpansionError { + IOError(String), + JsonError(String), + Unknown(String), + ExpansionError(String), +} + +pub trait TokenExpander: Debug + Send + Sync + RefUnwindSafe { + fn expand(&self, subtree: &Subtree, attrs: Option<&Subtree>) + -> Result; +} diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs index 7384205db..ddaab93ab 100644 --- a/xtask/tests/tidy.rs +++ b/xtask/tests/tidy.rs @@ -200,7 +200,7 @@ impl TidyDocs { "profile", "ra_project_model", "ra_syntax", - "ra_tt", + "tt", "ra_hir_ty", ]; -- cgit v1.2.3