diff options
| author | Ralf Jung <post@ralfj.de> | 2023-08-10 19:07:11 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-08-10 19:07:11 +0200 |
| commit | 2e14f25c9b7ede9519ebb99eb8424511aab48371 (patch) | |
| tree | 168e6eec8c0d01a0d5f8b9e5805ba0f98f9511f1 /compiler/rustc_data_structures/src | |
| parent | a549de1588f114a0400e21911806a124cd69fcc8 (diff) | |
| parent | 9fa6bdd764a1f7bdf69eccceeace6d13f38cb2e1 (diff) | |
| download | rust-2e14f25c9b7ede9519ebb99eb8424511aab48371.tar.gz rust-2e14f25c9b7ede9519ebb99eb8424511aab48371.zip | |
Merge from rustc
Diffstat (limited to 'compiler/rustc_data_structures/src')
| -rw-r--r-- | compiler/rustc_data_structures/src/base_n.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_data_structures/src/base_n.rs b/compiler/rustc_data_structures/src/base_n.rs index 58704350706..a3eb2b9c416 100644 --- a/compiler/rustc_data_structures/src/base_n.rs +++ b/compiler/rustc_data_structures/src/base_n.rs @@ -30,7 +30,10 @@ pub fn push_str(mut n: u128, base: usize, output: &mut String) { } } - output.push_str(str::from_utf8(&s[index..]).unwrap()); + output.push_str(unsafe { + // SAFETY: `s` is populated using only valid utf8 characters from `BASE_64` + str::from_utf8_unchecked(&s[index..]) + }); } #[inline] |
