We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6f76df4 commit 3afd82eCopy full SHA for 3afd82e
lang/syn/src/parser/accounts/mod.rs
@@ -93,6 +93,19 @@ fn constraints_cross_checks(fields: &[AccountField]) -> ParseResult<()> {
93
})
94
.collect();
95
96
+ for field in &init_fields {
97
+ if matches!(field.ty, Ty::SystemAccount) {
98
+ return Err(ParseError::new(
99
+ field.ident.span(),
100
+ "Cannot use `init` on a `SystemAccount`. \
101
+ The `SystemAccount` type represents an already-existing account \
102
+ owned by the system program and cannot be initialized. \
103
+ If you need to create a new account, use a more specific account type \
104
+ or `UncheckedAccount` and perform manual initialization instead.",
105
+ ));
106
+ }
107
108
+
109
if !init_fields.is_empty() {
110
// init needs system program.
111
0 commit comments