Add rustc_confusables
annotations to some stdlib APIs
Help with common API confusion, like asking for `push` when the data structure really has `append`. ``` error[E0599]: no method named `size` found for struct `Vec<{integer}>` in the current scope --> $DIR/rustc_confusables_std_cases.rs:17:7 | LL | x.size(); | ^^^^ | help: you might have meant to use `len` | LL | x.len(); | ~~~ help: there is a method with a similar name | LL | x.resize(); | ~~~~~~ ``` #59450
This commit is contained in:
parent
933a05bd0b
commit
e5b3c7ef14
20 changed files with 180 additions and 29 deletions
|
@ -25,6 +25,7 @@ impl<T: LambdaL> ScopedCell<T> {
|
|||
/// running `f`, which gets the old value, mutably.
|
||||
/// The old value will be restored after `f` exits, even
|
||||
/// by panic, including modifications made to it by `f`.
|
||||
#[rustc_confusables("swap")]
|
||||
pub fn replace<'a, R>(
|
||||
&self,
|
||||
replacement: <T as ApplyL<'a>>::Out,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue