-
-
Notifications
You must be signed in to change notification settings - Fork 17.6k
rustc suggests &None.as_ref() as well as None #100605
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Activity
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=9d89810932e63366d4910a3d8cca200e
The current output is:
The error is correct, but I think the diagnostic is wrong. The second recommendation to call
takes_option(None)is sound, but the first one (&None.as_ref()) seems like bad advice.This reproduces on
rustc1.61 (on my workstation), as well as 1.63 (stable channel in playground), 1.64 (beta channel in playground), and 1.65 (nightly channel in playground).