Skip to content

Commit 9e442b5

Browse files
committed
Auto merge of #92003 - matthiaskrgr:rollup-obgv0rt, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #91172 (Warn when a `#[test]`-like built-in attribute macro is present multiple times.) - #91796 (Fix since attribute for const_manually_drop feature) - #91879 (Remove `in_band_lifetimes` from `rustc_borrowck`) - #91947 (Add `io::Error::other`) - #91967 (Pull in libdevstat on FreeBSD) - #91987 (Add module documentation for rustdoc passes) - #92001 (Fix default_method_body_is_const when used across crates) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents a5ed864 + 300c6b3 commit 9e442b5

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

core/src/mem/manually_drop.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl<T> ManuallyDrop<T> {
6464
/// ```
6565
#[must_use = "if you don't need the wrapper, you can use `mem::forget` instead"]
6666
#[stable(feature = "manually_drop", since = "1.20.0")]
67-
#[rustc_const_stable(feature = "const_manually_drop", since = "1.36.0")]
67+
#[rustc_const_stable(feature = "const_manually_drop", since = "1.32.0")]
6868
#[inline(always)]
6969
pub const fn new(value: T) -> ManuallyDrop<T> {
7070
ManuallyDrop { value }
@@ -82,7 +82,7 @@ impl<T> ManuallyDrop<T> {
8282
/// let _: Box<()> = ManuallyDrop::into_inner(x); // This drops the `Box`.
8383
/// ```
8484
#[stable(feature = "manually_drop", since = "1.20.0")]
85-
#[rustc_const_stable(feature = "const_manually_drop", since = "1.36.0")]
85+
#[rustc_const_stable(feature = "const_manually_drop", since = "1.32.0")]
8686
#[inline(always)]
8787
pub const fn into_inner(slot: ManuallyDrop<T>) -> T {
8888
slot.value

std/src/io/error.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,33 @@ impl Error {
417417
Self::_new(kind, error.into())
418418
}
419419

420+
/// Creates a new I/O error from an arbitrary error payload.
421+
///
422+
/// This function is used to generically create I/O errors which do not
423+
/// originate from the OS itself. It is a shortcut for [`Error::new`]
424+
/// with [`ErrorKind::Other`].
425+
///
426+
/// # Examples
427+
///
428+
/// ```
429+
/// #![feature(io_error_other)]
430+
///
431+
/// use std::io::Error;
432+
///
433+
/// // errors can be created from strings
434+
/// let custom_error = Error::other("oh no!");
435+
///
436+
/// // errors can also be created from other errors
437+
/// let custom_error2 = Error::other(custom_error);
438+
/// ```
439+
#[unstable(feature = "io_error_other", issue = "91946")]
440+
pub fn other<E>(error: E) -> Error
441+
where
442+
E: Into<Box<dyn error::Error + Send + Sync>>,
443+
{
444+
Self::_new(ErrorKind::Other, error.into())
445+
}
446+
420447
fn _new(kind: ErrorKind, error: Box<dyn error::Error + Send + Sync>) -> Error {
421448
Error { repr: Repr::Custom(Box::new(Custom { kind, error })) }
422449
}

0 commit comments

Comments
 (0)