Skip to content

Rollup of 7 pull requests #122570

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

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
55ba9e7
alloc: implement FromIterator for Box<str>
calebsander Jul 30, 2022
7e79dcd
Drive-by fix string fmt
estebank Mar 9, 2024
2d3435b
Detect calls to `.clone()` on `T: !Clone` types on borrowck errors
estebank Mar 9, 2024
b367c25
Tweak wording
estebank Mar 9, 2024
0953608
Account for UnOps in borrowck message
estebank Mar 12, 2024
8da2621
print ghosts
Manishearth Mar 14, 2024
343c77c
Refactor visibility_print_with_space to directly take an item
Manishearth Mar 14, 2024
1020156
print doc(hidden)
Manishearth Mar 14, 2024
bd03fad
Make compact
Manishearth Mar 14, 2024
2602820
tests
Manishearth Mar 14, 2024
580e5b8
inline
Manishearth Mar 14, 2024
9718144
fix polarity
Manishearth Mar 14, 2024
dc35339
Safe Transmute: Use 'not yet supported', not 'unspecified' in errors
jswrenn Mar 15, 2024
19bc337
Add `rustc_never_type_mode` crate-level attribute to allow experimenting
WaffleLapkin Mar 15, 2024
adfdd27
Add `rustc_never_type_mode = "no_fallback"`
WaffleLapkin Mar 15, 2024
e1e719e
Mention labelled blocks in `break` docs
Wilfred Mar 15, 2024
107807d
Safe Transmute: lowercase diagnostics
jswrenn Mar 15, 2024
0754595
CI: cache PR CI Docker builds
Kobzol Mar 15, 2024
c226e8f
Rollup merge of #99969 - calebsander:feature/collect-box-str, r=dtolnay
matthiaskrgr Mar 15, 2024
75b876a
Rollup merge of #122254 - estebank:issue-48677, r=oli-obk
matthiaskrgr Mar 15, 2024
ec3c569
Rollup merge of #122495 - Manishearth:rustdoc-👻👻👻, r=GuillaumeGomez
matthiaskrgr Mar 15, 2024
7b4ca17
Rollup merge of #122543 - WaffleLapkin:never-flags, r=compiler-errors
matthiaskrgr Mar 15, 2024
5bc30cf
Rollup merge of #122560 - jswrenn:not-yet-supported, r=compiler-errors
matthiaskrgr Mar 15, 2024
ed4397d
Rollup merge of #122562 - Wilfred:break_keyword_docs, r=workingjubilee
matthiaskrgr Mar 15, 2024
2ab4ce1
Rollup merge of #122563 - Kobzol:ci-pr-caching, r=Mark-Simulacrum
matthiaskrgr Mar 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions library/alloc/src/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2080,6 +2080,54 @@ impl<I> FromIterator<I> for Box<[I]> {
}
}

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "boxed_str_from_iter", since = "CURRENT_RUSTC_VERSION")]
impl FromIterator<char> for Box<str> {
fn from_iter<T: IntoIterator<Item = char>>(iter: T) -> Self {
String::from_iter(iter).into_boxed_str()
}
}

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "boxed_str_from_iter", since = "CURRENT_RUSTC_VERSION")]
impl<'a> FromIterator<&'a char> for Box<str> {
fn from_iter<T: IntoIterator<Item = &'a char>>(iter: T) -> Self {
String::from_iter(iter).into_boxed_str()
}
}

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "boxed_str_from_iter", since = "CURRENT_RUSTC_VERSION")]
impl<'a> FromIterator<&'a str> for Box<str> {
fn from_iter<T: IntoIterator<Item = &'a str>>(iter: T) -> Self {
String::from_iter(iter).into_boxed_str()
}
}

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "boxed_str_from_iter", since = "CURRENT_RUSTC_VERSION")]
impl FromIterator<String> for Box<str> {
fn from_iter<T: IntoIterator<Item = String>>(iter: T) -> Self {
String::from_iter(iter).into_boxed_str()
}
}

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "boxed_str_from_iter", since = "CURRENT_RUSTC_VERSION")]
impl<A: Allocator> FromIterator<Box<str, A>> for Box<str> {
fn from_iter<T: IntoIterator<Item = Box<str, A>>>(iter: T) -> Self {
String::from_iter(iter).into_boxed_str()
}
}

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "boxed_str_from_iter", since = "CURRENT_RUSTC_VERSION")]
impl<'a> FromIterator<Cow<'a, str>> for Box<str> {
fn from_iter<T: IntoIterator<Item = Cow<'a, str>>>(iter: T) -> Self {
String::from_iter(iter).into_boxed_str()
}
}

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "box_slice_clone", since = "1.3.0")]
impl<T: Clone, A: Allocator + Clone> Clone for Box<[T], A> {
Expand Down
10 changes: 6 additions & 4 deletions library/alloc/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ use core::str::pattern::Pattern;
#[cfg(not(no_global_oom_handling))]
use core::str::Utf8Chunks;

#[cfg(not(no_global_oom_handling))]
use crate::alloc::Allocator;
#[cfg(not(no_global_oom_handling))]
use crate::borrow::{Cow, ToOwned};
use crate::boxed::Box;
Expand Down Expand Up @@ -2153,8 +2155,8 @@ impl FromIterator<String> for String {

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "box_str2", since = "1.45.0")]
impl FromIterator<Box<str>> for String {
fn from_iter<I: IntoIterator<Item = Box<str>>>(iter: I) -> String {
impl<A: Allocator> FromIterator<Box<str, A>> for String {
fn from_iter<I: IntoIterator<Item = Box<str, A>>>(iter: I) -> String {
let mut buf = String::new();
buf.extend(iter);
buf
Expand Down Expand Up @@ -2235,8 +2237,8 @@ impl<'a> Extend<&'a str> for String {

#[cfg(not(no_global_oom_handling))]
#[stable(feature = "box_str2", since = "1.45.0")]
impl Extend<Box<str>> for String {
fn extend<I: IntoIterator<Item = Box<str>>>(&mut self, iter: I) {
impl<A: Allocator> Extend<Box<str, A>> for String {
fn extend<I: IntoIterator<Item = Box<str, A>>>(&mut self, iter: I) {
iter.into_iter().for_each(move |s| self.push_str(&s));
}
}
Expand Down