@@ -359,52 +359,52 @@ impl<'a> Error<'a> {
359
359
Error :: Unexpected ( unexpected_span, expected) => {
360
360
let expected_str = match expected {
361
361
ExpectedToken :: Token ( token) => match token {
362
- Token :: Separator ( c) => format ! ( "' {c}' " ) ,
363
- Token :: Paren ( c) => format ! ( "' {c}' " ) ,
362
+ Token :: Separator ( c) => format ! ( "` {c}` " ) ,
363
+ Token :: Paren ( c) => format ! ( "` {c}` " ) ,
364
364
Token :: Attribute => "@" . to_string ( ) ,
365
365
Token :: Number ( _) => "number" . to_string ( ) ,
366
366
Token :: Word ( s) => s. to_string ( ) ,
367
- Token :: Operation ( c) => format ! ( "operation (' {c}' )" ) ,
368
- Token :: LogicalOperation ( c) => format ! ( "logical operation (' {c}' )" ) ,
369
- Token :: ShiftOperation ( c) => format ! ( "bitshift (' {c}{c}' )" ) ,
367
+ Token :: Operation ( c) => format ! ( "operation (` {c}` )" ) ,
368
+ Token :: LogicalOperation ( c) => format ! ( "logical operation (` {c}` )" ) ,
369
+ Token :: ShiftOperation ( c) => format ! ( "bitshift (` {c}{c}` )" ) ,
370
370
Token :: AssignmentOperation ( c) if c == '<' || c == '>' => {
371
- format ! ( "bitshift (' {c}{c}=' )" )
371
+ format ! ( "bitshift (` {c}{c}=` )" )
372
372
}
373
- Token :: AssignmentOperation ( c) => format ! ( "operation (' {c}=' )" ) ,
373
+ Token :: AssignmentOperation ( c) => format ! ( "operation (` {c}=` )" ) ,
374
374
Token :: IncrementOperation => "increment operation" . to_string ( ) ,
375
375
Token :: DecrementOperation => "decrement operation" . to_string ( ) ,
376
376
Token :: Arrow => "->" . to_string ( ) ,
377
- Token :: Unknown ( c) => format ! ( "unknown (' {c}' )" ) ,
377
+ Token :: Unknown ( c) => format ! ( "unknown (` {c}` )" ) ,
378
378
Token :: Trivia => "trivia" . to_string ( ) ,
379
379
Token :: End => "end" . to_string ( ) ,
380
380
} ,
381
381
ExpectedToken :: Identifier => "identifier" . to_string ( ) ,
382
382
ExpectedToken :: PrimaryExpression => "expression" . to_string ( ) ,
383
383
ExpectedToken :: Assignment => "assignment or increment/decrement" . to_string ( ) ,
384
384
ExpectedToken :: SwitchItem => concat ! (
385
- "switch item (' case' or ' default' ) or a closing curly bracket " ,
386
- "to signify the end of the switch statement ('}' )"
385
+ "switch item (` case` or ` default` ) or a closing curly bracket " ,
386
+ "to signify the end of the switch statement (`}` )"
387
387
)
388
388
. to_string ( ) ,
389
389
ExpectedToken :: WorkgroupSizeSeparator => {
390
- "workgroup size separator (',' ) or a closing parenthesis" . to_string ( )
390
+ "workgroup size separator (`,` ) or a closing parenthesis" . to_string ( )
391
391
}
392
392
ExpectedToken :: GlobalItem => concat ! (
393
- "global item (' struct', ' const', ' var', ' alias', 'fn', ' diagnostic', ' enable', ' requires', ';' ) " ,
393
+ "global item (` struct`, ` const`, ` var`, ` alias`, `fn`, ` diagnostic`, ` enable`, ` requires`, `;` ) " ,
394
394
"or the end of the file"
395
395
)
396
396
. to_string ( ) ,
397
397
ExpectedToken :: Type => "type" . to_string ( ) ,
398
398
ExpectedToken :: Variable => "variable access" . to_string ( ) ,
399
399
ExpectedToken :: Function => "function name" . to_string ( ) ,
400
400
ExpectedToken :: AfterIdentListArg => {
401
- "next argument, trailing comma, or end of list (',' or ';' )" . to_string ( )
401
+ "next argument, trailing comma, or end of list (`,` or `;` )" . to_string ( )
402
402
}
403
403
ExpectedToken :: AfterIdentListComma => {
404
- "next argument or end of list (';' )" . to_string ( )
404
+ "next argument or end of list (`;` )" . to_string ( )
405
405
}
406
406
ExpectedToken :: DiagnosticAttribute => {
407
- "the ' diagnostic' attribute identifier" . to_string ( )
407
+ "the ` diagnostic` attribute identifier" . to_string ( )
408
408
}
409
409
} ;
410
410
ParseError {
@@ -445,12 +445,12 @@ impl<'a> Error<'a> {
445
445
notes : vec ! [ ] ,
446
446
} ,
447
447
Error :: UnknownIdent ( ident_span, ident) => ParseError {
448
- message : format ! ( "no definition in scope for identifier: ' {ident}' " ) ,
448
+ message : format ! ( "no definition in scope for identifier: ` {ident}` " ) ,
449
449
labels : vec ! [ ( ident_span, "unknown identifier" . into( ) ) ] ,
450
450
notes : vec ! [ ] ,
451
451
} ,
452
452
Error :: UnknownScalarType ( bad_span) => ParseError {
453
- message : format ! ( "unknown scalar type: '{}' " , & source[ bad_span] ) ,
453
+ message : format ! ( "unknown scalar type: `{}` " , & source[ bad_span] ) ,
454
454
labels : vec ! [ ( bad_span, "unknown scalar type" . into( ) ) ] ,
455
455
notes : vec ! [ "Valid scalar types are f32, f64, i32, u32, bool" . into( ) ] ,
456
456
} ,
@@ -473,7 +473,7 @@ impl<'a> Error<'a> {
473
473
} ,
474
474
Error :: BadTexture ( bad_span) => ParseError {
475
475
message : format ! (
476
- "expected an image, but found '{}' which is not an image" ,
476
+ "expected an image, but found `{}` which is not an image" ,
477
477
& source[ bad_span]
478
478
) ,
479
479
labels : vec ! [ ( bad_span, "not an image" . into( ) ) ] ,
@@ -498,7 +498,7 @@ impl<'a> Error<'a> {
498
498
} ,
499
499
Error :: InvalidForInitializer ( bad_span) => ParseError {
500
500
message : format ! (
501
- "for(;;) initializer is not an assignment or a function call: '{}' " ,
501
+ "for(;;) initializer is not an assignment or a function call: `{}` " ,
502
502
& source[ bad_span]
503
503
) ,
504
504
labels : vec ! [ ( bad_span, "not an assignment or function call" . into( ) ) ] ,
@@ -511,7 +511,7 @@ impl<'a> Error<'a> {
511
511
} ,
512
512
Error :: InvalidGatherComponent ( bad_span) => ParseError {
513
513
message : format ! (
514
- "textureGather component '{}' doesn't exist, must be 0, 1, 2, or 3" ,
514
+ "textureGather component `{}` doesn't exist, must be 0, 1, 2, or 3" ,
515
515
& source[ bad_span]
516
516
) ,
517
517
labels : vec ! [ ( bad_span, "invalid component" . into( ) ) ] ,
@@ -523,58 +523,58 @@ impl<'a> Error<'a> {
523
523
notes : vec ! [ ] ,
524
524
} ,
525
525
Error :: InvalidIdentifierUnderscore ( bad_span) => ParseError {
526
- message : "Identifier can't be '_' " . to_string ( ) ,
526
+ message : "Identifier can't be `_` " . to_string ( ) ,
527
527
labels : vec ! [ ( bad_span, "invalid identifier" . into( ) ) ] ,
528
528
notes : vec ! [
529
- "Use phony assignment instead (' _ =' notice the absence of ' let' or ' var' )"
529
+ "Use phony assignment instead (` _ =` notice the absence of ` let` or ` var` )"
530
530
. to_string( ) ,
531
531
] ,
532
532
} ,
533
533
Error :: ReservedIdentifierPrefix ( bad_span) => ParseError {
534
534
message : format ! (
535
- "Identifier starts with a reserved prefix: '{}' " ,
535
+ "Identifier starts with a reserved prefix: `{}` " ,
536
536
& source[ bad_span]
537
537
) ,
538
538
labels : vec ! [ ( bad_span, "invalid identifier" . into( ) ) ] ,
539
539
notes : vec ! [ ] ,
540
540
} ,
541
541
Error :: UnknownAddressSpace ( bad_span) => ParseError {
542
- message : format ! ( "unknown address space: '{}' " , & source[ bad_span] ) ,
542
+ message : format ! ( "unknown address space: `{}` " , & source[ bad_span] ) ,
543
543
labels : vec ! [ ( bad_span, "unknown address space" . into( ) ) ] ,
544
544
notes : vec ! [ ] ,
545
545
} ,
546
546
Error :: RepeatedAttribute ( bad_span) => ParseError {
547
- message : format ! ( "repeated attribute: '{}' " , & source[ bad_span] ) ,
547
+ message : format ! ( "repeated attribute: `{}` " , & source[ bad_span] ) ,
548
548
labels : vec ! [ ( bad_span, "repeated attribute" . into( ) ) ] ,
549
549
notes : vec ! [ ] ,
550
550
} ,
551
551
Error :: UnknownAttribute ( bad_span) => ParseError {
552
- message : format ! ( "unknown attribute: '{}' " , & source[ bad_span] ) ,
552
+ message : format ! ( "unknown attribute: `{}` " , & source[ bad_span] ) ,
553
553
labels : vec ! [ ( bad_span, "unknown attribute" . into( ) ) ] ,
554
554
notes : vec ! [ ] ,
555
555
} ,
556
556
Error :: UnknownBuiltin ( bad_span) => ParseError {
557
- message : format ! ( "unknown builtin: '{}' " , & source[ bad_span] ) ,
557
+ message : format ! ( "unknown builtin: `{}` " , & source[ bad_span] ) ,
558
558
labels : vec ! [ ( bad_span, "unknown builtin" . into( ) ) ] ,
559
559
notes : vec ! [ ] ,
560
560
} ,
561
561
Error :: UnknownAccess ( bad_span) => ParseError {
562
- message : format ! ( "unknown access: '{}' " , & source[ bad_span] ) ,
562
+ message : format ! ( "unknown access: `{}` " , & source[ bad_span] ) ,
563
563
labels : vec ! [ ( bad_span, "unknown access" . into( ) ) ] ,
564
564
notes : vec ! [ ] ,
565
565
} ,
566
566
Error :: UnknownStorageFormat ( bad_span) => ParseError {
567
- message : format ! ( "unknown storage format: '{}' " , & source[ bad_span] ) ,
567
+ message : format ! ( "unknown storage format: `{}` " , & source[ bad_span] ) ,
568
568
labels : vec ! [ ( bad_span, "unknown storage format" . into( ) ) ] ,
569
569
notes : vec ! [ ] ,
570
570
} ,
571
571
Error :: UnknownConservativeDepth ( bad_span) => ParseError {
572
- message : format ! ( "unknown conservative depth: '{}' " , & source[ bad_span] ) ,
572
+ message : format ! ( "unknown conservative depth: `{}` " , & source[ bad_span] ) ,
573
573
labels : vec ! [ ( bad_span, "unknown conservative depth" . into( ) ) ] ,
574
574
notes : vec ! [ ] ,
575
575
} ,
576
576
Error :: UnknownType ( bad_span) => ParseError {
577
- message : format ! ( "unknown type: '{}' " , & source[ bad_span] ) ,
577
+ message : format ! ( "unknown type: `{}` " , & source[ bad_span] ) ,
578
578
labels : vec ! [ ( bad_span, "unknown type" . into( ) ) ] ,
579
579
notes : vec ! [ ] ,
580
580
} ,
@@ -702,7 +702,7 @@ impl<'a> Error<'a> {
702
702
InvalidAssignmentType :: ImmutableBinding ( binding_span) => (
703
703
Some ( ( binding_span, "this is an immutable binding" . into ( ) ) ) ,
704
704
vec ! [ format!(
705
- "consider declaring '{}' with `var` instead of `let`" ,
705
+ "consider declaring `{}` with `var` instead of `let`" ,
706
706
& source[ binding_span]
707
707
) ] ,
708
708
) ,
@@ -782,11 +782,11 @@ impl<'a> Error<'a> {
782
782
. into( ) ,
783
783
) ] ,
784
784
notes : vec ! [ if uint {
785
- format!( "suffix the integer with a `u`: ' {}u' " , & source[ span] )
785
+ format!( "suffix the integer with a `u`: ` {}u` " , & source[ span] )
786
786
} else {
787
787
let span = span. to_range( ) . unwrap( ) ;
788
788
format!(
789
- "remove the `u` suffix: '{}' " ,
789
+ "remove the `u` suffix: `{}` " ,
790
790
& source[ span. start..span. end - 1 ]
791
791
)
792
792
} ] ,
@@ -833,10 +833,10 @@ impl<'a> Error<'a> {
833
833
Error :: ExpectedConstExprConcreteIntegerScalar ( span) => ParseError {
834
834
message : concat ! (
835
835
"must be a const-expression that " ,
836
- "resolves to a concrete integer scalar (u32 or i32)"
836
+ "resolves to a concrete integer scalar (` u32` or ` i32` )"
837
837
)
838
838
. to_string ( ) ,
839
- labels : vec ! [ ( span, "must resolve to u32 or i32" . into( ) ) ] ,
839
+ labels : vec ! [ ( span, "must resolve to ` u32` or ` i32` " . into( ) ) ] ,
840
840
notes : vec ! [ ] ,
841
841
} ,
842
842
Error :: ExpectedNonNegative ( span) => ParseError {
@@ -858,7 +858,7 @@ impl<'a> Error<'a> {
858
858
message : "workgroup size is missing on compute shader entry point" . to_string ( ) ,
859
859
labels : vec ! [ (
860
860
span,
861
- "must be paired with a @workgroup_size attribute" . into( ) ,
861
+ "must be paired with a ` @workgroup_size` attribute" . into( ) ,
862
862
) ] ,
863
863
notes : vec ! [ ] ,
864
864
} ,
@@ -947,13 +947,13 @@ impl<'a> Error<'a> {
947
947
notes : vec ! [ ] ,
948
948
} ,
949
949
Error :: NotBool ( span) => ParseError {
950
- message : "must be a const-expression that resolves to a bool" . to_string ( ) ,
951
- labels : vec ! [ ( span, "must resolve to bool" . into( ) ) ] ,
950
+ message : "must be a const-expression that resolves to a ` bool` " . to_string ( ) ,
951
+ labels : vec ! [ ( span, "must resolve to ` bool` " . into( ) ) ] ,
952
952
notes : vec ! [ ] ,
953
953
} ,
954
954
Error :: ConstAssertFailed ( span) => ParseError {
955
- message : "const_assert failure" . to_string ( ) ,
956
- labels : vec ! [ ( span, "evaluates to false" . into( ) ) ] ,
955
+ message : "` const_assert` failure" . to_string ( ) ,
956
+ labels : vec ! [ ( span, "evaluates to ` false` " . into( ) ) ] ,
957
957
notes : vec ! [ ] ,
958
958
} ,
959
959
Error :: DirectiveAfterFirstGlobalDecl { directive_span } => ParseError {
0 commit comments