mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-21 19:04:24 +00:00
internal: make sure macro test expand to valid syntax
This commit is contained in:
parent
c41b7bbe69
commit
c2e425dd00
5 changed files with 31 additions and 27 deletions
|
@ -89,6 +89,9 @@ impl<T> 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 @@ impl<T: AstNode> Parse<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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue