diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-12-01 17:32:14 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-12-01 17:32:14 +0100 |
| commit | a2d1254e22c37b359a8b89e13a5dd288cc69a268 (patch) | |
| tree | 6b5297f3f91d08934d83abb0b9b8654871fcee2d /compiler | |
| parent | 63816da5ed1abfe0c3b134dbf6710725d4416ee4 (diff) | |
| download | rust-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.rs | 14 |
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) } |
