-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Suggest the right help message for as_ref #100617
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
I thought it will broke some tests, |
Thanks @bors r+ rollup |
…errors Suggest the right help message for as_ref Fixes rust-lang#100605
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#100186 (Mention `as_mut` alongside `as_ref` in borrowck error message) - rust-lang#100383 (Mitigate stale data reads on SGX platform) - rust-lang#100507 (suggest `once_cell::Lazy` for non-const statics) - rust-lang#100617 (Suggest the right help message for as_ref) - rust-lang#100667 (Migrate "invalid variable declaration" errors to SessionDiagnostic) - rust-lang#100709 (Migrate typeck's `used` expected symbol diagnostic to `SessionDiagnostic`) - rust-lang#100723 (Add the diagnostic translation lints to crates that don't emit them) - rust-lang#100729 (Avoid zeroing a 1kb stack buffer on every call to `std::sys::windows::fill_utf16_buf`) - rust-lang#100750 (improved diagnostic for function defined with `def`, `fun`, `func`, or `function` instead of `fn`) - rust-lang#100763 (triagebot: Autolabel `A-rustdoc-json`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
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.
I don't think this fixes the problem fully. We have at least 3 other unary operators, namely *
, !
and -
that can return arbitrary values and for them the diagnostic is still broken. Maybe we should to do something more general with method suggestions?...
Yes, I didn't consider these cases, this need some extra work. *none.as_ref()
Ofcourse, the right and best diagnostic is we need when to add the '( )'
|
Fixes #100605