@@ -16,8 +16,6 @@ pub(crate) enum UnsupportedLiteralReason {
1616    Generic , 
1717    CfgString , 
1818    CfgBoolean , 
19-     DeprecatedString , 
20-     DeprecatedKvPair , 
2119} 
2220
2321#[ derive( Diagnostic ) ]  
@@ -190,6 +188,7 @@ pub(crate) struct InvalidReprHintNoValue {
190188} 
191189
192190/// Error code: E0565 
191+ // FIXME(jdonszelmann): slowly phased out 
193192pub ( crate )  struct  UnsupportedLiteral  { 
194193    pub  span :  Span , 
195194    pub  reason :  UnsupportedLiteralReason , 
@@ -212,12 +211,6 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for UnsupportedLiteral {
212211                UnsupportedLiteralReason :: CfgBoolean  => { 
213212                    fluent:: attr_parsing_unsupported_literal_cfg_boolean
214213                } 
215-                 UnsupportedLiteralReason :: DeprecatedString  => { 
216-                     fluent:: attr_parsing_unsupported_literal_deprecated_string
217-                 } 
218-                 UnsupportedLiteralReason :: DeprecatedKvPair  => { 
219-                     fluent:: attr_parsing_unsupported_literal_deprecated_kv_pair
220-                 } 
221214            } , 
222215        ) ; 
223216        diag. span ( self . span ) ; 
@@ -473,9 +466,10 @@ pub(crate) struct UnrecognizedReprHint {
473466} 
474467
475468pub ( crate )  enum  AttributeParseErrorReason  { 
476-     ExpectedStringLiteral , 
469+     ExpectedStringLiteral   {   byte_string :   Option < Span >   } , 
477470    ExpectedSingleArgument , 
478471    ExpectedList , 
472+     UnexpectedLiteral , 
479473    ExpectedNameValue ( Option < Symbol > ) , 
480474    DuplicateKey ( Symbol ) , 
481475    ExpectedSpecificArgument  {  possibilities :  Vec < & ' static  str > ,  strings :  bool  } , 
@@ -497,27 +491,44 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError {
497491        diag. span ( self . attr_span ) ; 
498492        diag. code ( E0539 ) ; 
499493        match  self . reason  { 
500-             AttributeParseErrorReason :: ExpectedStringLiteral  => { 
501-                 diag. span_note ( self . span ,  "expected a string literal here" ) ; 
494+             AttributeParseErrorReason :: ExpectedStringLiteral  {  byte_string }  => { 
495+                 if  let  Some ( start_point_span)  = byte_string { 
496+                     diag. span_suggestion ( 
497+                         start_point_span, 
498+                         fluent:: attr_parsing_unsupported_literal_suggestion, 
499+                         "" , 
500+                         Applicability :: MaybeIncorrect , 
501+                     ) ; 
502+                     diag. note ( "expected a normal string literal, not a byte string literal" ) ; 
503+ 
504+                     return  diag; 
505+                 }  else  { 
506+                     diag. span_label ( self . span ,  "expected a string literal here" ) ; 
507+                 } 
502508            } 
503509            AttributeParseErrorReason :: ExpectedSingleArgument  => { 
504-                 diag. span_note ( self . span ,  "expected a single argument here" ) ; 
510+                 diag. span_label ( self . span ,  "expected a single argument here" ) ; 
511+                 diag. code ( E0540 ) ; 
505512            } 
506513            AttributeParseErrorReason :: ExpectedList  => { 
507-                 diag. span_note ( self . span ,  "expected this to be a list" ) ; 
514+                 diag. span_label ( self . span ,  "expected this to be a list" ) ; 
508515            } 
509516            AttributeParseErrorReason :: DuplicateKey ( key)  => { 
510-                 diag. span_note ( self . span ,  format ! ( "found `{key}` used as a key more than once" ) ) ; 
517+                 diag. span_label ( self . span ,  format ! ( "found `{key}` used as a key more than once" ) ) ; 
511518                diag. code ( E0538 ) ; 
512519            } 
520+             AttributeParseErrorReason :: UnexpectedLiteral  => { 
521+                 diag. span_label ( self . span ,  format ! ( "didn't expect a literal here" ) ) ; 
522+                 diag. code ( E0565 ) ; 
523+             } 
513524            AttributeParseErrorReason :: ExpectedNameValue ( None )  => { 
514-                 diag. span_note ( 
525+                 diag. span_label ( 
515526                    self . span , 
516527                    format ! ( "expected this to be of the form `{name} = \" ...\" `" ) , 
517528                ) ; 
518529            } 
519530            AttributeParseErrorReason :: ExpectedNameValue ( Some ( name) )  => { 
520-                 diag. span_note ( 
531+                 diag. span_label ( 
521532                    self . span , 
522533                    format ! ( "expected this to be of the form `{name} = \" ...\" `" ) , 
523534                ) ; 
@@ -527,13 +538,13 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError {
527538                match  possibilities. as_slice ( )  { 
528539                    & [ ]  => { } 
529540                    & [ x]  => { 
530-                         diag. span_note ( 
541+                         diag. span_label ( 
531542                            self . span , 
532543                            format ! ( "the only valid argument here is {quote}{x}{quote}" ) , 
533544                        ) ; 
534545                    } 
535546                    [ first,  second]  => { 
536-                         diag. span_note ( self . span ,  format ! ( "valid arguments are {quote}{first}{quote} or {quote}{second}{quote}" ) ) ; 
547+                         diag. span_label ( self . span ,  format ! ( "valid arguments are {quote}{first}{quote} or {quote}{second}{quote}" ) ) ; 
537548                    } 
538549                    [ first @ ..,  second_to_last,  last]  => { 
539550                        let  mut  res = String :: new ( ) ; 
@@ -544,7 +555,7 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError {
544555                            "{quote}{second_to_last}{quote} or {quote}{last}{quote}" 
545556                        ) ) ; 
546557
547-                         diag. span_note ( self . span ,  format ! ( "valid arguments are {res}" ) ) ; 
558+                         diag. span_label ( self . span ,  format ! ( "valid arguments are {res}" ) ) ; 
548559                    } 
549560                } 
550561            } 
0 commit comments