diff options
| -rw-r--r-- | rust-mode-tests.el | 9 | ||||
| -rw-r--r-- | rust-mode.el | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/rust-mode-tests.el b/rust-mode-tests.el index 5abd4a7..6d58906 100644 --- a/rust-mode-tests.el +++ b/rust-mode-tests.el @@ -1510,6 +1510,15 @@ this_is_not_a_string();)" ;; Only the i32 should have been highlighted. '("i32" font-lock-type-face))) +(ert-deftest rust-test-default-context-sensitive () + (rust-test-font-lock + "let default = 7; impl foo { default fn f() { } }" + '("let" font-lock-keyword-face + "impl" font-lock-keyword-face + "default" font-lock-keyword-face + "fn" font-lock-keyword-face + "f" font-lock-function-name-face))) + (ert-deftest indent-method-chains-no-align () (let ((rust-indent-method-chain nil)) (test-indent " diff --git a/rust-mode.el b/rust-mode.el index f1c3994..9f9e391 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -526,6 +526,7 @@ buffer." (defun rust-re-item-def-imenu (itype) (concat "^[[:space:]]*" (rust-re-shy (concat (rust-re-word rust-re-vis) "[[:space:]]+")) "?" + (rust-re-shy (concat (rust-re-word "default") "[[:space:]]+")) "?" (rust-re-shy (concat (rust-re-word rust-re-unsafe) "[[:space:]]+")) "?" (rust-re-shy (concat (rust-re-word rust-re-extern) "[[:space:]]+" (rust-re-shy "\"[^\"]+\"[[:space:]]+") "?")) "?" @@ -555,6 +556,7 @@ the desired identifiers), but does not match type annotations \"foo::<\"." (append `( ;; Keywords proper + ("\\_<\\(default\\)[[:space:]]+fn\\_>" 1 font-lock-keyword-face) (,(regexp-opt rust-mode-keywords 'symbols) . font-lock-keyword-face) ;; Special types |
