aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_expand/src/builtin_derive.rs
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2020-03-02 06:05:15 +0000
committerEdwin Cheng <[email protected]>2020-03-03 17:21:14 +0000
commit1465cc0c4feb52958d3281f066a663e0a52ed67e (patch)
tree933d006064847260d5ec0d816fef5a381e674f90 /crates/ra_hir_expand/src/builtin_derive.rs
parent0d554540730925c074693b43503e65476eadbd65 (diff)
Implement concat macro
Diffstat (limited to 'crates/ra_hir_expand/src/builtin_derive.rs')
-rw-r--r--crates/ra_hir_expand/src/builtin_derive.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/crates/ra_hir_expand/src/builtin_derive.rs b/crates/ra_hir_expand/src/builtin_derive.rs
index 0b70fb9e1..87224481c 100644
--- a/crates/ra_hir_expand/src/builtin_derive.rs
+++ b/crates/ra_hir_expand/src/builtin_derive.rs
@@ -9,7 +9,7 @@ use ra_syntax::{
9}; 9};
10 10
11use crate::db::AstDatabase; 11use crate::db::AstDatabase;
12use crate::{name, quote, MacroCallId, MacroDefId, MacroDefKind}; 12use crate::{name, quote, LazyMacroId, MacroDefId, MacroDefKind};
13 13
14macro_rules! register_builtin { 14macro_rules! register_builtin {
15 ( $($trait:ident => $expand:ident),* ) => { 15 ( $($trait:ident => $expand:ident),* ) => {
@@ -22,7 +22,7 @@ macro_rules! register_builtin {
22 pub fn expand( 22 pub fn expand(
23 &self, 23 &self,
24 db: &dyn AstDatabase, 24 db: &dyn AstDatabase,
25 id: MacroCallId, 25 id: LazyMacroId,
26 tt: &tt::Subtree, 26 tt: &tt::Subtree,
27 ) -> Result<tt::Subtree, mbe::ExpandError> { 27 ) -> Result<tt::Subtree, mbe::ExpandError> {
28 let expander = match *self { 28 let expander = match *self {
@@ -155,7 +155,7 @@ fn expand_simple_derive(
155 155
156fn copy_expand( 156fn copy_expand(
157 _db: &dyn AstDatabase, 157 _db: &dyn AstDatabase,
158 _id: MacroCallId, 158 _id: LazyMacroId,
159 tt: &tt::Subtree, 159 tt: &tt::Subtree,
160) -> Result<tt::Subtree, mbe::ExpandError> { 160) -> Result<tt::Subtree, mbe::ExpandError> {
161 expand_simple_derive(tt, quote! { std::marker::Copy }) 161 expand_simple_derive(tt, quote! { std::marker::Copy })
@@ -163,7 +163,7 @@ fn copy_expand(
163 163
164fn clone_expand( 164fn clone_expand(
165 _db: &dyn AstDatabase, 165 _db: &dyn AstDatabase,
166 _id: MacroCallId, 166 _id: LazyMacroId,
167 tt: &tt::Subtree, 167 tt: &tt::Subtree,
168) -> Result<tt::Subtree, mbe::ExpandError> { 168) -> Result<tt::Subtree, mbe::ExpandError> {
169 expand_simple_derive(tt, quote! { std::clone::Clone }) 169 expand_simple_derive(tt, quote! { std::clone::Clone })
@@ -171,7 +171,7 @@ fn clone_expand(
171 171
172fn default_expand( 172fn default_expand(
173 _db: &dyn AstDatabase, 173 _db: &dyn AstDatabase,
174 _id: MacroCallId, 174 _id: LazyMacroId,
175 tt: &tt::Subtree, 175 tt: &tt::Subtree,
176) -> Result<tt::Subtree, mbe::ExpandError> { 176) -> Result<tt::Subtree, mbe::ExpandError> {
177 expand_simple_derive(tt, quote! { std::default::Default }) 177 expand_simple_derive(tt, quote! { std::default::Default })
@@ -179,7 +179,7 @@ fn default_expand(
179 179
180fn debug_expand( 180fn debug_expand(
181 _db: &dyn AstDatabase, 181 _db: &dyn AstDatabase,
182 _id: MacroCallId, 182 _id: LazyMacroId,
183 tt: &tt::Subtree, 183 tt: &tt::Subtree,
184) -> Result<tt::Subtree, mbe::ExpandError> { 184) -> Result<tt::Subtree, mbe::ExpandError> {
185 expand_simple_derive(tt, quote! { std::fmt::Debug }) 185 expand_simple_derive(tt, quote! { std::fmt::Debug })
@@ -187,7 +187,7 @@ fn debug_expand(
187 187
188fn hash_expand( 188fn hash_expand(
189 _db: &dyn AstDatabase, 189 _db: &dyn AstDatabase,
190 _id: MacroCallId, 190 _id: LazyMacroId,
191 tt: &tt::Subtree, 191 tt: &tt::Subtree,
192) -> Result<tt::Subtree, mbe::ExpandError> { 192) -> Result<tt::Subtree, mbe::ExpandError> {
193 expand_simple_derive(tt, quote! { std::hash::Hash }) 193 expand_simple_derive(tt, quote! { std::hash::Hash })
@@ -195,7 +195,7 @@ fn hash_expand(
195 195
196fn eq_expand( 196fn eq_expand(
197 _db: &dyn AstDatabase, 197 _db: &dyn AstDatabase,
198 _id: MacroCallId, 198 _id: LazyMacroId,
199 tt: &tt::Subtree, 199 tt: &tt::Subtree,
200) -> Result<tt::Subtree, mbe::ExpandError> { 200) -> Result<tt::Subtree, mbe::ExpandError> {
201 expand_simple_derive(tt, quote! { std::cmp::Eq }) 201 expand_simple_derive(tt, quote! { std::cmp::Eq })
@@ -203,7 +203,7 @@ fn eq_expand(
203 203
204fn partial_eq_expand( 204fn partial_eq_expand(
205 _db: &dyn AstDatabase, 205 _db: &dyn AstDatabase,
206 _id: MacroCallId, 206 _id: LazyMacroId,
207 tt: &tt::Subtree, 207 tt: &tt::Subtree,
208) -> Result<tt::Subtree, mbe::ExpandError> { 208) -> Result<tt::Subtree, mbe::ExpandError> {
209 expand_simple_derive(tt, quote! { std::cmp::PartialEq }) 209 expand_simple_derive(tt, quote! { std::cmp::PartialEq })
@@ -211,7 +211,7 @@ fn partial_eq_expand(
211 211
212fn ord_expand( 212fn ord_expand(
213 _db: &dyn AstDatabase, 213 _db: &dyn AstDatabase,
214 _id: MacroCallId, 214 _id: LazyMacroId,
215 tt: &tt::Subtree, 215 tt: &tt::Subtree,
216) -> Result<tt::Subtree, mbe::ExpandError> { 216) -> Result<tt::Subtree, mbe::ExpandError> {
217 expand_simple_derive(tt, quote! { std::cmp::Ord }) 217 expand_simple_derive(tt, quote! { std::cmp::Ord })
@@ -219,7 +219,7 @@ fn ord_expand(
219 219
220fn partial_ord_expand( 220fn partial_ord_expand(
221 _db: &dyn AstDatabase, 221 _db: &dyn AstDatabase,
222 _id: MacroCallId, 222 _id: LazyMacroId,
223 tt: &tt::Subtree, 223 tt: &tt::Subtree,
224) -> Result<tt::Subtree, mbe::ExpandError> { 224) -> Result<tt::Subtree, mbe::ExpandError> {
225 expand_simple_derive(tt, quote! { std::cmp::PartialOrd }) 225 expand_simple_derive(tt, quote! { std::cmp::PartialOrd })
@@ -228,7 +228,7 @@ fn partial_ord_expand(
228#[cfg(test)] 228#[cfg(test)]
229mod tests { 229mod tests {
230 use super::*; 230 use super::*;
231 use crate::{test_db::TestDB, AstId, MacroCallKind, MacroCallLoc}; 231 use crate::{test_db::TestDB, AstId, MacroCallId, MacroCallKind, MacroCallLoc};
232 use ra_db::{fixture::WithFixture, SourceDatabase}; 232 use ra_db::{fixture::WithFixture, SourceDatabase};
233 233
234 fn expand_builtin_derive(s: &str, expander: BuiltinDeriveExpander) -> String { 234 fn expand_builtin_derive(s: &str, expander: BuiltinDeriveExpander) -> String {