Add `suggestion` for some `#[deprecated]` items

This commit is contained in:
Dmitry Murzin 2023-08-21 12:51:51 +03:00
parent 4dbc7e3092
commit 07b57f9a7a
No known key found for this signature in database
GPG Key ID: 3DA7EB8E3131A454
7 changed files with 21 additions and 5 deletions

View File

@ -118,6 +118,7 @@
#![feature(const_waker)]
#![feature(core_intrinsics)]
#![feature(core_panic)]
#![feature(deprecated_suggestion)]
#![feature(dispatch_from_dyn)]
#![feature(error_generic_member_access)]
#![feature(error_in_core)]

View File

@ -592,7 +592,7 @@ impl<T> [T] {
/// ```
#[rustc_allow_incoherent_impl]
#[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(since = "1.3.0", note = "renamed to join")]
#[deprecated(since = "1.3.0", note = "renamed to join", suggestion = "join")]
pub fn connect<Separator>(&self, sep: Separator) -> <Self as Join<Separator>>::Output
where
Self: Join<Separator>,

View File

@ -413,7 +413,7 @@ pub const unsafe fn size_of_val_raw<T: ?Sized>(val: *const T) -> usize {
#[inline]
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(note = "use `align_of` instead", since = "1.2.0")]
#[deprecated(note = "use `align_of` instead", since = "1.2.0", suggestion = "align_of")]
pub fn min_align_of<T>() -> usize {
intrinsics::min_align_of::<T>()
}
@ -436,7 +436,7 @@ pub fn min_align_of<T>() -> usize {
#[inline]
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(note = "use `align_of_val` instead", since = "1.2.0")]
#[deprecated(note = "use `align_of_val` instead", since = "1.2.0", suggestion = "align_of_val")]
pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
// SAFETY: val is a reference, so it's a valid raw pointer
unsafe { intrinsics::min_align_of_val(val) }

View File

@ -993,7 +993,7 @@ impl str {
/// An iterator over the lines of a string.
#[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(since = "1.4.0", note = "use lines() instead now")]
#[deprecated(since = "1.4.0", note = "use lines() instead now", suggestion = "lines")]
#[inline]
#[allow(deprecated)]
pub fn lines_any(&self) -> LinesAny<'_> {

View File

@ -6,4 +6,6 @@ fn main() {
let _foo = str::trim_start(" aoeu"); //~ ERROR use of deprecated method `core::str::<impl str>::trim_left`: superseded by `trim_start` [deprecated]
let _bar = " aoeu".trim_start(); //~ ERROR use of deprecated method `core::str::<impl str>::trim_left`: superseded by `trim_start` [deprecated]
let _baz = ["a", "b"].join(" "); //~ ERROR use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join [deprecated]
}

View File

@ -6,4 +6,6 @@ fn main() {
let _foo = str::trim_left(" aoeu"); //~ ERROR use of deprecated method `core::str::<impl str>::trim_left`: superseded by `trim_start` [deprecated]
let _bar = " aoeu".trim_left(); //~ ERROR use of deprecated method `core::str::<impl str>::trim_left`: superseded by `trim_start` [deprecated]
let _baz = ["a", "b"].connect(" "); //~ ERROR use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join [deprecated]
}

View File

@ -25,5 +25,16 @@ help: replace the use of the deprecated method
LL | let _bar = " aoeu".trim_start();
| ~~~~~~~~~~
error: aborting due to 2 previous errors
error: use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join
--> $DIR/issue-84637-deprecated-associated-function.rs:10:27
|
LL | let _baz = ["a", "b"].connect(" ");
| ^^^^^^^
|
help: replace the use of the deprecated method
|
LL | let _baz = ["a", "b"].join(" ");
| ~~~~
error: aborting due to 3 previous errors