mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-10 15:14:32 +00:00
⬆️ rowan
This commit is contained in:
parent
02edb4b31b
commit
cd21b0e9c1
5 changed files with 11 additions and 36 deletions
34
Cargo.lock
generated
34
Cargo.lock
generated
|
@ -323,7 +323,7 @@ dependencies = [
|
||||||
"const_fn",
|
"const_fn",
|
||||||
"crossbeam-utils 0.8.1",
|
"crossbeam-utils 0.8.1",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"memoffset 0.6.1",
|
"memoffset",
|
||||||
"scopeguard",
|
"scopeguard",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -940,15 +940,6 @@ dependencies = [
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "memoffset"
|
|
||||||
version = "0.5.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa"
|
|
||||||
dependencies = [
|
|
||||||
"autocfg",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memoffset"
|
name = "memoffset"
|
||||||
version = "0.6.1"
|
version = "0.6.1"
|
||||||
|
@ -1384,15 +1375,15 @@ checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rowan"
|
name = "rowan"
|
||||||
version = "0.10.6"
|
version = "0.11.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8a0734142c18710f7214dc21908e2f054e973b908dbb1a602a3e6691615aaaae"
|
checksum = "b3ae0ae5091cf38acfb834dbb6adcd45bb0d6b6a72ca5798e134195d2fa33574"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
|
"memoffset",
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
"smol_str",
|
"smol_str",
|
||||||
"text-size",
|
"text-size",
|
||||||
"triomphe",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1638,12 +1629,6 @@ dependencies = [
|
||||||
"text_edit",
|
"text_edit",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "stable_deref_trait"
|
|
||||||
version = "1.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "stdx"
|
name = "stdx"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
|
@ -1871,17 +1856,6 @@ dependencies = [
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "triomphe"
|
|
||||||
version = "0.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6e9d872053cf9e5a833d8c1dd772cdc38ab66a908129d6f73c049c986161d07c"
|
|
||||||
dependencies = [
|
|
||||||
"memoffset 0.5.6",
|
|
||||||
"serde",
|
|
||||||
"stable_deref_trait",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tt"
|
name = "tt"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
|
|
|
@ -173,7 +173,7 @@ fn macro_arg_text(db: &dyn AstDatabase, id: MacroCallId) -> Option<GreenNode> {
|
||||||
};
|
};
|
||||||
let loc = db.lookup_intern_macro(id);
|
let loc = db.lookup_intern_macro(id);
|
||||||
let arg = loc.kind.arg(db)?;
|
let arg = loc.kind.arg(db)?;
|
||||||
Some(arg.green().clone())
|
Some(arg.green().to_owned())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn macro_arg(db: &dyn AstDatabase, id: MacroCallId) -> Option<Arc<(tt::Subtree, mbe::TokenMap)>> {
|
fn macro_arg(db: &dyn AstDatabase, id: MacroCallId) -> Option<Arc<(tt::Subtree, mbe::TokenMap)>> {
|
||||||
|
|
|
@ -12,7 +12,7 @@ doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
itertools = "0.10.0"
|
itertools = "0.10.0"
|
||||||
rowan = "0.10.3"
|
rowan = "0.11"
|
||||||
rustc_lexer = { version = "697.0.0", package = "rustc-ap-rustc_lexer" }
|
rustc_lexer = { version = "697.0.0", package = "rustc-ap-rustc_lexer" }
|
||||||
rustc-hash = "1.1.0"
|
rustc-hash = "1.1.0"
|
||||||
arrayvec = "0.5.1"
|
arrayvec = "0.5.1"
|
||||||
|
|
|
@ -4,6 +4,7 @@ use std::{
|
||||||
fmt,
|
fmt,
|
||||||
hash::BuildHasherDefault,
|
hash::BuildHasherDefault,
|
||||||
ops::{self, RangeInclusive},
|
ops::{self, RangeInclusive},
|
||||||
|
ptr,
|
||||||
};
|
};
|
||||||
|
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
|
@ -171,7 +172,7 @@ pub fn diff(from: &SyntaxNode, to: &SyntaxNode) -> TreeDiff {
|
||||||
&& lhs.text_range().len() == rhs.text_range().len()
|
&& lhs.text_range().len() == rhs.text_range().len()
|
||||||
&& match (&lhs, &rhs) {
|
&& match (&lhs, &rhs) {
|
||||||
(NodeOrToken::Node(lhs), NodeOrToken::Node(rhs)) => {
|
(NodeOrToken::Node(lhs), NodeOrToken::Node(rhs)) => {
|
||||||
lhs.green() == rhs.green() || lhs.text() == rhs.text()
|
ptr::eq(lhs.green(), rhs.green()) || lhs.text() == rhs.text()
|
||||||
}
|
}
|
||||||
(NodeOrToken::Token(lhs), NodeOrToken::Token(rhs)) => lhs.text() == rhs.text(),
|
(NodeOrToken::Token(lhs), NodeOrToken::Token(rhs)) => lhs.text() == rhs.text(),
|
||||||
_ => false,
|
_ => false,
|
||||||
|
@ -566,7 +567,7 @@ impl<'a> SyntaxRewriter<'a> {
|
||||||
|
|
||||||
fn element_to_green(element: SyntaxElement) -> NodeOrToken<rowan::GreenNode, rowan::GreenToken> {
|
fn element_to_green(element: SyntaxElement) -> NodeOrToken<rowan::GreenNode, rowan::GreenToken> {
|
||||||
match element {
|
match element {
|
||||||
NodeOrToken::Node(it) => NodeOrToken::Node(it.green().clone()),
|
NodeOrToken::Node(it) => NodeOrToken::Node(it.green().to_owned()),
|
||||||
NodeOrToken::Token(it) => NodeOrToken::Token(it.green().clone()),
|
NodeOrToken::Token(it) => NodeOrToken::Token(it.green().clone()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -624,7 +625,7 @@ fn position_of_child(parent: &SyntaxNode, child: SyntaxElement) -> usize {
|
||||||
|
|
||||||
fn to_green_element(element: SyntaxElement) -> NodeOrToken<rowan::GreenNode, rowan::GreenToken> {
|
fn to_green_element(element: SyntaxElement) -> NodeOrToken<rowan::GreenNode, rowan::GreenToken> {
|
||||||
match element {
|
match element {
|
||||||
NodeOrToken::Node(it) => it.green().clone().into(),
|
NodeOrToken::Node(it) => it.green().to_owned().into(),
|
||||||
NodeOrToken::Token(it) => it.green().clone().into(),
|
NodeOrToken::Token(it) => it.green().clone().into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -478,7 +478,7 @@ fn ast_from_text<N: AstNode>(text: &str) -> N {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn unroot(n: SyntaxNode) -> SyntaxNode {
|
fn unroot(n: SyntaxNode) -> SyntaxNode {
|
||||||
SyntaxNode::new_root(n.green().clone())
|
SyntaxNode::new_root(n.green().to_owned())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod tokens {
|
pub mod tokens {
|
||||||
|
|
Loading…
Reference in a new issue