-
Notifications
You must be signed in to change notification settings - Fork 1.9k
internal: Borrow text of immutable syntax node #8280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Replaced pub enum TokenText<'a> {
Borrowed(&'a str),
Owned(GreenToken)
}Though, it does not implement ToOwned. The draft is waiting for: |
47473f5 to
eafef03
Compare
|
would be interesting to get some benchmakrs here. You can run |
|
With |
|
LGTM, @iDawer can you rebase? bors d+ |
|
✌️ iDawer can now approve this pull request. To approve and merge a pull request, simply reply with |
|
Hmm, version 0.13.0-pre.5 introduced breaking change in "pre" version, is it ok? |
|
Breaking changes in pre version are OK -- that's exactly what makes pre versions useful! |
f316163 to
6ad368e
Compare
|
I left rowan version pinned bors r+ |
935a1bb to
90a5dca
Compare
|
bors r+ |
|
bors retry |
In rust-analyzer/rowan#101
rowan::SyntaxNode::greenreturnsCow<'_, GreenNodeData>. It returns borrow of green node of immutable syntax tree node.Using this we can return borrowed text from
ast::Name::text.However now it allocates in case of mutable syntax trees.(see next comment)The idea comes from rust-analyzer/rowan#100 (comment)