]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #83669 - kwj2104:issue-81508-fix, r=varkor
authorDylan DPC <dylan.dpc@gmail.com>
Sun, 11 Apr 2021 23:04:03 +0000 (01:04 +0200)
committerGitHub <noreply@github.com>
Sun, 11 Apr 2021 23:04:03 +0000 (01:04 +0200)
commitb6780b3a20ad9f482911119eee84b0ad5a495af6
tree7a525f830b669c1b37cf38994cf9258599a37e7e
parenta8661245649f3d1c0dc5b23270bdac0bbd2d8f64
parentf51f25ab7de7c737ab67d79e23691b8f8f642a8c
Rollup merge of #83669 - kwj2104:issue-81508-fix, r=varkor

Issue 81508 fix

Fix #81508

**Problem**: When variable name is used incorrectly as path, error and warning point to undeclared/unused name, when in fact the name is used, just incorrectly (should be used as a variable, not part of a path).

**Summary for fix**: When path resolution errs, diagnostics checks for variables in ```ValueNS``` that have the same name (e.g., variable rather than path named Foo), and adds additional suggestion that user may actually intend to use the variable name rather than a path.

The fix does not suppress or otherwise change the *warning* that results. I did not find a straightforward way in the code to modify this, but would love to make changes here as well with any guidance.
compiler/rustc_resolve/src/lib.rs