Browse Source

lang: Make parser fail if 'seeds' constraint is used with 'associated token' constraints (#1803)

Paul 3 years ago
parent
commit
765fee0c6e
1 changed files with 9 additions and 0 deletions
  1. 9 0
      lang/syn/src/parser/accounts/constraints.rs

+ 9 - 0
lang/syn/src/parser/accounts/constraints.rs

@@ -593,6 +593,15 @@ impl<'ty> ConstraintGroupBuilder<'ty> {
             }
             _ => None,
         };
+        if let Some(associated_token) = &associated_token {
+            if seeds.is_some() {
+                return Err(ParseError::new(
+                    associated_token.mint.span(),
+                    "'associated_token' constraints cannot be used with the 'seeds' constraint",
+                ));
+            }
+        }
+
         let token_account = match (&token_mint, &token_authority) {
             (None, None) => None,
             _ => Some(ConstraintTokenAccountGroup {