-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add suggestion
for some #[deprecated]
items
#113365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add suggestion
for some #[deprecated]
items
#113365
Conversation
r? @m-ou-se (rustbot has picked a reviewer for you, use r? to override) |
What do the error messages for these look like? At first brush, it seems like the existing r? @workingjubilee |
@workingjubilee updated PR description with example and added test. By the way there are existing deprecated methods with |
Oh yes, I agree we should add deprecation suggestions, I'm just not entirely sure if we should have both a |
@workingjubilee so what are next steps here, should I remove |
Ah, very good. Hmmm. It feels to me that the notes which are literally just suggestions should be removed... Except... you can't, I just tried while taking another look at this. Oops? I didn't realize that, sorry. That... should probably be allowed? @bors r+ rollup=always |
…estions, r=workingjubilee Add `suggestion` for some `#[deprecated]` items Consider code: ```rust fn main() { let _ = ["a", "b"].connect(" "); } ``` Currently it shows deprecated warning: ```rust warning: use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join --> src/main.rs:2:24 | 2 | let _ = ["a", "b"].connect(" "); | ^^^^^^^ | = note: `#[warn(deprecated)]` on by default ``` This PR adds `suggestion` for `connect` and some other deprecated items, so the warning will be changed to this: ```rust warning: use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join --> src/main.rs:2:24 | 2 | let _ = ["a", "b"].connect(" "); | ^^^^^^^ | = note: `#[warn(deprecated)]` on by default help: replace the use of the deprecated method | 2 | let _ = ["a", "b"].join(" "); | ^^^^ ```
…estions, r=workingjubilee Add `suggestion` for some `#[deprecated]` items Consider code: ```rust fn main() { let _ = ["a", "b"].connect(" "); } ``` Currently it shows deprecated warning: ```rust warning: use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join --> src/main.rs:2:24 | 2 | let _ = ["a", "b"].connect(" "); | ^^^^^^^ | = note: `#[warn(deprecated)]` on by default ``` This PR adds `suggestion` for `connect` and some other deprecated items, so the warning will be changed to this: ```rust warning: use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join --> src/main.rs:2:24 | 2 | let _ = ["a", "b"].connect(" "); | ^^^^^^^ | = note: `#[warn(deprecated)]` on by default help: replace the use of the deprecated method | 2 | let _ = ["a", "b"].join(" "); | ^^^^ ```
…estions, r=workingjubilee Add `suggestion` for some `#[deprecated]` items Consider code: ```rust fn main() { let _ = ["a", "b"].connect(" "); } ``` Currently it shows deprecated warning: ```rust warning: use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join --> src/main.rs:2:24 | 2 | let _ = ["a", "b"].connect(" "); | ^^^^^^^ | = note: `#[warn(deprecated)]` on by default ``` This PR adds `suggestion` for `connect` and some other deprecated items, so the warning will be changed to this: ```rust warning: use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join --> src/main.rs:2:24 | 2 | let _ = ["a", "b"].connect(" "); | ^^^^^^^ | = note: `#[warn(deprecated)]` on by default help: replace the use of the deprecated method | 2 | let _ = ["a", "b"].join(" "); | ^^^^ ```
…estions, r=workingjubilee Add `suggestion` for some `#[deprecated]` items Consider code: ```rust fn main() { let _ = ["a", "b"].connect(" "); } ``` Currently it shows deprecated warning: ```rust warning: use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join --> src/main.rs:2:24 | 2 | let _ = ["a", "b"].connect(" "); | ^^^^^^^ | = note: `#[warn(deprecated)]` on by default ``` This PR adds `suggestion` for `connect` and some other deprecated items, so the warning will be changed to this: ```rust warning: use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join --> src/main.rs:2:24 | 2 | let _ = ["a", "b"].connect(" "); | ^^^^^^^ | = note: `#[warn(deprecated)]` on by default help: replace the use of the deprecated method | 2 | let _ = ["a", "b"].join(" "); | ^^^^ ```
library/std/src/sync/condvar.rs
Outdated
#[deprecated( | ||
since = "1.6.0", | ||
note = "replaced by `std::sync::Condvar::wait_timeout`", | ||
suggestion = "wait_timeout" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem correct, as the suggestion lint message is Applicability::MachineApplicable
, and wait_timeout
accepts a different type to wait_timeout_ms
. This means that cargo fix
would break working code.
I don't think |
Oh, you're right, I didn't think about the actual lint mechanics. |
@xfix Thank you for catching that. Though I think @dima74 That knocks this down to |
|
Yes. It feels somewhat stronger than an "average" MaybeIncorrect, where a MaybeIncorrect may send a Rust programmer, especially a learner, down a wildly incorrect path, at least in my experience. But it is much weaker than a MachineApplicable, which should be exactly right. |
@workingjubilee fixed |
Thank you! |
☀️ Test successful - checks-actions |
Finished benchmarking commit (795ade0): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 634.918s -> 634.501s (-0.07%) |
Consider code:
Currently it shows deprecated warning:
This PR adds
suggestion
forconnect
and some other deprecated items, so the warning will be changed to this: