Skip to content

Commit 9ed9535

Browse files
committed
Stabilize char_max_len
1 parent c90bcb9 commit 9ed9535

File tree

8 files changed

+9
-15
lines changed

8 files changed

+9
-15
lines changed

library/alloc/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@
9999
#![feature(cast_maybe_uninit)]
100100
#![feature(cell_get_cloned)]
101101
#![feature(char_internals)]
102-
#![feature(char_max_len)]
103102
#![feature(clone_to_uninit)]
104103
#![feature(coerce_unsized)]
105104
#![feature(const_convert)]

library/alloc/src/wtf8/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#[cfg(test)]
1515
mod tests;
1616

17-
use core::char::{MAX_LEN_UTF8, encode_utf8_raw};
17+
use core::char::encode_utf8_raw;
1818
use core::hash::{Hash, Hasher};
1919
pub use core::wtf8::{CodePoint, Wtf8};
2020
#[cfg(not(test))]
@@ -166,7 +166,7 @@ impl Wtf8Buf {
166166
/// This does **not** include the WTF-8 concatenation check or `is_known_utf8` check.
167167
/// Copied from String::push.
168168
unsafe fn push_code_point_unchecked(&mut self, code_point: CodePoint) {
169-
let mut bytes = [0; MAX_LEN_UTF8];
169+
let mut bytes = [0; char::MAX_LEN_UTF8];
170170
let bytes = encode_utf8_raw(code_point.to_u32(), &mut bytes);
171171
self.bytes.extend_from_slice(bytes)
172172
}

library/alloctests/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#![feature(array_into_iter_constructors)]
2020
#![feature(assert_matches)]
2121
#![feature(char_internals)]
22-
#![feature(char_max_len)]
2322
#![feature(copied_into_inner)]
2423
#![feature(core_intrinsics)]
2524
#![feature(exact_size_is_empty)]

library/alloctests/tests/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![feature(iter_array_chunks)]
44
#![feature(assert_matches)]
55
#![feature(wtf8_internals)]
6-
#![feature(char_max_len)]
76
#![feature(cow_is_borrowed)]
87
#![feature(core_intrinsics)]
98
#![feature(deque_extend_front)]

library/alloctests/tests/str.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
use std::assert_matches::assert_matches;
44
use std::borrow::Cow;
5-
use std::char::MAX_LEN_UTF8;
65
use std::cmp::Ordering::{Equal, Greater, Less};
76
use std::str::{from_utf8, from_utf8_unchecked};
87

@@ -1232,7 +1231,7 @@ fn test_to_uppercase_rev_iterator() {
12321231
#[test]
12331232
#[cfg_attr(miri, ignore)] // Miri is too slow
12341233
fn test_chars_decoding() {
1235-
let mut bytes = [0; MAX_LEN_UTF8];
1234+
let mut bytes = [0; char::MAX_LEN_UTF8];
12361235
for c in (0..0x110000).filter_map(std::char::from_u32) {
12371236
let s = c.encode_utf8(&mut bytes);
12381237
if Some(c) != s.chars().next() {
@@ -1244,7 +1243,7 @@ fn test_chars_decoding() {
12441243
#[test]
12451244
#[cfg_attr(miri, ignore)] // Miri is too slow
12461245
fn test_chars_rev_decoding() {
1247-
let mut bytes = [0; MAX_LEN_UTF8];
1246+
let mut bytes = [0; char::MAX_LEN_UTF8];
12481247
for c in (0..0x110000).filter_map(std::char::from_u32) {
12491248
let s = c.encode_utf8(&mut bytes);
12501249
if Some(c) != s.chars().rev().next() {

library/core/src/char/methods.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ impl char {
7474

7575
/// The maximum number of bytes required to [encode](char::encode_utf8) a `char` to
7676
/// UTF-8 encoding.
77-
#[unstable(feature = "char_max_len", issue = "121714")]
77+
#[stable(feature = "char_max_len_assoc", since = "CURRENT_RUSTC_VERSION")]
7878
pub const MAX_LEN_UTF8: usize = 4;
7979

8080
/// The maximum number of two-byte units required to [encode](char::encode_utf16) a `char`
8181
/// to UTF-16 encoding.
82-
#[unstable(feature = "char_max_len", issue = "121714")]
82+
#[stable(feature = "char_max_len_assoc", since = "CURRENT_RUSTC_VERSION")]
8383
pub const MAX_LEN_UTF16: usize = 2;
8484

8585
/// `U+FFFD REPLACEMENT CHARACTER` (�) is used in Unicode to represent a

library/std/src/fs/tests.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use rand::RngCore;
99
target_vendor = "apple",
1010
))]
1111
use crate::assert_matches::assert_matches;
12-
use crate::char::MAX_LEN_UTF8;
1312
#[cfg(any(
1413
windows,
1514
target_os = "freebsd",
@@ -174,7 +173,7 @@ fn file_test_io_non_positional_read() {
174173
#[test]
175174
fn file_test_io_seek_and_tell_smoke_test() {
176175
let message = "ten-four";
177-
let mut read_mem = [0; MAX_LEN_UTF8];
176+
let mut read_mem = [0; char::MAX_LEN_UTF8];
178177
let set_cursor = 4 as u64;
179178
let tell_pos_pre_read;
180179
let tell_pos_post_read;
@@ -405,7 +404,7 @@ fn file_test_io_seek_shakedown() {
405404
let chunk_one: &str = "qwer";
406405
let chunk_two: &str = "asdf";
407406
let chunk_three: &str = "zxcv";
408-
let mut read_mem = [0; MAX_LEN_UTF8];
407+
let mut read_mem = [0; char::MAX_LEN_UTF8];
409408
let tmpdir = tmpdir();
410409
let filename = &tmpdir.join("file_rt_io_file_test_seek_shakedown.txt");
411410
{
@@ -782,7 +781,7 @@ fn file_test_directoryinfo_readdir() {
782781
check!(w.write(msg));
783782
}
784783
let files = check!(fs::read_dir(dir));
785-
let mut mem = [0; MAX_LEN_UTF8];
784+
let mut mem = [0; char::MAX_LEN_UTF8];
786785
for f in files {
787786
let f = f.unwrap().path();
788787
{

library/std/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@
276276
#![feature(cfg_sanitizer_cfi)]
277277
#![feature(cfg_target_thread_local)]
278278
#![feature(cfi_encoding)]
279-
#![feature(char_max_len)]
280279
#![feature(const_trait_impl)]
281280
#![feature(core_float_math)]
282281
#![feature(decl_macro)]

0 commit comments

Comments
 (0)