@@ -1442,3 +1442,47 @@ struct S (
1442
1442
// ^ meta.struct punctuation.definition.group.end
1443
1443
// ^^^ meta.struct storage.type
1444
1444
) ;
1445
+
1446
+ // dyn trait
1447
+ fn f( x: dyn T , y: Box <dyn T + ' static >, z: & dyn T ,
1448
+ // ^^^ meta.function.parameters storage.type.trait
1449
+ // ^^^ meta.function.parameters meta.generic storage.type.trait
1450
+ // ^^^ meta.function.parameters storage.type.trait
1451
+ f: & dyn Fn ( CrateNum ) -> bool ) -> dyn T {
1452
+ // ^^^ meta.function.parameters storage.type.trait
1453
+ // ^^^ meta.function.return-type storage.type.trait
1454
+ let x: & ( dyn ' static + Display ) = & BYTE ;
1455
+ // ^^^ meta.group storage.type.trait
1456
+ let y: Box <dyn Display + ' static > = Box :: new( BYTE ) ;
1457
+ // ^^^ meta.generic storage.type.trait
1458
+ let _: & dyn ( Display ) = & BYTE ;
1459
+ // ^^^ storage.type.trait
1460
+ let _: & dyn ( :: std:: fmt:: Display ) = & BYTE ;
1461
+ // ^^^ storage.type.trait
1462
+ const DT : & ' static dyn C = & V ;
1463
+ // ^^^ storage.type.trait
1464
+ struct S {
1465
+ f: dyn T
1466
+ // ^^^ meta.struct storage.type.trait
1467
+ }
1468
+ type D4 = dyn ( :: module:: Trait ) ;
1469
+ // ^^^ storage.type.trait
1470
+ }
1471
+
1472
+ // dyn is not a keyword in all situations (a "weak" keyword).
1473
+ type A0 = dyn;
1474
+ // ^^^ -storage.type.trait
1475
+ type A1 = dyn:: dyn;
1476
+ // ^^^^^ meta.path -storage.type.trait
1477
+ // ^^^ -storage.type.trait
1478
+ type A2 = dyn<dyn, dyn>;
1479
+ // ^^^ meta.generic -storage.type.trait
1480
+ // ^^^ meta.generic -storage.type.trait
1481
+ // ^^^ meta.generic -storage.type.trait
1482
+ // This is incorrect. `identifier` should not match on the keyword `as`.
1483
+ // However, avoiding keywords is a little complicated and slow.
1484
+ type A3 = dyn<<dyn as dyn>:: dyn>;
1485
+ // ^^^ meta.generic -storage.type.trait
1486
+ // ^^^ meta.generic storage.type.trait
1487
+ // ^^^ meta.generic -storage.type.trait
1488
+ // ^^^ meta.generic -storage.type.trait
0 commit comments