@@ -161,15 +161,15 @@ pub enum LiteralKind {
161161 /// "b"abc"", "b"abc"
162162 ByteStr { terminated : bool } ,
163163 /// "r"abc"", "r#"abc"#", "r####"ab"###"c"####", "r#"a"
164- RawStr { n_hashes : u16 , err : Option < RawStrError > } ,
164+ RawStr { n_hashes : u8 , err : Option < RawStrError > } ,
165165 /// "br"abc"", "br#"abc"#", "br####"ab"###"c"####", "br#"a"
166- RawByteStr { n_hashes : u16 , err : Option < RawStrError > } ,
166+ RawByteStr { n_hashes : u8 , err : Option < RawStrError > } ,
167167}
168168
169169/// Error produced validating a raw string. Represents cases like:
170170/// - `r##~"abcde"##`: `InvalidStarter`
171171/// - `r###"abcde"##`: `NoTerminator { expected: 3, found: 2, possible_terminator_offset: Some(11)`
172- /// - Too many `#`s (>65535 ): `TooManyDelimiters`
172+ /// - Too many `#`s (>255 ): `TooManyDelimiters`
173173// perf note: It doesn't matter that this makes `Token` 36 bytes bigger. See #77629
174174#[ derive( Clone , Copy , Debug , PartialEq , Eq , PartialOrd , Ord ) ]
175175pub enum RawStrError {
@@ -178,7 +178,7 @@ pub enum RawStrError {
178178 /// The string was never terminated. `possible_terminator_offset` is the number of characters after `r` or `br` where they
179179 /// may have intended to terminate it.
180180 NoTerminator { expected : usize , found : usize , possible_terminator_offset : Option < usize > } ,
181- /// More than 65535 `#`s exist.
181+ /// More than 255 `#`s exist.
182182 TooManyDelimiters { found : usize } ,
183183}
184184
@@ -698,12 +698,12 @@ impl Cursor<'_> {
698698 }
699699
700700 /// Eats the double-quoted string and returns `n_hashes` and an error if encountered.
701- fn raw_double_quoted_string ( & mut self , prefix_len : usize ) -> ( u16 , Option < RawStrError > ) {
701+ fn raw_double_quoted_string ( & mut self , prefix_len : usize ) -> ( u8 , Option < RawStrError > ) {
702702 // Wrap the actual function to handle the error with too many hashes.
703703 // This way, it eats the whole raw string.
704704 let ( n_hashes, err) = self . raw_string_unvalidated ( prefix_len) ;
705- // Only up to 65535 `#`s are allowed in raw strings
706- match u16 :: try_from ( n_hashes) {
705+ // Only up to 255 `#`s are allowed in raw strings
706+ match u8 :: try_from ( n_hashes) {
707707 Ok ( num) => ( num, err) ,
708708 // We lie about the number of hashes here :P
709709 Err ( _) => ( 0 , Some ( RawStrError :: TooManyDelimiters { found : n_hashes } ) ) ,
0 commit comments