-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
A-UnicodeArea: UnicodeArea: UnicodeC-bugCategory: This is a bug.Category: This is a bug.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
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());
}
mqudsi, ryanavella, workingjubilee, andsanmar and Jules-Bertholet
Metadata
Metadata
Assignees
Labels
A-UnicodeArea: UnicodeArea: UnicodeC-bugCategory: This is a bug.Category: This is a bug.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.