aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-12-04 16:20:04 +0000
committerGitHub <[email protected]>2019-12-04 16:20:04 +0000
commit1fe0b8c03fa613262afd2d612c55cc3a11249c7e (patch)
tree777c2c7f5883ddafc00031871d6db3ae1f30820f
parent035419a504b85cad849f336c4a6346af989a57dd (diff)
parent193b1a7437c97064a51f0c30a175665b5d6c9895 (diff)
Merge #2476
2476: :arrow_up: rowan r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r--Cargo.lock6
-rw-r--r--Cargo.toml1
-rw-r--r--crates/ra_syntax/Cargo.toml2
-rw-r--r--crates/ra_syntax/src/algo.rs12
-rw-r--r--crates/ra_syntax/src/syntax_node.rs2
5 files changed, 12 insertions, 11 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 23c9e2543..2cb9ae76d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1121,7 +1121,7 @@ dependencies = [
1121 "once_cell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 1121 "once_cell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
1122 "ra_parser 0.1.0", 1122 "ra_parser 0.1.0",
1123 "ra_text_edit 0.1.0", 1123 "ra_text_edit 0.1.0",
1124 "rowan 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", 1124 "rowan 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
1125 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 1125 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
1126 "rustc_lexer 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 1126 "rustc_lexer 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
1127 "smol_str 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", 1127 "smol_str 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1386,7 +1386,7 @@ dependencies = [
1386 1386
1387[[package]] 1387[[package]]
1388name = "rowan" 1388name = "rowan"
1389version = "0.7.1" 1389version = "0.8.0"
1390source = "registry+https://github.com/rust-lang/crates.io-index" 1390source = "registry+https://github.com/rust-lang/crates.io-index"
1391dependencies = [ 1391dependencies = [
1392 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 1392 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1903,7 +1903,7 @@ dependencies = [
1903"checksum relative-path 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bedde000f40f2921ce439ea165c9c53fd629bfa115140c72e22aceacb4a21954" 1903"checksum relative-path 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bedde000f40f2921ce439ea165c9c53fd629bfa115140c72e22aceacb4a21954"
1904"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" 1904"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e"
1905"checksum ron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2ece421e0c4129b90e4a35b6f625e472e96c552136f5093a2f4fa2bbb75a62d5" 1905"checksum ron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2ece421e0c4129b90e4a35b6f625e472e96c552136f5093a2f4fa2bbb75a62d5"
1906"checksum rowan 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ca620bbf9c48c92b5cef19f96354a309ac36b7d8ef7c591e66117335c8b1988b" 1906"checksum rowan 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2662e5d6084ef5367e7410e730b4ad7393ccfaa57974e9734c73e1669db935c0"
1907"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" 1907"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
1908"checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" 1908"checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8"
1909"checksum rustc_lexer 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c86aae0c77166108c01305ee1a36a1e77289d7dc6ca0a3cd91ff4992de2d16a5" 1909"checksum rustc_lexer 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c86aae0c77166108c01305ee1a36a1e77289d7dc6ca0a3cd91ff4992de2d16a5"
diff --git a/Cargo.toml b/Cargo.toml
index 92e3228f0..97508c57b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,3 +11,4 @@ incremental = true
11debug = 0 # set this to 1 or 2 to get more useful backtraces in debugger 11debug = 0 # set this to 1 or 2 to get more useful backtraces in debugger
12 12
13[patch.'crates-io'] 13[patch.'crates-io']
14# rowan = { path = "../rowan" } \ No newline at end of file
diff --git a/crates/ra_syntax/Cargo.toml b/crates/ra_syntax/Cargo.toml
index 5db2b58c0..1c0b184e1 100644
--- a/crates/ra_syntax/Cargo.toml
+++ b/crates/ra_syntax/Cargo.toml
@@ -12,7 +12,7 @@ doctest = false
12 12
13[dependencies] 13[dependencies]
14itertools = "0.8.0" 14itertools = "0.8.0"
15rowan = "0.7.0" 15rowan = "0.8.0"
16rustc_lexer = "0.1.0" 16rustc_lexer = "0.1.0"
17rustc-hash = "1.0.1" 17rustc-hash = "1.0.1"
18arrayvec = "0.5.1" 18arrayvec = "0.5.1"
diff --git a/crates/ra_syntax/src/algo.rs b/crates/ra_syntax/src/algo.rs
index 1c075082a..e4061e994 100644
--- a/crates/ra_syntax/src/algo.rs
+++ b/crates/ra_syntax/src/algo.rs
@@ -140,13 +140,13 @@ pub fn insert_children(
140 }); 140 });
141 141
142 let new_children = match &position { 142 let new_children = match &position {
143 InsertPosition::First => to_insert.chain(old_children).collect::<Box<[_]>>(), 143 InsertPosition::First => to_insert.chain(old_children).collect::<Vec<_>>(),
144 InsertPosition::Last => old_children.chain(to_insert).collect::<Box<[_]>>(), 144 InsertPosition::Last => old_children.chain(to_insert).collect::<Vec<_>>(),
145 InsertPosition::Before(anchor) | InsertPosition::After(anchor) => { 145 InsertPosition::Before(anchor) | InsertPosition::After(anchor) => {
146 let take_anchor = if let InsertPosition::After(_) = position { 1 } else { 0 }; 146 let take_anchor = if let InsertPosition::After(_) = position { 1 } else { 0 };
147 let split_at = position_of_child(parent, anchor.clone()) + take_anchor; 147 let split_at = position_of_child(parent, anchor.clone()) + take_anchor;
148 let before = old_children.by_ref().take(split_at).collect::<Vec<_>>(); 148 let before = old_children.by_ref().take(split_at).collect::<Vec<_>>();
149 before.into_iter().chain(to_insert).chain(old_children).collect::<Box<[_]>>() 149 before.into_iter().chain(to_insert).chain(old_children).collect::<Vec<_>>()
150 } 150 }
151 }; 151 };
152 152
@@ -174,7 +174,7 @@ pub fn replace_children(
174 .into_iter() 174 .into_iter()
175 .chain(to_insert.map(to_green_element)) 175 .chain(to_insert.map(to_green_element))
176 .chain(old_children.skip(end + 1 - start)) 176 .chain(old_children.skip(end + 1 - start))
177 .collect::<Box<[_]>>(); 177 .collect::<Vec<_>>();
178 with_children(parent, new_children) 178 with_children(parent, new_children)
179} 179}
180 180
@@ -187,7 +187,7 @@ pub fn replace_descendants(
187 map: &FxHashMap<SyntaxElement, SyntaxElement>, 187 map: &FxHashMap<SyntaxElement, SyntaxElement>,
188) -> SyntaxNode { 188) -> SyntaxNode {
189 // FIXME: this could be made much faster. 189 // FIXME: this could be made much faster.
190 let new_children = parent.children_with_tokens().map(|it| go(map, it)).collect::<Box<[_]>>(); 190 let new_children = parent.children_with_tokens().map(|it| go(map, it)).collect::<Vec<_>>();
191 return with_children(parent, new_children); 191 return with_children(parent, new_children);
192 192
193 fn go( 193 fn go(
@@ -211,7 +211,7 @@ pub fn replace_descendants(
211 211
212fn with_children( 212fn with_children(
213 parent: &SyntaxNode, 213 parent: &SyntaxNode,
214 new_children: Box<[NodeOrToken<rowan::GreenNode, rowan::GreenToken>]>, 214 new_children: Vec<NodeOrToken<rowan::GreenNode, rowan::GreenToken>>,
215) -> SyntaxNode { 215) -> SyntaxNode {
216 let len = new_children.iter().map(|it| it.text_len()).sum::<TextUnit>(); 216 let len = new_children.iter().map(|it| it.text_len()).sum::<TextUnit>();
217 let new_node = 217 let new_node =
diff --git a/crates/ra_syntax/src/syntax_node.rs b/crates/ra_syntax/src/syntax_node.rs
index b2f5b8c64..041c6ea8d 100644
--- a/crates/ra_syntax/src/syntax_node.rs
+++ b/crates/ra_syntax/src/syntax_node.rs
@@ -40,7 +40,7 @@ pub use rowan::{Direction, NodeOrToken};
40 40
41pub struct SyntaxTreeBuilder { 41pub struct SyntaxTreeBuilder {
42 errors: Vec<SyntaxError>, 42 errors: Vec<SyntaxError>,
43 inner: GreenNodeBuilder, 43 inner: GreenNodeBuilder<'static>,
44} 44}
45 45
46impl Default for SyntaxTreeBuilder { 46impl Default for SyntaxTreeBuilder {