We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 0f002eb + 4e3dbb3 commit c271920Copy full SHA for c271920
compiler/rustc_lexer/src/tests.rs
@@ -66,6 +66,23 @@ fn test_unterminated_no_pound() {
66
);
67
}
68
69
+#[test]
70
+fn test_too_many_hashes() {
71
+ let max_count = u16::MAX;
72
+ let mut hashes: String = "#".repeat(max_count.into());
73
+
74
+ // Valid number of hashes (65535 = 2^16 - 1), but invalid string.
75
+ check_raw_str(&hashes, max_count, Some(RawStrError::InvalidStarter { bad_char: '\u{0}' }));
76
77
+ // One more hash sign (65536 = 2^16) becomes too many.
78
+ hashes.push('#');
79
+ check_raw_str(
80
+ &hashes,
81
+ 0,
82
+ Some(RawStrError::TooManyDelimiters { found: usize::from(max_count) + 1 }),
83
+ );
84
+}
85
86
#[test]
87
fn test_valid_shebang() {
88
// https://github.com/rust-lang/rust/issues/70528
0 commit comments