diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-15 11:00:10 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-15 11:00:10 +0100 |
commit | 6f3c8dc11d477a6d680ce018e93f007c31499bd5 (patch) | |
tree | ca759aa18be3bb4d30e42ae6e11e14dd673bfe1f /crates/ra_ide/test_data/highlighting.html | |
parent | b8b41c5f41a0cf8bf9c15a3bbcdd8d626eb41772 (diff) | |
parent | 91b35d882776d7ae8891b3aecf9879164ef183b5 (diff) |
Merge #5345
5345: Semantic Highlighting: Emit mutable modifier for 'self' when applicable r=matklad a=Veykril
This PR implements emitting the mutable modifier for the self keyword when applicable for semantic highlighting as mentioned in #5041. The rendered highlighting test html file:

As you can see it does not emit the modifier when `self` is not used in a mutable context even if it is declared mutably in the enclosing function. I'm not sure if this is actually something wanted or not.
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/ra_ide/test_data/highlighting.html')
-rw-r--r-- | crates/ra_ide/test_data/highlighting.html | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/ra_ide/test_data/highlighting.html b/crates/ra_ide/test_data/highlighting.html index 134743c72..553811a2f 100644 --- a/crates/ra_ide/test_data/highlighting.html +++ b/crates/ra_ide/test_data/highlighting.html | |||
@@ -51,6 +51,16 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
51 | } | 51 | } |
52 | } | 52 | } |
53 | 53 | ||
54 | <span class="keyword">impl</span> <span class="struct">Foo</span> { | ||
55 | <span class="keyword">fn</span> <span class="function declaration">baz</span>(<span class="keyword">mut</span> <span class="self_keyword mutable">self</span>) -> <span class="builtin_type">i32</span> { | ||
56 | <span class="self_keyword">self</span>.<span class="field">x</span> | ||
57 | } | ||
58 | |||
59 | <span class="keyword">fn</span> <span class="function declaration">qux</span>(&<span class="keyword">mut</span> <span class="self_keyword mutable">self</span>) { | ||
60 | <span class="self_keyword mutable">self</span>.<span class="field">x</span> = <span class="numeric_literal">0</span>; | ||
61 | } | ||
62 | } | ||
63 | |||
54 | <span class="keyword">static</span> <span class="keyword">mut</span> <span class="static declaration mutable">STATIC_MUT</span>: <span class="builtin_type">i32</span> = <span class="numeric_literal">0</span>; | 64 | <span class="keyword">static</span> <span class="keyword">mut</span> <span class="static declaration mutable">STATIC_MUT</span>: <span class="builtin_type">i32</span> = <span class="numeric_literal">0</span>; |
55 | 65 | ||
56 | <span class="keyword">fn</span> <span class="function declaration">foo</span><<span class="lifetime declaration">'a</span>, <span class="type_param declaration">T</span>>() -> <span class="type_param">T</span> { | 66 | <span class="keyword">fn</span> <span class="function declaration">foo</span><<span class="lifetime declaration">'a</span>, <span class="type_param declaration">T</span>>() -> <span class="type_param">T</span> { |