@@ -1284,12 +1284,46 @@ list of substrings of `STR' each followed by its face."
1284
1284
'(" fn" font-lock-keyword-face
1285
1285
" foo_Bar" font-lock-function-name-face )))
1286
1286
1287
+ (ert-deftest font-lock-let-bindings ()
1288
+ (rust-test-font-lock
1289
+ " let foo;"
1290
+ '(" let" font-lock-keyword-face
1291
+ " foo" font-lock-variable-name-face ))
1292
+ (rust-test-font-lock
1293
+ " let mut foo;"
1294
+ '(" let" font-lock-keyword-face
1295
+ " mut" font-lock-keyword-face
1296
+ " foo" font-lock-variable-name-face ))
1297
+ (rust-test-font-lock
1298
+ " let foo = 1;"
1299
+ '(" let" font-lock-keyword-face
1300
+ " foo" font-lock-variable-name-face ))
1301
+ (rust-test-font-lock
1302
+ " let mut foo = 1;"
1303
+ '(" let" font-lock-keyword-face
1304
+ " mut" font-lock-keyword-face
1305
+ " foo" font-lock-variable-name-face ))
1306
+ (rust-test-font-lock
1307
+ " fn foo() { let bar = 1; }"
1308
+ '(" fn" font-lock-keyword-face
1309
+ " foo" font-lock-function-name-face
1310
+ " let" font-lock-keyword-face
1311
+ " bar" font-lock-variable-name-face ))
1312
+ (rust-test-font-lock
1313
+ " fn foo() { let mut bar = 1; }"
1314
+ '(" fn" font-lock-keyword-face
1315
+ " foo" font-lock-function-name-face
1316
+ " let" font-lock-keyword-face
1317
+ " mut" font-lock-keyword-face
1318
+ " bar" font-lock-variable-name-face )))
1319
+
1287
1320
(ert-deftest font-lock-single-quote-character-literal ()
1288
1321
(rust-test-font-lock
1289
1322
" fn main() { let ch = '\\ ''; }"
1290
1323
'(" fn" font-lock-keyword-face
1291
1324
" main" font-lock-function-name-face
1292
1325
" let" font-lock-keyword-face
1326
+ " ch" font-lock-variable-name-face
1293
1327
" '\\ ''" font-lock-string-face )))
1294
1328
1295
1329
(ert-deftest font-lock-escaped-double-quote-character-literal ()
@@ -1298,6 +1332,7 @@ list of substrings of `STR' each followed by its face."
1298
1332
'(" fn" font-lock-keyword-face
1299
1333
" main" font-lock-function-name-face
1300
1334
" let" font-lock-keyword-face
1335
+ " ch" font-lock-variable-name-face
1301
1336
" '\\ \" '" font-lock-string-face )))
1302
1337
1303
1338
(ert-deftest font-lock-escaped-backslash-character-literal ()
@@ -1306,18 +1341,21 @@ list of substrings of `STR' each followed by its face."
1306
1341
'(" fn" font-lock-keyword-face
1307
1342
" main" font-lock-function-name-face
1308
1343
" let" font-lock-keyword-face
1344
+ " ch" font-lock-variable-name-face
1309
1345
" '\\\\ '" font-lock-string-face )))
1310
1346
1311
1347
(ert-deftest font-lock-hex-escape-character-literal ()
1312
1348
(rust-test-font-lock
1313
1349
" let ch = '\\ x1f';"
1314
1350
'(" let" font-lock-keyword-face
1351
+ " ch" font-lock-variable-name-face
1315
1352
" '\\ x1f'" font-lock-string-face )))
1316
1353
1317
1354
(ert-deftest font-lock-unicode-escape-character-literal ()
1318
1355
(rust-test-font-lock
1319
1356
" let ch = '\\ u{1ffff}';"
1320
1357
'(" let" font-lock-keyword-face
1358
+ " ch" font-lock-variable-name-face
1321
1359
" '\\ u{1ffff}'" font-lock-string-face )))
1322
1360
1323
1361
(ert-deftest font-lock-raw-strings-no-hashes ()
@@ -1583,6 +1621,7 @@ this_is_not_a_string();)"
1583
1621
(rust-test-font-lock
1584
1622
" let default = 7; impl foo { default fn f() { } }"
1585
1623
'(" let" font-lock-keyword-face
1624
+ " default" font-lock-variable-name-face
1586
1625
" impl" font-lock-keyword-face
1587
1626
" default" font-lock-keyword-face
1588
1627
" fn" font-lock-keyword-face
@@ -1592,7 +1631,8 @@ this_is_not_a_string();)"
1592
1631
(rust-test-font-lock
1593
1632
" let union = 7; union foo { x: &'union bar }"
1594
1633
'(" let" font-lock-keyword-face
1595
- ; ; Ignore the first union, it's an unhighlighted variable.
1634
+ ; ; The first union is a variable name.
1635
+ " union" font-lock-variable-name-face
1596
1636
; ; The second union is a contextual keyword.
1597
1637
" union" font-lock-keyword-face
1598
1638
" foo" font-lock-type-face
0 commit comments