File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
src/tools/rust-analyzer/crates
ide-diagnostics/src/handlers Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -440,7 +440,8 @@ impl InferenceContext<'_> {
440
440
let ty = match self . infer_path ( p, tgt_expr. into ( ) ) {
441
441
Some ( ty) => ty,
442
442
None => {
443
- if matches ! ( p, Path :: Normal { mod_path, .. } if mod_path. is_ident( ) ) {
443
+ if matches ! ( p, Path :: Normal { mod_path, .. } if mod_path. is_ident( ) || mod_path. is_self( ) )
444
+ {
444
445
self . push_diagnostic ( InferenceDiagnostic :: UnresolvedIdent {
445
446
expr : tgt_expr,
446
447
} ) ;
Original file line number Diff line number Diff line change @@ -53,6 +53,22 @@ fn main() {
53
53
let x = 5;
54
54
let _ = x;
55
55
}
56
+ "# ,
57
+ ) ;
58
+ }
59
+
60
+ #[ test]
61
+ fn unresolved_self_val ( ) {
62
+ check_diagnostics (
63
+ r#"
64
+ fn main() {
65
+ self.a;
66
+ //^^^^ error: no such value in this scope
67
+ let self:
68
+ self =
69
+ self;
70
+ //^^^^ error: no such value in this scope
71
+ }
56
72
"# ,
57
73
) ;
58
74
}
You can’t perform that action at this time.
0 commit comments