@@ -161,15 +161,15 @@ pub enum LiteralKind {
161
161
/// "b"abc"", "b"abc"
162
162
ByteStr { terminated : bool } ,
163
163
/// "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 > } ,
165
165
/// "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 > } ,
167
167
}
168
168
169
169
/// Error produced validating a raw string. Represents cases like:
170
170
/// - `r##~"abcde"##`: `InvalidStarter`
171
171
/// - `r###"abcde"##`: `NoTerminator { expected: 3, found: 2, possible_terminator_offset: Some(11)`
172
- /// - Too many `#`s (>65535 ): `TooManyDelimiters`
172
+ /// - Too many `#`s (>255 ): `TooManyDelimiters`
173
173
// perf note: It doesn't matter that this makes `Token` 36 bytes bigger. See #77629
174
174
#[ derive( Clone , Copy , Debug , PartialEq , Eq , PartialOrd , Ord ) ]
175
175
pub enum RawStrError {
@@ -178,7 +178,7 @@ pub enum RawStrError {
178
178
/// The string was never terminated. `possible_terminator_offset` is the number of characters after `r` or `br` where they
179
179
/// may have intended to terminate it.
180
180
NoTerminator { expected : usize , found : usize , possible_terminator_offset : Option < usize > } ,
181
- /// More than 65535 `#`s exist.
181
+ /// More than 255 `#`s exist.
182
182
TooManyDelimiters { found : usize } ,
183
183
}
184
184
@@ -698,12 +698,12 @@ impl Cursor<'_> {
698
698
}
699
699
700
700
/// 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 > ) {
702
702
// Wrap the actual function to handle the error with too many hashes.
703
703
// This way, it eats the whole raw string.
704
704
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) {
707
707
Ok ( num) => ( num, err) ,
708
708
// We lie about the number of hashes here :P
709
709
Err ( _) => ( 0 , Some ( RawStrError :: TooManyDelimiters { found : n_hashes } ) ) ,
0 commit comments