diff options
| author | bors <bors@rust-lang.org> | 2024-02-23 00:42:56 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-02-23 00:42:56 +0000 |
| commit | a28d221a4b31de1bda3debcadd3fa2d9bd988e5b (patch) | |
| tree | a047ef41a509efcfc87cb0c88aef606134f9c207 /tests/rustdoc-js-std/return-specific.js | |
| parent | 397937d812852f9bbeb671005cb399dbcb357cde (diff) | |
| parent | 91d0b371ef2b7a6cdca5f723ba96b6fbfd08ca4c (diff) | |
| download | rust-a28d221a4b31de1bda3debcadd3fa2d9bd988e5b.tar.gz rust-a28d221a4b31de1bda3debcadd3fa2d9bd988e5b.zip | |
Auto merge of #120730 - estebank:confusable-api, r=oli-obk
Provide suggestions through `rustc_confusables` annotations
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();
| ~~~~~~
```
Fix #59450 (we can open subsequent tickets for specific cases).
Fix #108437:
```
error[E0599]: `Option<{integer}>` is not an iterator
--> f101.rs:3:9
|
3 | opt.flat_map(|val| Some(val));
| ^^^^^^^^ `Option<{integer}>` is not an iterator
|
::: /home/gh-estebank/rust/library/core/src/option.rs:571:1
|
571 | pub enum Option<T> {
| ------------------ doesn't satisfy `Option<{integer}>: Iterator`
|
= note: the following trait bounds were not satisfied:
`Option<{integer}>: Iterator`
which is required by `&mut Option<{integer}>: Iterator`
help: you might have meant to use `and_then`
|
3 | opt.and_then(|val| Some(val));
| ~~~~~~~~
```
On type error of method call arguments, look at confusables for suggestion. Fix #87212:
```
error[E0308]: mismatched types
--> f101.rs:8:18
|
8 | stuff.append(Thing);
| ------ ^^^^^ expected `&mut Vec<Thing>`, found `Thing`
| |
| arguments to this method are incorrect
|
= note: expected mutable reference `&mut Vec<Thing>`
found struct `Thing`
note: method defined here
--> /home/gh-estebank/rust/library/alloc/src/vec/mod.rs:2025:12
|
2025 | pub fn append(&mut self, other: &mut Self) {
| ^^^^^^
help: you might have meant to use `push`
|
8 | stuff.push(Thing);
| ~~~~
```
Diffstat (limited to 'tests/rustdoc-js-std/return-specific.js')
0 files changed, 0 insertions, 0 deletions
