5643: Add new consuming modifier, apply consuming and mutable to methods r=matklad a=Nashenas88

This adds a new `consuming` semantic modifier for syntax highlighters.

This also emits `mutable` and `consuming` in two cases:

- When a method takes `&mut self`, then it now has `function.mutable` emitted.
- When a method takes `self`, and the type of `Self` is not `Copy`, then `function.consuming` is emitted.

CC @flodiebold 

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
This commit is contained in:
bors[bot] 2020-08-19 11:27:02 +00:00 committed by GitHub
commit 529ca7e5e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 220 additions and 49 deletions

View file

@ -75,6 +75,7 @@ define_semantic_token_modifiers![
(CONTROL_FLOW, "controlFlow"),
(INJECTED, "injected"),
(MUTABLE, "mutable"),
(CONSUMING, "consuming"),
(UNSAFE, "unsafe"),
(ATTRIBUTE_MODIFIER, "attribute"),
];

View file

@ -400,6 +400,7 @@ fn semantic_token_type_and_modifiers(
HighlightModifier::Injected => semantic_tokens::INJECTED,
HighlightModifier::ControlFlow => semantic_tokens::CONTROL_FLOW,
HighlightModifier::Mutable => semantic_tokens::MUTABLE,
HighlightModifier::Consuming => semantic_tokens::CONSUMING,
HighlightModifier::Unsafe => semantic_tokens::UNSAFE,
};
mods |= modifier;