diff options
Diffstat (limited to 'crates/proc_macro_srv/src')
12 files changed, 15 insertions, 20 deletions
diff --git a/crates/proc_macro_srv/src/lib.rs b/crates/proc_macro_srv/src/lib.rs index d4f04ee06..f54cbcd61 100644 --- a/crates/proc_macro_srv/src/lib.rs +++ b/crates/proc_macro_srv/src/lib.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! RA Proc Macro Server | 1 | //! RA Proc Macro Server |
2 | //! | 2 | //! |
3 | //! This library is able to call compiled Rust custom derive dynamic libraries on arbitrary code. | 3 | //! This library is able to call compiled Rust custom derive dynamic libraries on arbitrary code. |
4 | //! The general idea here is based on https://github.com/fedochet/rust-proc-macro-expander. | 4 | //! The general idea here is based on <https://github.com/fedochet/rust-proc-macro-expander>. |
5 | //! | 5 | //! |
6 | //! But we adapt it to better fit RA needs: | 6 | //! But we adapt it to better fit RA needs: |
7 | //! | 7 | //! |
diff --git a/crates/proc_macro_srv/src/proc_macro/bridge/buffer.rs b/crates/proc_macro_srv/src/proc_macro/bridge/buffer.rs index dae6ff1d1..3b2afe01f 100644 --- a/crates/proc_macro_srv/src/proc_macro/bridge/buffer.rs +++ b/crates/proc_macro_srv/src/proc_macro/bridge/buffer.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! lib-proc-macro Buffer management for same-process client<->server communication. | 1 | //! lib-proc-macro Buffer management for same-process client<->server communication. |
2 | //! | 2 | //! |
3 | //! Copy from https://github.com/rust-lang/rust/blob/6050e523bae6de61de4e060facc43dc512adaccd/src/libproc_macro/bridge/buffer.rs | 3 | //! Copy from <https://github.com/rust-lang/rust/blob/6050e523bae6de61de4e060facc43dc512adaccd/src/libproc_macro/bridge/buffer.rs> |
4 | //! augmented with removing unstable features | 4 | //! augmented with removing unstable features |
5 | 5 | ||
6 | use std::io::{self, Write}; | 6 | use std::io::{self, Write}; |
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 b036d4e20..c135cf7a2 100644 --- a/crates/proc_macro_srv/src/proc_macro/bridge/client.rs +++ b/crates/proc_macro_srv/src/proc_macro/bridge/client.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! lib-proc-macro Client-side types. | 1 | //! lib-proc-macro Client-side types. |
2 | //! | 2 | //! |
3 | //! Copy from https://github.com/rust-lang/rust/blob/6050e523bae6de61de4e060facc43dc512adaccd/src/libproc_macro/bridge/client.rs | 3 | //! Copy from <https://github.com/rust-lang/rust/blob/6050e523bae6de61de4e060facc43dc512adaccd/src/libproc_macro/bridge/client.rs> |
4 | //! augmented with removing unstable features | 4 | //! augmented with removing unstable features |
5 | 5 | ||
6 | use super::*; | 6 | use super::*; |
diff --git a/crates/proc_macro_srv/src/proc_macro/bridge/closure.rs b/crates/proc_macro_srv/src/proc_macro/bridge/closure.rs index 273a97715..f5b6d897e 100644 --- a/crates/proc_macro_srv/src/proc_macro/bridge/closure.rs +++ b/crates/proc_macro_srv/src/proc_macro/bridge/closure.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! lib-proc-macro Closure type (equivalent to `&mut dyn FnMut(A) -> R`) that's `repr(C)`. | 1 | //! lib-proc-macro Closure type (equivalent to `&mut dyn FnMut(A) -> R`) that's `repr(C)`. |
2 | //! | 2 | //! |
3 | //! Copy from https://github.com/rust-lang/rust/blob/6050e523bae6de61de4e060facc43dc512adaccd/src/libproc_macro/bridge/closure.rs# | 3 | //! Copy from <https://github.com/rust-lang/rust/blob/6050e523bae6de61de4e060facc43dc512adaccd/src/libproc_macro/bridge/closure.rs> |
4 | //! augmented with removing unstable features | 4 | //! augmented with removing unstable features |
5 | 5 | ||
6 | #[repr(C)] | 6 | #[repr(C)] |
diff --git a/crates/proc_macro_srv/src/proc_macro/bridge/handle.rs b/crates/proc_macro_srv/src/proc_macro/bridge/handle.rs index a2f77b5ac..d2a65d249 100644 --- a/crates/proc_macro_srv/src/proc_macro/bridge/handle.rs +++ b/crates/proc_macro_srv/src/proc_macro/bridge/handle.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! lib-proc-macro Server-side handles and storage for per-handle data. | 1 | //! lib-proc-macro Server-side handles and storage for per-handle data. |
2 | //! | 2 | //! |
3 | //! Copy from https://github.com/rust-lang/rust/blob/6050e523bae6de61de4e060facc43dc512adaccd/src/libproc_macro/bridge/handle.rs | 3 | //! Copy from <https://github.com/rust-lang/rust/blob/6050e523bae6de61de4e060facc43dc512adaccd/src/libproc_macro/bridge/handle.rs> |
4 | //! augmented with removing unstable features | 4 | //! augmented with removing unstable features |
5 | 5 | ||
6 | use std::collections::{BTreeMap, HashMap}; | 6 | use std::collections::{BTreeMap, HashMap}; |
diff --git a/crates/proc_macro_srv/src/proc_macro/bridge/mod.rs b/crates/proc_macro_srv/src/proc_macro/bridge/mod.rs index e67902682..375396d1b 100644 --- a/crates/proc_macro_srv/src/proc_macro/bridge/mod.rs +++ b/crates/proc_macro_srv/src/proc_macro/bridge/mod.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! lib-proc-macro Internal interface for communicating between a `proc_macro` client | 1 | //! lib-proc-macro Internal interface for communicating between a `proc_macro` client |
2 | //! | 2 | //! |
3 | //! Copy from https://github.com/rust-lang/rust/blob/6050e523bae6de61de4e060facc43dc512adaccd/src/libproc_macro/bridge/mod.rs | 3 | //! Copy from <https://github.com/rust-lang/rust/blob/6050e523bae6de61de4e060facc43dc512adaccd/src/libproc_macro/bridge/mod.rs> |
4 | //! augmented with removing unstable features | 4 | //! augmented with removing unstable features |
5 | //! | 5 | //! |
6 | //! Internal interface for communicating between a `proc_macro` client | 6 | //! Internal interface for communicating between a `proc_macro` client |
diff --git a/crates/proc_macro_srv/src/proc_macro/bridge/rpc.rs b/crates/proc_macro_srv/src/proc_macro/bridge/rpc.rs index bd1e7c2fc..69928ec84 100644 --- a/crates/proc_macro_srv/src/proc_macro/bridge/rpc.rs +++ b/crates/proc_macro_srv/src/proc_macro/bridge/rpc.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! lib-proc-macro Serialization for client-server communication. | 1 | //! lib-proc-macro Serialization for client-server communication. |
2 | //! | 2 | //! |
3 | //! Copy from https://github.com/rust-lang/rust/blob/6050e523bae6de61de4e060facc43dc512adaccd/src/libproc_macro/bridge/rpc.rs | 3 | //! Copy from <https://github.com/rust-lang/rust/blob/6050e523bae6de61de4e060facc43dc512adaccd/src/libproc_macro/bridge/rpc.rs> |
4 | //! augmented with removing unstable features | 4 | //! augmented with removing unstable features |
5 | //! | 5 | //! |
6 | //! Serialization for client-server communication. | 6 | //! Serialization for client-server communication. |
diff --git a/crates/proc_macro_srv/src/proc_macro/bridge/scoped_cell.rs b/crates/proc_macro_srv/src/proc_macro/bridge/scoped_cell.rs index 6ef7ea43c..0436bc418 100644 --- a/crates/proc_macro_srv/src/proc_macro/bridge/scoped_cell.rs +++ b/crates/proc_macro_srv/src/proc_macro/bridge/scoped_cell.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! lib-proc-macro `Cell` variant for (scoped) existential lifetimes. | 1 | //! lib-proc-macro `Cell` variant for (scoped) existential lifetimes. |
2 | //! | 2 | //! |
3 | //! Copy from https://github.com/rust-lang/rust/blob/6050e523bae6de61de4e060facc43dc512adaccd/src/libproc_macro/bridge/scoped_cell.rs#L1 | 3 | //! Copy from <https://github.com/rust-lang/rust/blob/6050e523bae6de61de4e060facc43dc512adaccd/src/libproc_macro/bridge/scoped_cell.rs#L1> |
4 | //! augmented with removing unstable features | 4 | //! augmented with removing unstable features |
5 | 5 | ||
6 | use std::cell::Cell; | 6 | use std::cell::Cell; |
diff --git a/crates/proc_macro_srv/src/proc_macro/bridge/server.rs b/crates/proc_macro_srv/src/proc_macro/bridge/server.rs index 88fbdc078..cc9afd84b 100644 --- a/crates/proc_macro_srv/src/proc_macro/bridge/server.rs +++ b/crates/proc_macro_srv/src/proc_macro/bridge/server.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! lib-proc-macro server-side traits | 1 | //! lib-proc-macro server-side traits |
2 | //! | 2 | //! |
3 | //! Copy from https://github.com/rust-lang/rust/blob/6050e523bae6de61de4e060facc43dc512adaccd/src/libproc_macro/bridge/server.rs | 3 | //! Copy from <https://github.com/rust-lang/rust/blob/6050e523bae6de61de4e060facc43dc512adaccd/src/libproc_macro/bridge/server.rs> |
4 | //! augmented with removing unstable features | 4 | //! augmented with removing unstable features |
5 | 5 | ||
6 | use super::*; | 6 | use super::*; |
diff --git a/crates/proc_macro_srv/src/proc_macro/diagnostic.rs b/crates/proc_macro_srv/src/proc_macro/diagnostic.rs index 55d93917c..3c5b7bc01 100644 --- a/crates/proc_macro_srv/src/proc_macro/diagnostic.rs +++ b/crates/proc_macro_srv/src/proc_macro/diagnostic.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! lib-proc-macro diagnostic | 1 | //! lib-proc-macro diagnostic |
2 | //! | 2 | //! |
3 | //! Copy from https://github.com/rust-lang/rust/blob/6050e523bae6de61de4e060facc43dc512adaccd/src/libproc_macro/diagnostic.rs | 3 | //! Copy from <https://github.com/rust-lang/rust/blob/6050e523bae6de61de4e060facc43dc512adaccd/src/libproc_macro/diagnostic.rs> |
4 | //! augmented with removing unstable features | 4 | //! augmented with removing unstable features |
5 | 5 | ||
6 | use crate::proc_macro::Span; | 6 | use crate::proc_macro::Span; |
@@ -91,7 +91,7 @@ impl<'a> Iterator for Children<'a> { | |||
91 | impl Diagnostic { | 91 | impl Diagnostic { |
92 | /// Creates a new diagnostic with the given `level` and `message`. | 92 | /// Creates a new diagnostic with the given `level` and `message`. |
93 | pub fn new<T: Into<String>>(level: Level, message: T) -> Diagnostic { | 93 | pub fn new<T: Into<String>>(level: Level, message: T) -> Diagnostic { |
94 | Diagnostic { level: level, message: message.into(), spans: vec![], children: vec![] } | 94 | Diagnostic { level, message: message.into(), spans: vec![], children: vec![] } |
95 | } | 95 | } |
96 | 96 | ||
97 | /// Creates a new diagnostic with the given `level` and `message` pointing to | 97 | /// Creates a new diagnostic with the given `level` and `message` pointing to |
@@ -101,12 +101,7 @@ impl Diagnostic { | |||
101 | S: MultiSpan, | 101 | S: MultiSpan, |
102 | T: Into<String>, | 102 | T: Into<String>, |
103 | { | 103 | { |
104 | Diagnostic { | 104 | Diagnostic { level, message: message.into(), spans: spans.into_spans(), children: vec![] } |
105 | level: level, | ||
106 | message: message.into(), | ||
107 | spans: spans.into_spans(), | ||
108 | children: vec![], | ||
109 | } | ||
110 | } | 105 | } |
111 | 106 | ||
112 | diagnostic_child_methods!(span_error, error, Level::Error); | 107 | diagnostic_child_methods!(span_error, error, Level::Error); |
diff --git a/crates/proc_macro_srv/src/proc_macro/mod.rs b/crates/proc_macro_srv/src/proc_macro/mod.rs index fc6e7344f..b7c1d04b5 100644 --- a/crates/proc_macro_srv/src/proc_macro/mod.rs +++ b/crates/proc_macro_srv/src/proc_macro/mod.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! lib-proc-macro main module | 1 | //! lib-proc-macro main module |
2 | //! | 2 | //! |
3 | //! Copy from https://github.com/rust-lang/rust/blob/6050e523bae6de61de4e060facc43dc512adaccd/src/libproc_macro/lib.rs | 3 | //! Copy from <https://github.com/rust-lang/rust/blob/6050e523bae6de61de4e060facc43dc512adaccd/src/libproc_macro/lib.rs> |
4 | //! augmented with removing unstable features | 4 | //! augmented with removing unstable features |
5 | 5 | ||
6 | // NOTE(@edwin0cheng): | 6 | // NOTE(@edwin0cheng): |
diff --git a/crates/proc_macro_srv/src/rustc_server.rs b/crates/proc_macro_srv/src/rustc_server.rs index 5d765f6e2..65ca3eb6c 100644 --- a/crates/proc_macro_srv/src/rustc_server.rs +++ b/crates/proc_macro_srv/src/rustc_server.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! Rustc proc-macro server implementation with 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, |
@@ -539,7 +539,7 @@ impl server::Literal for Rustc { | |||
539 | } else { | 539 | } else { |
540 | n.parse::<u128>().unwrap().to_string() | 540 | n.parse::<u128>().unwrap().to_string() |
541 | }; | 541 | }; |
542 | return Literal { text: n.into(), id: tt::TokenId::unspecified() }; | 542 | Literal { text: n.into(), id: tt::TokenId::unspecified() } |
543 | } | 543 | } |
544 | 544 | ||
545 | fn typed_integer(&mut self, n: &str, kind: &str) -> Self::Literal { | 545 | fn typed_integer(&mut self, n: &str, kind: &str) -> Self::Literal { |