diff options
Diffstat (limited to 'crates/ra_hir_expand/src/builtin_derive.rs')
-rw-r--r-- | crates/ra_hir_expand/src/builtin_derive.rs | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/crates/ra_hir_expand/src/builtin_derive.rs b/crates/ra_hir_expand/src/builtin_derive.rs index b26441253..62c60e336 100644 --- a/crates/ra_hir_expand/src/builtin_derive.rs +++ b/crates/ra_hir_expand/src/builtin_derive.rs | |||
@@ -97,11 +97,24 @@ fn parse_adt(tt: &tt::Subtree) -> Result<BasicAdtInfo, mbe::ExpandError> { | |||
97 | 97 | ||
98 | fn make_type_args(n: usize, bound: Vec<tt::TokenTree>) -> Vec<tt::TokenTree> { | 98 | fn make_type_args(n: usize, bound: Vec<tt::TokenTree>) -> Vec<tt::TokenTree> { |
99 | let mut result = Vec::<tt::TokenTree>::new(); | 99 | let mut result = Vec::<tt::TokenTree>::new(); |
100 | result.push(tt::Leaf::Punct(tt::Punct { char: '<', spacing: tt::Spacing::Alone }).into()); | 100 | result.push( |
101 | tt::Leaf::Punct(tt::Punct { | ||
102 | char: '<', | ||
103 | spacing: tt::Spacing::Alone, | ||
104 | id: tt::TokenId::unspecified(), | ||
105 | }) | ||
106 | .into(), | ||
107 | ); | ||
101 | for i in 0..n { | 108 | for i in 0..n { |
102 | if i > 0 { | 109 | if i > 0 { |
103 | result | 110 | result.push( |
104 | .push(tt::Leaf::Punct(tt::Punct { char: ',', spacing: tt::Spacing::Alone }).into()); | 111 | tt::Leaf::Punct(tt::Punct { |
112 | char: ',', | ||
113 | spacing: tt::Spacing::Alone, | ||
114 | id: tt::TokenId::unspecified(), | ||
115 | }) | ||
116 | .into(), | ||
117 | ); | ||
105 | } | 118 | } |
106 | result.push( | 119 | result.push( |
107 | tt::Leaf::Ident(tt::Ident { | 120 | tt::Leaf::Ident(tt::Ident { |
@@ -112,7 +125,14 @@ fn make_type_args(n: usize, bound: Vec<tt::TokenTree>) -> Vec<tt::TokenTree> { | |||
112 | ); | 125 | ); |
113 | result.extend(bound.iter().cloned()); | 126 | result.extend(bound.iter().cloned()); |
114 | } | 127 | } |
115 | result.push(tt::Leaf::Punct(tt::Punct { char: '>', spacing: tt::Spacing::Alone }).into()); | 128 | result.push( |
129 | tt::Leaf::Punct(tt::Punct { | ||
130 | char: '>', | ||
131 | spacing: tt::Spacing::Alone, | ||
132 | id: tt::TokenId::unspecified(), | ||
133 | }) | ||
134 | .into(), | ||
135 | ); | ||
116 | result | 136 | result |
117 | } | 137 | } |
118 | 138 | ||