Skip to content

Commit 16624a6

Browse files
committed
Add dedicated feature for core::io stability
Both `io_error_kind_in_core` and `core_io_borrowed_buf` require an unstable `core::io` module, but there is no way to make a module unstable and activated by `any(...)`
1 parent ebf3f9d commit 16624a6

File tree

7 files changed

+31
-1
lines changed

7 files changed

+31
-1
lines changed

library/core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ pub mod bstr;
294294
pub mod cell;
295295
pub mod char;
296296
pub mod ffi;
297-
#[unstable(feature = "core_io_borrowed_buf", issue = "117693")]
297+
#[unstable(feature = "core_io", issue = "154046")]
298298
pub mod io;
299299
pub mod iter;
300300
pub mod net;

library/coretests/tests/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#![feature(const_unsigned_bigint_helpers)]
3636
#![feature(core_intrinsics)]
3737
#![feature(core_intrinsics_fallbacks)]
38+
#![feature(core_io)]
3839
#![feature(core_io_borrowed_buf)]
3940
#![feature(core_private_bignum)]
4041
#![feature(core_private_diy_float)]

library/std/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@
320320
#![feature(const_default)]
321321
#![feature(core_float_math)]
322322
#![feature(core_intrinsics)]
323+
#![feature(core_io)]
323324
#![feature(core_io_borrowed_buf)]
324325
#![feature(cstr_display)]
325326
#![feature(drop_guard)]

library/std/src/os/unix/fs.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ pub trait FileExt {
140140
/// # Examples
141141
///
142142
/// ```no_run
143+
/// #![feature(core_io)]
143144
/// #![feature(core_io_borrowed_buf)]
144145
/// #![feature(read_buf_at)]
145146
///
@@ -176,6 +177,7 @@ pub trait FileExt {
176177
/// # Examples
177178
///
178179
/// ```no_run
180+
/// #![feature(core_io)]
179181
/// #![feature(core_io_borrowed_buf)]
180182
/// #![feature(read_buf_at)]
181183
///

library/std/src/os/windows/fs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ pub trait FileExt {
6161
/// # Examples
6262
///
6363
/// ```no_run
64+
/// #![feature(core_io)]
6465
/// #![feature(core_io_borrowed_buf)]
6566
/// #![feature(read_buf_at)]
6667
///
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Ensure `ErrorKind` from `core` is gated behind `io_error_kind_in_core`
2+
//@ edition:2024
3+
4+
use std::io::ErrorKind as ErrorKindFromStd;
5+
6+
use core::io::ErrorKind as ErrorKindFromCore;
7+
//~^ ERROR use of unstable library feature `core_io`
8+
9+
// Asserting both ErrorKinds are the same.
10+
const _: [ErrorKindFromCore; 1] = [ErrorKindFromStd::Other];
11+
12+
fn main() {}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error[E0658]: use of unstable library feature `core_io`
2+
--> $DIR/feature-gate-io_error_kind_in_core.rs:6:5
3+
|
4+
LL | use core::io::ErrorKind as ErrorKindFromCore;
5+
| ^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #154046 <https://github.com/rust-lang/rust/issues/154046> for more information
8+
= help: add `#![feature(core_io)]` to the crate attributes to enable
9+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10+
11+
error: aborting due to 1 previous error
12+
13+
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)