Skip to content

Commit 7f88fe8

Browse files
committed
Add a pinch of comments
1 parent a5301e9 commit 7f88fe8

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

crates/ra_syntax/src/ast/generated.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run
22
// Do not edit manually
33

4+
//! This module contains auto-generated Rust AST. Like `SyntaxNode`s, AST nodes
5+
//! are generic over ownership: `X<'a>` things are `Copy` references, `XNode`
6+
//! are Arc-based. You can switch between the two variants using `.owned` and
7+
//! `.borrowed` functions. Most of the code works with borowed mode, and only
8+
//! this mode has all AST accessors.
9+
410
#![cfg_attr(rustfmt, rustfmt_skip)]
511

612
use crate::{

crates/ra_syntax/src/ast/generated.rs.tera

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ the below applies to the result of this template
33
#}// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run
44
// Do not edit manually
55

6+
//! This module contains auto-generated Rust AST. Like `SyntaxNode`s, AST nodes
7+
//! are generic over ownership: `X<'a>` things are `Copy` references, `XNode`
8+
//! are Arc-based. You can switch between the two variants using `.owned` and
9+
//! `.borrowed` functions. Most of the code works with borowed mode, and only
10+
//! this mode has all AST accessors.
11+
612
#![cfg_attr(rustfmt, rustfmt_skip)]
713

814
use crate::{

crates/ra_syntax/src/ast/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ use crate::{
1212
SyntaxNodeRef,
1313
};
1414

15+
/// The main trait to go from untyped `SyntaxNode` to a typed ast. The
16+
/// conversion itself has zero runtime cost: ast and syntax nodes have exactly
17+
/// the same representation: a pointer to the tree root and a pointer to the
18+
/// node itself.
1519
pub trait AstNode<'a>: Clone + Copy + 'a {
1620
fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self>
1721
where

0 commit comments

Comments
 (0)