about summary refs log tree commit diff
path: root/compiler/rustc_macros/src/diagnostics/utils.rs
diff options
context:
space:
mode:
authorDavid Wood <david.wood@huawei.com>2022-04-27 05:24:31 +0100
committerDavid Wood <david.wood@huawei.com>2022-04-29 02:12:10 +0100
commite8ee0d7a20432bafaa59c04a9ad99c3b040d395f (patch)
tree7245e833f146358edacc57c14652904f6083f641 /compiler/rustc_macros/src/diagnostics/utils.rs
parent2647a4812c87c1fd9535d0c26db2b5f6433075d0 (diff)
downloadrust-e8ee0d7a20432bafaa59c04a9ad99c3b040d395f.tar.gz
rust-e8ee0d7a20432bafaa59c04a9ad99c3b040d395f.zip
macros: add more documentation comments
Documentation comments are always good.

Signed-off-by: David Wood <david.wood@huawei.com>
Diffstat (limited to 'compiler/rustc_macros/src/diagnostics/utils.rs')
-rw-r--r--compiler/rustc_macros/src/diagnostics/utils.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_macros/src/diagnostics/utils.rs b/compiler/rustc_macros/src/diagnostics/utils.rs
index c44ca7cc626..6791a9e35b8 100644
--- a/compiler/rustc_macros/src/diagnostics/utils.rs
+++ b/compiler/rustc_macros/src/diagnostics/utils.rs
@@ -102,6 +102,8 @@ pub(crate) struct FieldInfo<'a> {
     pub(crate) span: &'a proc_macro2::Span,
 }
 
+/// Small helper trait for abstracting over `Option` fields that contain a value and a `Span`
+/// for error reporting if they are set more than once.
 pub(crate) trait SetOnce<T> {
     fn set_once(&mut self, value: T);
 }
@@ -122,6 +124,7 @@ impl<T> SetOnce<(T, Span)> for Option<(T, Span)> {
 }
 
 pub(crate) trait HasFieldMap {
+    /// Returns the binding for the field with the given name, if it exists on the type.
     fn get_field_binding(&self, field: &String) -> Option<&TokenStream>;
 
     /// In the strings in the attributes supplied to this macro, we want callers to be able to