-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[ui] Incorrect hint: Ok(wrap) instead *Deref #52537
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Here's where the suggestion gets issued: rust/src/librustc/infer/error_reporting/mod.rs Lines 504 to 513 in 6cc78bf
The motivation was to solve #51632 (where a |
Here's another case of this: struct Foo;
fn takes_ref(_r: &Foo) {}
fn returns_result() -> Result<Foo,()> {}
fn main() -> Result<(),()> {
takes_ref(returns_result()?);
Ok(())
}
|
@zackmdavis I see what's happening, we're only checking wether the error came from a |
Clippy has helper functions to detect this that we might want to uplift ... |
(But for now I'm just going to remove the suggestion.) |
This suggestion was introduced in rust-lang#51938 / 6cc78bf (while introducing different language for type errors coming from `?` rather than a `match`), but it has a lot of false-positives (as repeatedly reported in Issues rust-lang#52537, rust-lang#52598, rust-lang#54578, rust-lang#55336), and incorrect suggestions carry more badness than marginal good suggestions do goodness. Just get rid of it (unless and until someone figures out how to do it correctly). Resolves rust-lang#52537, resolves rust-lang#54578.
…ng_suggestion, r=estebank back out bogus `Ok`-wrapping suggestion on `?` arm type mismatch This suggestion was introduced in rust-lang#51938 / 6cc78bf (while introducing different language for type errors coming from `?` rather than a `match`), but it has a lot of false-positives, and incorrect suggestions carry more badness than marginal good suggestions do goodness. I regret not doing this earlier. 😞 Resolves rust-lang#52537, resolves rust-lang#54578. r? @estebank
This suggestion was introduced in rust-lang#51938 / 6cc78bf (while introducing different language for type errors coming from `?` rather than a `match`), but it has a lot of false-positives (as repeatedly reported in Issues rust-lang#52537, rust-lang#52598, rust-lang#54578, rust-lang#55336), and incorrect suggestions carry more badness than marginal good suggestions do goodness. Just get rid of it (unless and until someone figures out how to do it correctly). Resolves rust-lang#52537, resolves rust-lang#54578.
Uh oh!
There was an error while loading. Please reload this page.
Reproduced on versions:
rustc 1.29.0-nightly (12ed235ad 2018-07-18)
rustc 1.29.0-nightly (9fd3d7899 2018-07-07)
rustc 1.27.0 (3eda71b00 2018-06-19)
Isolated example to reproduce:
Actual error:
Mentioned suggestion about "wrap into
Ok
" is incorrect at all. There we should deref the value from theget_state()?
.Expected error: (something like this)
... expected struct `State`, found struct `StateDeref` help: try re-dereference(?) with a success variant: `&*get_state()?`
The text was updated successfully, but these errors were encountered: