diff --git a/src/parser.rs b/src/parser.rs index 5604d35..34d0f4d 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -244,6 +244,7 @@ impl Parser { TokenKind::Let => Ok(Declaration::Let(self.parse_let_decl(visibility, doc)?)), TokenKind::Trait => Ok(Declaration::Trait(self.parse_trait_decl(visibility, doc)?)), TokenKind::Impl => Ok(Declaration::Impl(self.parse_impl_decl()?)), + TokenKind::Run => Err(self.error("Bare 'run' expressions are not allowed at top level. Use 'let _ = run ...' or 'let result = run ...'")), _ => Err(self.error("Expected declaration (fn, effect, handler, type, trait, impl, or let)")), } }