File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -522,6 +522,15 @@ mod tests {
522
522
}
523
523
}
524
524
525
+ /// If we use char::arbitrary(g) then we can get back characters which are
526
+ /// outside the ASCII range. Since the length calculated by [`String`] is
527
+ /// based on the utf-8 length of the string (not based on the number of bytes
528
+ /// in the string), putting non-ASCII characters into it can skew the length
529
+ /// calculation in strange ways.
530
+ ///
531
+ /// This function generates only ASCII characters by cutting their values
532
+ /// off at 127. This does not give an even distribution of ASCII characters,
533
+ /// but that fact is not important for this smoke test.
525
534
fn generate_ascii ( g : & mut Gen ) -> char {
526
535
let c = u8:: min ( u8:: arbitrary ( g) , 127 ) ;
527
536
c as char
You can’t perform that action at this time.
0 commit comments