Closed
Description
Hello,
Due to the optimization introduced with #97046, the to_lowercase
conversion of some str
containing the Σ
char is incorrect.
Simple example:
fn main(){
println!("{}", "aΣ".to_lowercase());
println!("{}", "abcdefghijklmnopΣ".to_lowercase());
}
output:
aς
abcdefghijklmnopσ
The first conversion is correct while the second is not and should be abcdefghijklmnopς
.
More generally, this happens when 'Σ' follows a 2 * USIZE_SIZE * K
number of chars
use std::mem;
const USIZE_SIZE_BY_2: usize = 2 * mem::size_of::<usize>();
const K: usize = 1;
fn main() {
let bug_string = "a".repeat(USIZE_SIZE_BY_2 * K) + "Σ";
println!("{}", bug_string.to_lowercase());
}