Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 30dc8af

Browse files
bors[bot]ehuss
andcommittedFeb 5, 2019
Merge #367 #369 #370
367: Syntax: Add `literal` fragment macro matcher. r=ehuss a=ehuss 369: Syntax: Abort on invalid struct syntax. r=ehuss a=ehuss This helps with macros which use funky syntax. 370: Tests: Update minor wording change 1.34 r=ehuss a=ehuss Co-authored-by: Eric Huss <[email protected]>
4 parents 1fb301b + aac62d9 + a4517ae + 3841af8 commit 30dc8af

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed
 

‎RustEnhanced.sublime-syntax

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,9 @@ contexts:
611611
- match: '\{'
612612
scope: punctuation.definition.block.begin.rust
613613
push: struct-classic-body
614+
- match: '(?=\S)'
615+
# Abort for an invalid match.
616+
pop: true
614617

615618
struct-classic-body:
616619
- meta_scope: meta.block.rust
@@ -628,7 +631,9 @@ contexts:
628631
- match: ':'
629632
scope: punctuation.separator.rust
630633
- include: type-any-identifier
631-
634+
- match: '(?=\S)'
635+
# Abort for an invalid match.
636+
pop: true
632637

633638
union-identifier:
634639
- meta_scope: meta.union.rust
@@ -818,7 +823,7 @@ contexts:
818823
pop: true
819824
- include: macro-matchers
820825

821-
- match: '(\$\s*{{identifier}})\s*(:)\s*(ident|path|expr|ty|pat|stmt|block|item|meta|tt|lifetime|vis)'
826+
- match: '(\$\s*{{identifier}})\s*(:)\s*(ident|path|expr|ty|pat|stmt|block|item|meta|tt|lifetime|vis|literal)'
822827
captures:
823828
1: variable.parameter.rust
824829
2: punctuation.separator.rust

‎tests/error-tests/tests/test_unicode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ fn main() {
66
// ^^^NOTE(>=1.17.0) #[warn(unused_variables)]
77
// ^^^NOTE(>=1.21.0,<1.22.0) to disable this warning
88
// ^^^NOTE(>=1.22.0,<1.25.0-beta) to avoid this warning
9-
// ^^^HELP(>=1.25.0-beta) consider using `_foo` instead
9+
// ^^^HELP(>=1.25.0-beta) consider
1010
// ^^^HELP(>=1.25.0-beta) /Accept Replacement:.*_foo/
1111
}

‎tests/syntax-rust/syntax_test_macros.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ macro_rules! designators {
354354
$v:vis,
355355
// ^^ variable.parameter
356356
// ^^^ storage.type
357+
$l:literal,
358+
// ^^ variable.parameter
359+
// ^^^^^^^ storage.type
357360
) => ();
358361
// And various tokens
359362
("Any token" /*comment*/ true => 3.14 'life 'c' @ struct self) => ();

0 commit comments

Comments
 (0)
Please sign in to comment.