From f8140cd0ac608511229be22b846bee93bfde0da8 Mon Sep 17 00:00:00 2001 From: "github-merge-queue[bot]" Date: Tue, 6 Feb 2024 06:28:10 +0000 Subject: [PATCH] deploy: 6df8d4e88717791f200f276dca44b61f1942d024 --- rustdoc/src/superstruct/lib.rs.html | 36 +++++++++++++++++++++++ rustdoc/superstruct/attr.superstruct.html | 2 +- rustdoc/superstruct/index.html | 2 +- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/rustdoc/src/superstruct/lib.rs.html b/rustdoc/src/superstruct/lib.rs.html index 7a3a1ed2..3b18bbcf 100644 --- a/rustdoc/src/superstruct/lib.rs.html +++ b/rustdoc/src/superstruct/lib.rs.html @@ -1145,6 +1145,24 @@ 1145 1146 1147 +1148 +1149 +1150 +1151 +1152 +1153 +1154 +1155 +1156 +1157 +1158 +1159 +1160 +1161 +1162 +1163 +1164 +1165
use attributes::{IdentList, NestedMetaList};
 use darling::util::Override;
 use darling::FromMeta;
@@ -1383,6 +1401,9 @@
             .next()
             .unwrap_or_default();
 
+        // Check for conflicting attributes.
+        check_for_conflicting_superstruct_attrs(&field.attrs);
+
         // Drop the field-level superstruct attributes
         let mut output_field = field.clone();
         output_field.attrs = discard_superstruct_attrs(&output_field.attrs);
@@ -2227,6 +2248,21 @@
     }
 }
 
+/// Check that there is at most one superstruct attribute, and panic otherwise.
+fn check_for_conflicting_superstruct_attrs(attrs: &[Attribute]) {
+    if attrs
+        .iter()
+        .filter(|attr| is_superstruct_attr(attr))
+        .count()
+        > 1
+    {
+        // TODO: this is specific to fields right now, but we could maybe make it work for the
+        // top-level attributes. I'm just not sure how to get at them under the `AttributeArgs`
+        // stuff.
+        panic!("cannot handle more than one superstruct attribute per field");
+    }
+}
+
 /// Keep all non-superstruct-related attributes from an array.
 fn discard_superstruct_attrs(attrs: &[Attribute]) -> Vec<Attribute> {
     attrs
diff --git a/rustdoc/superstruct/attr.superstruct.html b/rustdoc/superstruct/attr.superstruct.html
index 8144a38b..ad394b3b 100644
--- a/rustdoc/superstruct/attr.superstruct.html
+++ b/rustdoc/superstruct/attr.superstruct.html
@@ -1 +1 @@
-superstruct in superstruct - Rust

Attribute Macro superstruct::superstruct

source ·
#[superstruct]
\ No newline at end of file +superstruct in superstruct - Rust

Attribute Macro superstruct::superstruct

source ·
#[superstruct]
\ No newline at end of file diff --git a/rustdoc/superstruct/index.html b/rustdoc/superstruct/index.html index 4d319e38..ca7b898d 100644 --- a/rustdoc/superstruct/index.html +++ b/rustdoc/superstruct/index.html @@ -1,2 +1,2 @@ superstruct - Rust
\ No newline at end of file +
  • All Items
  • \ No newline at end of file