From 3e0f336c441fe6f8994dce7a1893014a20023e19 Mon Sep 17 00:00:00 2001 From: Josh Goebel Date: Sun, 22 May 2022 00:03:24 -0400 Subject: [PATCH 1/2] fix(rust) highlight types immediately preceeding `::` Resolves #3539. --- src/languages/rust.js | 3 ++- test/markup/rust/types.expect.txt | 3 +++ test/markup/rust/types.txt | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/languages/rust.js b/src/languages/rust.js index 005d2da72a..89c9b1a55c 100644 --- a/src/languages/rust.js +++ b/src/languages/rust.js @@ -288,7 +288,8 @@ export default function(hljs) { begin: hljs.IDENT_RE + '::', keywords: { keyword: "Self", - built_in: BUILTINS + built_in: BUILTINS, + type: TYPES } }, { diff --git a/test/markup/rust/types.expect.txt b/test/markup/rust/types.expect.txt index a84825dff2..185c8f1d92 100644 --- a/test/markup/rust/types.expect.txt +++ b/test/markup/rust/types.expect.txt @@ -2,3 +2,6 @@ type A; type A = B; type R<T> = m::R<T, ConcreteError> + +let vec: Vec<isize> = Vec::new(); +if 100 > i32::MAX {} diff --git a/test/markup/rust/types.txt b/test/markup/rust/types.txt index b8644e4983..c8c5c3749a 100644 --- a/test/markup/rust/types.txt +++ b/test/markup/rust/types.txt @@ -2,3 +2,6 @@ type A: Trait; type A; type A = B; type R = m::R + +let vec: Vec = Vec::new(); +if 100 > i32::MAX {} From 7b9dc7cf201f54b2ef6e37962a701b4887c84ef3 Mon Sep 17 00:00:00 2001 From: Josh Goebel Date: Sun, 22 May 2022 00:07:07 -0400 Subject: [PATCH 2/2] pr # --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 59a3764321..f68cfa0d92 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ Grammars: +- fix(rust) highlight types immediately preceeding `::` (#3540) [Josh Goebel][] - enh(swift) add SE-0335 existential `any` keyword (#3515) [Bradley Mackey][] - enh(swift) add support for `distributed` keyword [Marcus Ortiz][] - enh(xml) recognize Unicode letters instead of only ASCII letters in XML element and attribute names (#3256)[Martin Honnen][]