branch: elpa/rust-mode
commit 64b4a2450e4d4c47f6307851c9b2598cd2254d68
Merge: 07e16c6 e201404
Author: Niko Matsakis <[email protected]>
Commit: GitHub <[email protected]>
Merge pull request #272 from tromey/let-ref-font-lock
Fix font-locking of "let ref"
---
rust-mode-tests.el | 5 +++++
rust-mode.el | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index 3e6c67a..64d65c4 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -1297,6 +1297,11 @@ list of substrings of `STR' each followed by its face."
'("let" font-lock-keyword-face
"foo" font-lock-variable-name-face))
(rust-test-font-lock
+ "let ref foo;"
+ '("let" font-lock-keyword-face
+ "ref" font-lock-keyword-face
+ "foo" font-lock-variable-name-face))
+ (rust-test-font-lock
"let mut foo;"
'("let" font-lock-keyword-face
"mut" font-lock-keyword-face
diff --git a/rust-mode.el b/rust-mode.el
index 011f615..51b92d7 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -687,7 +687,7 @@ match data if found. Returns nil if not within a Rust
string."
(,rust-re-type-or-constructor 1 font-lock-type-face)
;; Type-inferred binding
- (,(concat "\\_<\\(?:let\\|ref\\)\\s-+\\(?:mut\\s-+\\)?" (rust-re-grab
rust-re-ident) "\\_>") 1 font-lock-variable-name-face)
+ (,(concat "\\_<\\(?:let\\s-+ref\\|let\\|ref\\)\\s-+\\(?:mut\\s-+\\)?"
(rust-re-grab rust-re-ident) "\\_>") 1 font-lock-variable-name-face)
;; Type names like `Foo::`, highlight excluding the ::
(,(rust-path-font-lock-matcher rust-re-uc-ident) 1 font-lock-type-face)