Skip to content

Commit 88ac7ac

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 bb59453 commit 88ac7ac

File tree

23 files changed

+8
-231
lines changed

23 files changed

+8
-231
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/pal/hermit/memchr.rs

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

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ pub mod fs;
2525
pub mod futex;
2626
#[path = "../unsupported/io.rs"]
2727
pub mod io;
28-
pub mod memchr;
2928
pub mod net;
3029
pub mod os;
3130
#[path = "../unsupported/pipe.rs"]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ use crate::os::hermit::ffi::OsStringExt;
99
use crate::path::{self, PathBuf};
1010
use crate::str;
1111
use crate::sync::Mutex;
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/pal/sgx/memchr.rs

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

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ pub mod fd;
1717
pub mod fs;
1818
#[path = "../unsupported/io.rs"]
1919
pub mod io;
20-
pub mod memchr;
2120
pub mod net;
2221
pub mod os;
2322
#[path = "../unsupported/pipe.rs"]

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

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

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ pub mod pipe;
3333
pub mod process;
3434
pub mod stdio;
3535
pub use self::itron::thread;
36-
pub mod memchr;
3736
pub mod thread_local_dtor;
3837
pub mod thread_local_key;
3938
pub use self::itron::thread_parking;

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ 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+
17+
use core::slice::memchr;
1618

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

0 commit comments

Comments
 (0)