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<'_> {
440440 let ty = match self . infer_path ( p, tgt_expr. into ( ) ) {
441441 Some ( ty) => ty,
442442 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+ {
444445 self . push_diagnostic ( InferenceDiagnostic :: UnresolvedIdent {
445446 expr : tgt_expr,
446447 } ) ;
Original file line number Diff line number Diff line change @@ -53,6 +53,22 @@ fn main() {
5353 let x = 5;
5454 let _ = x;
5555}
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+ }
5672"# ,
5773 ) ;
5874 }
You can’t perform that action at this time.
0 commit comments