Skip to content

Commit

Permalink
Rollup merge of rust-lang#125951 - slanterns:error_in_core_stabilizat…
Browse files Browse the repository at this point in the history
…ion, r=Amanieu

Stabilize `error_in_core`

Closes: rust-lang#103765.

`@rustbot` label: +T-libs-api

r? libs-api
  • Loading branch information
fmease committed Jun 8, 2024
2 parents 804421d + f275ca0 commit cbda797
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 20 deletions.
1 change: 0 additions & 1 deletion library/alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@
#![feature(deref_pure_trait)]
#![feature(dispatch_from_dyn)]
#![feature(error_generic_member_access)]
#![feature(error_in_core)]
#![feature(exact_size_is_empty)]
#![feature(extend_one)]
#![feature(fmt_internals)]
Expand Down
16 changes: 3 additions & 13 deletions library/core/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![doc = include_str!("error.md")]
#![unstable(feature = "error_in_core", issue = "103765")]
#![stable(feature = "error_in_core", since = "CURRENT_RUSTC_VERSION")]

#[cfg(test)]
mod tests;
Expand Down Expand Up @@ -130,7 +130,6 @@ pub trait Error: Debug + Display {
///
/// ```rust
/// #![feature(error_generic_member_access)]
/// #![feature(error_in_core)]
/// use core::fmt;
/// use core::error::{request_ref, Request};
///
Expand Down Expand Up @@ -361,8 +360,7 @@ impl dyn Error {
/// Get a string value from an error.
///
/// ```rust
/// # #![feature(error_generic_member_access)]
/// # #![feature(error_in_core)]
/// #![feature(error_generic_member_access)]
/// use std::error::Error;
/// use core::error::request_value;
///
Expand All @@ -385,8 +383,7 @@ where
/// Get a string reference from an error.
///
/// ```rust
/// # #![feature(error_generic_member_access)]
/// # #![feature(error_in_core)]
/// #![feature(error_generic_member_access)]
/// use core::error::Error;
/// use core::error::request_ref;
///
Expand Down Expand Up @@ -458,7 +455,6 @@ where
///
/// ```
/// #![feature(error_generic_member_access)]
/// #![feature(error_in_core)]
/// use core::fmt;
/// use core::error::Request;
/// use core::error::request_ref;
Expand Down Expand Up @@ -529,7 +525,6 @@ impl<'a> Request<'a> {
///
/// ```rust
/// #![feature(error_generic_member_access)]
/// #![feature(error_in_core)]
///
/// use core::error::Request;
///
Expand Down Expand Up @@ -564,7 +559,6 @@ impl<'a> Request<'a> {
///
/// ```rust
/// #![feature(error_generic_member_access)]
/// #![feature(error_in_core)]
///
/// use core::error::Request;
///
Expand Down Expand Up @@ -600,7 +594,6 @@ impl<'a> Request<'a> {
///
/// ```rust
/// #![feature(error_generic_member_access)]
/// #![feature(error_in_core)]
///
/// use core::error::Request;
///
Expand Down Expand Up @@ -633,7 +626,6 @@ impl<'a> Request<'a> {
///
/// ```rust
/// #![feature(error_generic_member_access)]
/// #![feature(error_in_core)]
///
/// use core::error::Request;
///
Expand Down Expand Up @@ -700,7 +692,6 @@ impl<'a> Request<'a> {
///
/// ```rust
/// #![feature(error_generic_member_access)]
/// #![feature(error_in_core)]
///
/// use core::error::Request;
/// use core::error::request_value;
Expand Down Expand Up @@ -788,7 +779,6 @@ impl<'a> Request<'a> {
///
/// ```rust
/// #![feature(error_generic_member_access)]
/// #![feature(error_in_core)]
///
/// use core::error::Request;
/// use core::error::request_ref;
Expand Down
1 change: 0 additions & 1 deletion library/core/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@
#![feature(const_slice_from_ref)]
#![feature(waker_getters)]
#![feature(error_generic_member_access)]
#![feature(error_in_core)]
#![feature(trait_upcasting)]
#![feature(is_ascii_octdigit)]
#![feature(get_many_mut)]
Expand Down
1 change: 0 additions & 1 deletion library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@
#![feature(core_io_borrowed_buf)]
#![feature(duration_constants)]
#![feature(error_generic_member_access)]
#![feature(error_in_core)]
#![feature(error_iter)]
#![feature(exact_size_is_empty)]
#![feature(exclusive_wrapper)]
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/tests/ui/std_instead_of_core.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ fn std_instead_of_core() {

let _ = std::env!("PATH");

// do not lint until `error_in_core` is stable
use std::error::Error;
use core::error::Error;
//~^ ERROR: used import from `std` instead of `core`

// lint items re-exported from private modules, `core::iter::traits::iterator::Iterator`
use core::iter::Iterator;
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/tests/ui/std_instead_of_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ fn std_instead_of_core() {

let _ = std::env!("PATH");

// do not lint until `error_in_core` is stable
use std::error::Error;
//~^ ERROR: used import from `std` instead of `core`

// lint items re-exported from private modules, `core::iter::traits::iterator::Iterator`
use std::iter::Iterator;
Expand Down
8 changes: 7 additions & 1 deletion src/tools/clippy/tests/ui/std_instead_of_core.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ error: used import from `std` instead of `core`
LL | let cell_absolute = ::std::cell::Cell::new(8u32);
| ^^^ help: consider importing the item from `core`: `core`

error: used import from `std` instead of `core`
--> tests/ui/std_instead_of_core.rs:48:9
|
LL | use std::error::Error;
| ^^^ help: consider importing the item from `core`: `core`

error: used import from `std` instead of `core`
--> tests/ui/std_instead_of_core.rs:52:9
|
Expand Down Expand Up @@ -79,5 +85,5 @@ LL | use alloc::slice::from_ref;
= note: `-D clippy::alloc-instead-of-core` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::alloc_instead_of_core)]`

error: aborting due to 12 previous errors
error: aborting due to 13 previous errors

0 comments on commit cbda797

Please sign in to comment.