File tree 1 file changed +14
-0
lines changed
compiler/rustc_ast/src/attr
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -180,6 +180,13 @@ impl Attribute {
180
180
self . value_str ( ) . is_some ( )
181
181
}
182
182
183
+ /// This is used in case you want the value span instead of the whole attribute. Example:
184
+ ///
185
+ /// ```text
186
+ /// #[doc(alias = "foo")]
187
+ /// ```
188
+ ///
189
+ /// In here, it'll return a span for `"foo"`.
183
190
pub fn name_value_literal_span ( & self ) -> Option < Span > {
184
191
match self . kind {
185
192
AttrKind :: Normal ( ref item, _) => {
@@ -241,6 +248,13 @@ impl MetaItem {
241
248
self . value_str ( ) . is_some ( )
242
249
}
243
250
251
+ /// This is used in case you want the value span instead of the whole attribute. Example:
252
+ ///
253
+ /// ```text
254
+ /// #[doc(alias = "foo")]
255
+ /// ```
256
+ ///
257
+ /// In here, it'll return a span for `"foo"`.
244
258
pub fn name_value_literal_span ( & self ) -> Option < Span > {
245
259
Some ( self . name_value_literal ( ) ?. span )
246
260
}
You can’t perform that action at this time.
0 commit comments