Skip to content

Commit 8473ea8

Browse files
committed
Delete architecture-specific memchr code in std::sys
Currently all architecture-specific memchr code is only used in `std::io`. Most of the actual `memchr` capacity exposed to the user through the slice API is instead implemented in core::slice::memchr. Hence this commit deletes memchr from std::sys[_common] and replace calls to it by calls to core::slice::memchr functions. This deletes (r)memchr from the list of symbols linked to libc.
1 parent 1aa6aef commit 8473ea8

File tree

21 files changed

+7
-141
lines changed

21 files changed

+7
-141
lines changed

library/std/src/io/buffered/linewritershim.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::io::{self, BufWriter, IoSlice, Write};
2-
use crate::sys_common::memchr;
2+
use core::slice::memchr;
33

44
/// Private helper struct for implementing the line-buffered writing logic.
55
/// This shim temporarily wraps a BufWriter, and uses its internals to

library/std/src/io/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ use crate::ops::{Deref, DerefMut};
304304
use crate::slice;
305305
use crate::str;
306306
use crate::sys;
307-
use crate::sys_common::memchr;
307+
use core::slice::memchr;
308308

309309
#[stable(feature = "bufwriter_into_parts", since = "1.56.0")]
310310
pub use self::buffered::WriterPanicked;

library/std/src/sys/hermit/memchr.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

library/std/src/sys/hermit/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ pub mod fs;
2727
pub mod futex;
2828
#[path = "../unsupported/io.rs"]
2929
pub mod io;
30-
pub mod memchr;
3130
pub mod net;
3231
pub mod os;
3332
#[path = "../unix/os_str.rs"]

library/std/src/sys/hermit/os.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ use crate::path::{self, PathBuf};
99
use crate::str;
1010
use crate::sync::Mutex;
1111
use crate::sys::hermit::abi;
12-
use crate::sys::memchr;
1312
use crate::sys::unsupported;
1413
use crate::vec;
14+
use core::slice::memchr;
1515

1616
pub fn errno() -> i32 {
1717
0

library/std/src/sys/sgx/memchr.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

library/std/src/sys/sgx/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ pub mod fd;
2121
pub mod fs;
2222
#[path = "../unsupported/io.rs"]
2323
pub mod io;
24-
pub mod memchr;
2524
pub mod net;
2625
pub mod os;
2726
#[path = "../unix/os_str.rs"]

library/std/src/sys/solid/memchr.rs

Lines changed: 0 additions & 21 deletions
This file was deleted.

library/std/src/sys/solid/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ pub mod pipe;
4040
pub mod process;
4141
pub mod stdio;
4242
pub use self::itron::thread;
43-
pub mod memchr;
4443
pub mod thread_local_dtor;
4544
pub mod thread_local_key;
4645
pub use self::itron::thread_parking;

library/std/src/sys/solid/os.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ use crate::sync::{PoisonError, RwLock};
1212
use crate::sys::common::small_c_string::run_with_cstr;
1313
use crate::vec;
1414

15-
use super::{error, itron, memchr};
15+
use super::{error, itron};
16+
use core::slice::memchr;
1617

1718
// `solid` directly maps `errno`s to μITRON error codes.
1819
impl itron::error::ItronError {

0 commit comments

Comments
 (0)