Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions RustEnhanced.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ contexts:

- include: raw-pointer

# `const` in a function header has a different scope from `const` values.
- match: '\b(const)\s+(?=unsafe|extern|fn)'
captures:
1: storage.modifier.rust

- match: '\b(const)\s+({{identifier}})'
captures:
1: storage.type.rust
Expand Down
18 changes: 18 additions & 0 deletions tests/syntax-rust/syntax_test_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,21 @@ fn f(self,
// ^ punctuation.section.brackets.end
// ^ punctuation.separator
{}

const fn f() {}
// <- storage.modifier
// ^^ meta.function storage.type.function
// ^ meta.function entity.name.function

const unsafe fn f() {}
// <- storage.modifier
// ^^^^^^ storage.modifier
// ^^ meta.function storage.type.function
// ^ meta.function entity.name.function

const extern "C" fn f() {}
// <- storage.modifier
// ^^^^^^ keyword.other
// ^^^ string.quoted.double
// ^^ meta.function storage.type.function
// ^ meta.function entity.name.function