I recently found that the compiler is missing a good hint of misusing methods as functions. For example, if there is fn foo(&self);
, and I called bar::foo()
instead of bar.foo()
(the correct one), the compiler wil emit error[E0433]: failed to resolve: use of undeclared type or module 'val'
. For your convenience, here goes a playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=a737d2347b79083e0d6b0a85590f3999.
I think this should be improved, but I wonder whether this requires a RFC, and, if yes, does there exist any RFCs I can use as a guidance of writing the RFC. If not, then how would I contribute to Rust?
Besides, would anyone come up with a better idea of how this should be handled? As far as I see, a note would be attached if such mistake detected.
Sorry for any possible disturbance, but I am quite a newbie to Rust compiler, and I really need some guidance.