about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2020-12-01 17:32:14 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2020-12-01 17:32:14 +0100
commita2d1254e22c37b359a8b89e13a5dd288cc69a268 (patch)
tree6b5297f3f91d08934d83abb0b9b8654871fcee2d /compiler
parent63816da5ed1abfe0c3b134dbf6710725d4416ee4 (diff)
downloadrust-a2d1254e22c37b359a8b89e13a5dd288cc69a268.tar.gz
rust-a2d1254e22c37b359a8b89e13a5dd288cc69a268.zip
Add documentation for name_value_literal_span methods
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_ast/src/attr/mod.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/rustc_ast/src/attr/mod.rs b/compiler/rustc_ast/src/attr/mod.rs
index 22539bb1d9d..19c7c479f04 100644
--- a/compiler/rustc_ast/src/attr/mod.rs
+++ b/compiler/rustc_ast/src/attr/mod.rs
@@ -180,6 +180,13 @@ impl Attribute {
         self.value_str().is_some()
     }
 
+    /// This is used in case you want the value span instead of the whole attribute. Example:
+    ///
+    /// ```text
+    /// #[doc(alias = "foo")]
+    /// ```
+    ///
+    /// In here, it'll return a span for `"foo"`.
     pub fn name_value_literal_span(&self) -> Option<Span> {
         match self.kind {
             AttrKind::Normal(ref item, _) => {
@@ -241,6 +248,13 @@ impl MetaItem {
         self.value_str().is_some()
     }
 
+    /// This is used in case you want the value span instead of the whole attribute. Example:
+    ///
+    /// ```text
+    /// #[doc(alias = "foo")]
+    /// ```
+    ///
+    /// In here, it'll return a span for `"foo"`.
     pub fn name_value_literal_span(&self) -> Option<Span> {
         Some(self.name_value_literal()?.span)
     }