-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracking issue for make_ascii_{upper,lower}case #27809
Comments
cc @SimonSapin |
Minor correction: Rc::make_unique is another example of this naming.
|
There should be a way to do this operation without allocating. I don’t have a strong opinion on in place with |
I don't like the |
I would prefer consuming the given String too. |
The |
You can always iterate the |
As for naming, something like |
But I also think |
+1 for |
If the libs team has the bandwidth, I’d like to nominate this for discussion. To sum up, options are:
Both are equally general: at worst if all you have is a |
Also, it’s possible to build this out of tree: for byte in &mut (bytes: Vec<u8>) {
*byte = byte.to_ascii_lowercase()
}
for byte in unsafe { (s: String).as_mut_vec() } {
*byte = byte.to_ascii_lowercase()
} … though it would be nice to encapsulate the unsafety in the |
🔔 This issue is now entering its cycle final comment period to be deprecated in 1.8 🔔 |
What’s the rationale for not stabilizing any of the two proposed designs? |
Ah yes, to clarify we concluded that this stuck out enough and could be easily enough built on crates.io (e.g. externally) that it wasn't necessary to stabilize in libstd at this time. |
The same can be said of the entire |
Sure, but that part's already stable. The |
I’m not a big fan of What about |
If those methods could be merged into the |
Alright. IIRC we had a separate trait because dynamically-sized types and methods taking See PR #31335. |
What do
Is that true? If so how do you handle If naming is still an issue with |
Implementing `AsciiExt` for `String` and `Vec<u8>` caused a regression: rust-lang#32074 and the `where Self: Sized` hack to have the `into_` methods in that trait (which is also implemented for DST `str` and `[u8]`) was rather clunky. CC rust-lang#27809
This API is going back into final comment period. We were previously unable to reach consensus on a good convention for
We've always been somewhat ambivalent about ASCII support in std, and have scaled it back over time, but at this point, we're reasonably committed to some core functionality, and we'd like to settle these remaining APIs. As such, we're going to:
We had a lengthy discussion in the libs team last time about conventions. The key problem is that mutating methods are usually reasonably clear verb forms (like Perhaps we can look at some other languages for inspiration on this convention. But let's try to get it settled this cycle. |
Is #32076 what you have in mind here? |
The addition of these methods in rust-lang#31335 required adding impls of the trait for the `String` and `Vec<T>` types. This unfortunately caused a regression (rust-lang#32074) in type inference for using these methods which the libs team has decided to not push forward with. These methods were stabilized in rust-lang#32020 which was intended to get backported to beta, but the backport hasn't happened just yet. This commit reverts both the addition and stabilization of these methods. One proposed method of handling this, in rust-lang#32076, was to move the methods to an extra trait to avoid conflicts with type inference. After some discussion, however, the libs team concluded that we probably want to reevaluate what we're doing here, so discussion will continue on the tracking issue, rust-lang#27809.
std: Revert addition of `into_ascii_*` methods The addition of these methods in #31335 required adding impls of the trait for the `String` and `Vec<T>` types. This unfortunately caused a regression (#32074) in type inference for using these methods which the libs team has decided to not push forward with. These methods were stabilized in #32020 which was intended to get backported to beta, but the backport hasn't happened just yet. This commit reverts both the addition and stabilization of these methods. One proposed method of handling this, in #32076, was to move the methods to an extra trait to avoid conflicts with type inference. After some discussion, however, the libs team concluded that we probably want to reevaluate what we're doing here, so discussion will continue on the tracking issue, #27809. Closes #32074
@SimonSapin I think you already saw, but for the record, #32314 is what we had in mind. |
The addition of these methods in rust-lang#31335 required adding impls of the trait for the `String` and `Vec<T>` types. This unfortunately caused a regression (rust-lang#32074) in type inference for using these methods which the libs team has decided to not push forward with. These methods were stabilized in rust-lang#32020 which was intended to get backported to beta, but the backport hasn't happened just yet. This commit reverts both the addition and stabilization of these methods. One proposed method of handling this, in rust-lang#32076, was to move the methods to an extra trait to avoid conflicts with type inference. After some discussion, however, the libs team concluded that we probably want to reevaluate what we're doing here, so discussion will continue on the tracking issue, rust-lang#27809. Conflicts: src/libstd/ascii.rs
Revisiting the naming concerns, I continue to feel like the sticking point is needing a verb, which we can get either through |
I agree that all nouns can be verbed, but since |
I agree with Simon's concerns about ambiguity. How about But in all seriousness, |
@SimonSapin Ah, that's an excellent point. Maybe the right thing to do is to stick with |
The libs team discussed this issue during triage yesterday and the conclusion was to stabilize under the names |
This commit applies all stabilizations, renamings, and deprecations that the library team has decided on for the upcoming 1.9 release. All tracking issues have gone through a cycle-long "final comment period" and the specific APIs stabilized/deprecated are: Stable * `std::panic` * `std::panic::catch_unwind` (renamed from `recover`) * `std::panic::resume_unwind` (renamed from `propagate`) * `std::panic::AssertUnwindSafe` (renamed from `AssertRecoverSafe`) * `std::panic::UnwindSafe` (renamed from `RecoverSafe`) * `str::is_char_boundary` * `<*const T>::as_ref` * `<*mut T>::as_ref` * `<*mut T>::as_mut` * `AsciiExt::make_ascii_uppercase` * `AsciiExt::make_ascii_lowercase` * `char::decode_utf16` * `char::DecodeUtf16` * `char::DecodeUtf16Error` * `char::DecodeUtf16Error::unpaired_surrogate` * `BTreeSet::take` * `BTreeSet::replace` * `BTreeSet::get` * `HashSet::take` * `HashSet::replace` * `HashSet::get` * `OsString::with_capacity` * `OsString::clear` * `OsString::capacity` * `OsString::reserve` * `OsString::reserve_exact` * `OsStr::is_empty` * `OsStr::len` * `std::os::unix::thread` * `RawPthread` * `JoinHandleExt` * `JoinHandleExt::as_pthread_t` * `JoinHandleExt::into_pthread_t` * `HashSet::hasher` * `HashMap::hasher` * `CommandExt::exec` * `File::try_clone` * `SocketAddr::set_ip` * `SocketAddr::set_port` * `SocketAddrV4::set_ip` * `SocketAddrV4::set_port` * `SocketAddrV6::set_ip` * `SocketAddrV6::set_port` * `SocketAddrV6::set_flowinfo` * `SocketAddrV6::set_scope_id` * `<[T]>::copy_from_slice` * `ptr::read_volatile` * `ptr::write_volatile` * The `#[deprecated]` attribute * `OpenOptions::create_new` Deprecated * `std::raw::Slice` - use raw parts of `slice` module instead * `std::raw::Repr` - use raw parts of `slice` module instead * `str::char_range_at` - use slicing plus `chars()` plus `len_utf8` * `str::char_range_at_reverse` - use slicing plus `chars().rev()` plus `len_utf8` * `str::char_at` - use slicing plus `chars()` * `str::char_at_reverse` - use slicing plus `chars().rev()` * `str::slice_shift_char` - use `chars()` plus `Chars::as_str` * `CommandExt::session_leader` - use `before_exec` instead. Closes rust-lang#27719 cc rust-lang#27751 (deprecating the `Slice` bits) Closes rust-lang#27754 Closes rust-lang#27780 Closes rust-lang#27809 Closes rust-lang#27811 Closes rust-lang#27830 Closes rust-lang#28050 Closes rust-lang#29453 Closes rust-lang#29791 Closes rust-lang#29935 Closes rust-lang#30014 Closes rust-lang#30752 Closes rust-lang#31262 cc rust-lang#31398 (still need to deal with `before_exec`) Closes rust-lang#31405 Closes rust-lang#31572 Closes rust-lang#31755 Closes rust-lang#31756
std: Stabilize APIs for the 1.9 release This commit applies all stabilizations, renamings, and deprecations that the library team has decided on for the upcoming 1.9 release. All tracking issues have gone through a cycle-long "final comment period" and the specific APIs stabilized/deprecated are: Stable * `std::panic` * `std::panic::catch_unwind` (renamed from `recover`) * `std::panic::resume_unwind` (renamed from `propagate`) * `std::panic::AssertUnwindSafe` (renamed from `AssertRecoverSafe`) * `std::panic::UnwindSafe` (renamed from `RecoverSafe`) * `str::is_char_boundary` * `<*const T>::as_ref` * `<*mut T>::as_ref` * `<*mut T>::as_mut` * `AsciiExt::make_ascii_uppercase` * `AsciiExt::make_ascii_lowercase` * `char::decode_utf16` * `char::DecodeUtf16` * `char::DecodeUtf16Error` * `char::DecodeUtf16Error::unpaired_surrogate` * `BTreeSet::take` * `BTreeSet::replace` * `BTreeSet::get` * `HashSet::take` * `HashSet::replace` * `HashSet::get` * `OsString::with_capacity` * `OsString::clear` * `OsString::capacity` * `OsString::reserve` * `OsString::reserve_exact` * `OsStr::is_empty` * `OsStr::len` * `std::os::unix::thread` * `RawPthread` * `JoinHandleExt` * `JoinHandleExt::as_pthread_t` * `JoinHandleExt::into_pthread_t` * `HashSet::hasher` * `HashMap::hasher` * `CommandExt::exec` * `File::try_clone` * `SocketAddr::set_ip` * `SocketAddr::set_port` * `SocketAddrV4::set_ip` * `SocketAddrV4::set_port` * `SocketAddrV6::set_ip` * `SocketAddrV6::set_port` * `SocketAddrV6::set_flowinfo` * `SocketAddrV6::set_scope_id` * `<[T]>::copy_from_slice` * `ptr::read_volatile` * `ptr::write_volatile` * The `#[deprecated]` attribute * `OpenOptions::create_new` Deprecated * `std::raw::Slice` - use raw parts of `slice` module instead * `std::raw::Repr` - use raw parts of `slice` module instead * `str::char_range_at` - use slicing plus `chars()` plus `len_utf8` * `str::char_range_at_reverse` - use slicing plus `chars().rev()` plus `len_utf8` * `str::char_at` - use slicing plus `chars()` * `str::char_at_reverse` - use slicing plus `chars().rev()` * `str::slice_shift_char` - use `chars()` plus `Chars::as_str` * `CommandExt::session_leader` - use `before_exec` instead. Closes #27719 cc #27751 (deprecating the `Slice` bits) Closes #27754 Closes #27780 Closes #27809 Closes #27811 Closes #27830 Closes #28050 Closes #29453 Closes #29791 Closes #29935 Closes #30014 Closes #30752 Closes #31262 cc #31398 (still need to deal with `before_exec`) Closes #31405 Closes #31572 Closes #31755 Closes #31756
This commit applies all stabilizations, renamings, and deprecations that the library team has decided on for the upcoming 1.9 release. All tracking issues have gone through a cycle-long "final comment period" and the specific APIs stabilized/deprecated are: Stable * `std::panic` * `std::panic::catch_unwind` (renamed from `recover`) * `std::panic::resume_unwind` (renamed from `propagate`) * `std::panic::AssertUnwindSafe` (renamed from `AssertRecoverSafe`) * `std::panic::UnwindSafe` (renamed from `RecoverSafe`) * `str::is_char_boundary` * `<*const T>::as_ref` * `<*mut T>::as_ref` * `<*mut T>::as_mut` * `AsciiExt::make_ascii_uppercase` * `AsciiExt::make_ascii_lowercase` * `char::decode_utf16` * `char::DecodeUtf16` * `char::DecodeUtf16Error` * `char::DecodeUtf16Error::unpaired_surrogate` * `BTreeSet::take` * `BTreeSet::replace` * `BTreeSet::get` * `HashSet::take` * `HashSet::replace` * `HashSet::get` * `OsString::with_capacity` * `OsString::clear` * `OsString::capacity` * `OsString::reserve` * `OsString::reserve_exact` * `OsStr::is_empty` * `OsStr::len` * `std::os::unix::thread` * `RawPthread` * `JoinHandleExt` * `JoinHandleExt::as_pthread_t` * `JoinHandleExt::into_pthread_t` * `HashSet::hasher` * `HashMap::hasher` * `CommandExt::exec` * `File::try_clone` * `SocketAddr::set_ip` * `SocketAddr::set_port` * `SocketAddrV4::set_ip` * `SocketAddrV4::set_port` * `SocketAddrV6::set_ip` * `SocketAddrV6::set_port` * `SocketAddrV6::set_flowinfo` * `SocketAddrV6::set_scope_id` * `<[T]>::copy_from_slice` * `ptr::read_volatile` * `ptr::write_volatile` * The `#[deprecated]` attribute * `OpenOptions::create_new` Deprecated * `std::raw::Slice` - use raw parts of `slice` module instead * `std::raw::Repr` - use raw parts of `slice` module instead * `str::char_range_at` - use slicing plus `chars()` plus `len_utf8` * `str::char_range_at_reverse` - use slicing plus `chars().rev()` plus `len_utf8` * `str::char_at` - use slicing plus `chars()` * `str::char_at_reverse` - use slicing plus `chars().rev()` * `str::slice_shift_char` - use `chars()` plus `Chars::as_str` * `CommandExt::session_leader` - use `before_exec` instead. Closes rust-lang#27719 cc rust-lang#27751 (deprecating the `Slice` bits) Closes rust-lang#27754 Closes rust-lang#27780 Closes rust-lang#27809 Closes rust-lang#27811 Closes rust-lang#27830 Closes rust-lang#28050 Closes rust-lang#29453 Closes rust-lang#29791 Closes rust-lang#29935 Closes rust-lang#30014 Closes rust-lang#30752 Closes rust-lang#31262 cc rust-lang#31398 (still need to deal with `before_exec`) Closes rust-lang#31405 Closes rust-lang#31572 Closes rust-lang#31755 Closes rust-lang#31756
This is a tracking issue for the unstable
ascii
feature in the standard library. These functions have the somewhat odd naming scheme ofmake_*
(not found elsewhere in the standard library). The utility with&mut str
is also somewhat questionable as there's not a lot of support for that in the standard library.Overall this probably just largely needs a decision.
The text was updated successfully, but these errors were encountered: