Auto merge of #95133 - matthiaskrgr:rollup-4q0u804, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #94749 (remove_dir_all: use fallback implementation on Miri)
 - #94948 (Fix diagnostics for `#![feature(deprecated_suggestion)]`)
 - #94989 (Add Stream alias for AsyncIterator)
 - #95108 (Give more details in `Display` for `hir::Target`)
 - #95110 (Provide more useful documentation of conversion methods)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2022-03-20 08:35:40 +00:00
commit 3b84829750
7 changed files with 22 additions and 17 deletions

View File

@ -758,8 +758,7 @@ where
if sess.is_nightly_build() { if sess.is_nightly_build() {
diag.help("add `#![feature(deprecated_suggestion)]` to the crate root"); diag.help("add `#![feature(deprecated_suggestion)]` to the crate root");
} }
// FIXME(jhpratt) change this to an actual tracking issue diag.note("see #94785 for more details").emit();
diag.note("see #XXX for more details").emit();
} }
if !get(mi, &mut suggestion) { if !get(mi, &mut suggestion) {
@ -772,10 +771,10 @@ where
meta.span(), meta.span(),
AttrError::UnknownMetaItem( AttrError::UnknownMetaItem(
pprust::path_to_string(&mi.path), pprust::path_to_string(&mi.path),
if attr.has_name(sym::deprecated) { if sess.features_untracked().deprecated_suggestion {
&["since", "note"]
} else {
&["since", "note", "suggestion"] &["since", "note", "suggestion"]
} else {
&["since", "note"]
}, },
), ),
); );

View File

@ -86,7 +86,11 @@ impl Display for Target {
Target::Statement => "statement", Target::Statement => "statement",
Target::Arm => "match arm", Target::Arm => "match arm",
Target::AssocConst => "associated const", Target::AssocConst => "associated const",
Target::Method(_) => "method", Target::Method(kind) => match kind {
MethodKind::Inherent => "inherent method",
MethodKind::Trait { body: false } => "required trait method",
MethodKind::Trait { body: true } => "provided trait method",
},
Target::AssocTy => "associated type", Target::AssocTy => "associated type",
Target::ForeignFn => "foreign function", Target::ForeignFn => "foreign function",
Target::ForeignStatic => "foreign static item", Target::ForeignStatic => "foreign static item",

View File

@ -12,6 +12,7 @@ use crate::task::{Context, Poll};
/// [impl]: index.html#implementing-async-iterator /// [impl]: index.html#implementing-async-iterator
#[unstable(feature = "async_iterator", issue = "79024")] #[unstable(feature = "async_iterator", issue = "79024")]
#[must_use = "async iterators do nothing unless polled"] #[must_use = "async iterators do nothing unless polled"]
#[doc(alias = "Stream")]
pub trait AsyncIterator { pub trait AsyncIterator {
/// The type of items yielded by the async iterator. /// The type of items yielded by the async iterator.
type Item; type Item;

View File

@ -154,7 +154,7 @@ pub const fn identity<T>(x: T) -> T {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "AsRef")] #[cfg_attr(not(test), rustc_diagnostic_item = "AsRef")]
pub trait AsRef<T: ?Sized> { pub trait AsRef<T: ?Sized> {
/// Performs the conversion. /// Converts this type into a shared reference of the (usually inferred) input type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn as_ref(&self) -> &T; fn as_ref(&self) -> &T;
} }
@ -196,7 +196,7 @@ pub trait AsRef<T: ?Sized> {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "AsMut")] #[cfg_attr(not(test), rustc_diagnostic_item = "AsMut")]
pub trait AsMut<T: ?Sized> { pub trait AsMut<T: ?Sized> {
/// Performs the conversion. /// Converts this type into a mutable reference of the (usually inferred) input type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn as_mut(&mut self) -> &mut T; fn as_mut(&mut self) -> &mut T;
} }
@ -272,7 +272,7 @@ pub trait AsMut<T: ?Sized> {
#[rustc_diagnostic_item = "Into"] #[rustc_diagnostic_item = "Into"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Into<T>: Sized { pub trait Into<T>: Sized {
/// Performs the conversion. /// Converts this type into the (usually inferred) input type.
#[must_use] #[must_use]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn into(self) -> T; fn into(self) -> T;
@ -367,7 +367,7 @@ pub trait Into<T>: Sized {
note = "to coerce a `{T}` into a `{Self}`, use `&*` as a prefix", note = "to coerce a `{T}` into a `{Self}`, use `&*` as a prefix",
))] ))]
pub trait From<T>: Sized { pub trait From<T>: Sized {
/// Performs the conversion. /// Converts to this type from the input type.
#[lang = "from"] #[lang = "from"]
#[must_use] #[must_use]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]

View File

@ -2049,9 +2049,10 @@ pub fn remove_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
/// ///
/// [changes]: io#platform-specific-behavior /// [changes]: io#platform-specific-behavior
/// ///
/// On macOS before version 10.10 and REDOX this function is not protected against time-of-check to /// On macOS before version 10.10 and REDOX, as well as when running in Miri for any target, this
/// time-of-use (TOCTOU) race conditions, and should not be used in security-sensitive code on /// function is not protected against time-of-check to time-of-use (TOCTOU) race conditions, and
/// those platforms. All other platforms are protected. /// should not be used in security-sensitive code on those platforms. All other platforms are
/// protected.
/// ///
/// # Errors /// # Errors
/// ///

View File

@ -1517,14 +1517,14 @@ pub fn chroot(dir: &Path) -> io::Result<()> {
pub use remove_dir_impl::remove_dir_all; pub use remove_dir_impl::remove_dir_all;
// Fallback for REDOX and ESP-IDF // Fallback for REDOX and ESP-IDF (and Miri)
#[cfg(any(target_os = "redox", target_os = "espidf"))] #[cfg(any(target_os = "redox", target_os = "espidf", miri))]
mod remove_dir_impl { mod remove_dir_impl {
pub use crate::sys_common::fs::remove_dir_all; pub use crate::sys_common::fs::remove_dir_all;
} }
// Modern implementation using openat(), unlinkat() and fdopendir() // Modern implementation using openat(), unlinkat() and fdopendir()
#[cfg(not(any(target_os = "redox", target_os = "espidf")))] #[cfg(not(any(target_os = "redox", target_os = "espidf", miri)))]
mod remove_dir_impl { mod remove_dir_impl {
use super::{cstr, lstat, Dir, DirEntry, InnerReadDir, ReadDir}; use super::{cstr, lstat, Dir, DirEntry, InnerReadDir, ReadDir};
use crate::ffi::CStr; use crate::ffi::CStr;

View File

@ -5,7 +5,7 @@ LL | #[deprecated(suggestion = "foo")]
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
| |
= help: add `#![feature(deprecated_suggestion)]` to the crate root = help: add `#![feature(deprecated_suggestion)]` to the crate root
= note: see #XXX for more details = note: see #94785 for more details
error: aborting due to previous error error: aborting due to previous error