Skip to content

Commit

Permalink
Rollup merge of #96841 - thomcc:revert-osstr-join, r=m-ou-se
Browse files Browse the repository at this point in the history
Revert "Implement [OsStr]::join", which was merged without FCP.

This reverts commit 4c460de02e132ef05e25888f0254a9eab894a223, see rust-lang/rust#96744. (I'm terribly sorry, and truly don't remember r+ing it, or even having seen it before yesterday, which is... genuinely very worrisome for me).

r? `@m-ou-se`
  • Loading branch information
matthiaskrgr authored May 9, 2022
2 parents 1d58bff + 61bee05 commit 012903c
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 33 deletions.
17 changes: 0 additions & 17 deletions std/src/ffi/os_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1222,23 +1222,6 @@ impl OsStr {
}
}

#[unstable(feature = "slice_concat_ext", issue = "27747")]
impl<S: Borrow<OsStr>> alloc::slice::Join<&OsStr> for [S] {
type Output = OsString;

fn join(slice: &Self, sep: &OsStr) -> OsString {
let Some(first) = slice.first() else {
return OsString::new();
};
let first = first.borrow().to_owned();
slice[1..].iter().fold(first, |mut a, b| {
a.push(sep);
a.push(b.borrow());
a
})
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl Borrow<OsStr> for OsString {
#[inline]
Expand Down
14 changes: 0 additions & 14 deletions std/src/ffi/os_str/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,6 @@ fn test_os_string_reserve_exact() {
assert!(os_string.capacity() >= 33)
}

#[test]
fn test_os_string_join() {
let strings = [OsStr::new("hello"), OsStr::new("dear"), OsStr::new("world")];
assert_eq!("hello", strings[..1].join(OsStr::new(" ")));
assert_eq!("hello dear world", strings.join(OsStr::new(" ")));
assert_eq!("hellodearworld", strings.join(OsStr::new("")));
assert_eq!("hello.\n dear.\n world", strings.join(OsStr::new(".\n ")));

assert_eq!("dear world", strings[1..].join(&OsString::from(" ")));

let strings_abc = [OsString::from("a"), OsString::from("b"), OsString::from("c")];
assert_eq!("a b c", strings_abc.join(OsStr::new(" ")));
}

#[test]
fn test_os_string_default() {
let os_string: OsString = Default::default();
Expand Down
2 changes: 0 additions & 2 deletions std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@
#![feature(intra_doc_pointers)]
#![feature(lang_items)]
#![feature(let_chains)]
#![feature(let_else)]
#![feature(linkage)]
#![feature(min_specialization)]
#![feature(must_not_suspend)]
Expand Down Expand Up @@ -302,7 +301,6 @@
#![feature(toowned_clone_into)]
#![feature(try_reserve_kind)]
#![feature(vec_into_raw_parts)]
#![feature(slice_concat_trait)]
//
// Library features (unwind):
#![feature(panic_unwind)]
Expand Down

0 comments on commit 012903c

Please sign in to comment.