mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Use boxed sliced for red nodes
This commit is contained in:
parent
beaddb4780
commit
6fc66c4ee6
@ -150,6 +150,5 @@ Grammar(
|
||||
"LIFETIME_PARAM",
|
||||
"TYPE_PARAM_LIST",
|
||||
"TYPE_ARG_LIST",
|
||||
|
||||
]
|
||||
)
|
||||
|
@ -5,7 +5,7 @@ use {yellow::GreenNode, TextUnit};
|
||||
pub(crate) struct RedNode {
|
||||
green: GreenNode,
|
||||
parent: Option<ParentData>,
|
||||
children: RwLock<Vec<Option<RedNode>>>,
|
||||
children: RwLock<Box<[Option<RedNode>]>>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -36,7 +36,9 @@ impl RedNode {
|
||||
|
||||
fn new(green: GreenNode, parent: Option<ParentData>) -> RedNode {
|
||||
let n_children = green.children().len();
|
||||
let children = (0..n_children).map(|_| None).collect();
|
||||
let children = (0..n_children).map(|_| None)
|
||||
.collect::<Vec<_>>()
|
||||
.into_boxed_slice();
|
||||
RedNode {
|
||||
green,
|
||||
parent,
|
||||
|
Loading…
Reference in New Issue
Block a user