Skip to content

Commit 5f995e8

Browse files
bors[bot]ehuss
andcommitted
Merge #330
330: Syntax: Fix extern in fn type. r=ehuss a=ehuss <img width="628" alt="image" src="https://user-images.githubusercontent.com/43198/43736545-d666e596-9972-11e8-8306-ed732d8b3fa7.png"> Co-authored-by: Eric Huss <[email protected]>
2 parents bafe869 + 4bd7783 commit 5f995e8

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

RustEnhanced.sublime-syntax

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -446,12 +446,6 @@ contexts:
446446

447447
generic-angles-contents:
448448
- include: comments
449-
- match: \bextern\b
450-
scope: keyword.other.rust
451-
push:
452-
- include: strings
453-
- match: '(?=\S)'
454-
pop: true
455449
- include: type-slice
456450
- match: '(?=>)'
457451
pop: true
@@ -512,6 +506,12 @@ contexts:
512506
scope: punctuation.definition.type.end.rust
513507
pop: true
514508
- include: type-any-identifier
509+
- match: \bextern\b
510+
scope: keyword.other.rust
511+
push:
512+
- include: strings
513+
- match: '(?=\S)'
514+
pop: true
515515
- include: type
516516
- include: type-slice
517517
- match: '\b_\b'

tests/syntax-rust/syntax_test_struct.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,23 @@ struct Val (f64,);
7878
// ^ punctuation.definition.group.end
7979
// ^ punctuation.terminator
8080

81-
// TODO: Fix extern.
8281
struct F {
8382
f: extern "C" fn(x: u8, ... /* comment */),
83+
// ^^^^^^ meta.struct meta.block keyword.other
84+
// ^^^ meta.struct meta.block string.quoted.double
85+
// ^^ meta.struct meta.block storage.type.function
86+
// ^^^^^^^^^^^^^ meta.struct meta.block meta.group comment.block
8487
g: extern "C" fn(x: u8, /* comment */ ...),
88+
// ^^^^^^^^^^^^^ meta.struct meta.block meta.group comment.block
8589
h: extern "C" fn(x: u8, ...),
8690
i: extern "C" fn(
8791
x: u8,
92+
// ^^ meta.struct meta.block meta.group storage.type
8893
// comment 4
94+
// ^^^^^^^^^^^^^ meta.struct meta.block meta.group comment.line.double-slash
8995
y: String, // comment 3
96+
// ^^^^^^^^^^^^^ meta.struct meta.block meta.group comment.line.double-slash
9097
z: Foo,
91-
// comment
92-
... // comment 2
9398
),
9499
}
95100

0 commit comments

Comments
 (0)