]> git.lizzy.rs Git - rust.git/blobdiff - crates/syntax/src/lib.rs
internal: make sure macro test expand to valid syntax
[rust.git] / crates / syntax / src / lib.rs
index 132d300674d8bdbf488fb5bd2cf7f445716730ee..24a099cb3cc764366e0e6f11dae54979e840b680 100644 (file)
@@ -89,6 +89,9 @@ fn new(green: GreenNode, errors: Vec<SyntaxError>) -> Parse<T> {
     pub fn syntax_node(&self) -> SyntaxNode {
         SyntaxNode::new_root(self.green.clone())
     }
+    pub fn errors(&self) -> &[SyntaxError] {
+        &*self.errors
+    }
 }
 
 impl<T: AstNode> Parse<T> {
@@ -100,10 +103,6 @@ pub fn tree(&self) -> T {
         T::cast(self.syntax_node()).unwrap()
     }
 
-    pub fn errors(&self) -> &[SyntaxError] {
-        &*self.errors
-    }
-
     pub fn ok(self) -> Result<T, Arc<Vec<SyntaxError>>> {
         if self.errors.is_empty() {
             Ok(self.tree())