Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion compiler/rustc_save_analysis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,9 @@ impl<'tcx> SaveContext<'tcx> {
if seg.res != Res::Err {
seg.res
} else {
// Avoid infinite recursion!
let parent_node = self.tcx.hir().get_parent_node(hir_id);
self.get_path_res(parent_node)
if parent_node != hir_id { self.get_path_res(parent_node) } else { Res::Err }
}
}

Expand Down
7 changes: 7 additions & 0 deletions src/test/ui/save-analysis/issue-101505.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// compile-flags: -Zsave-analysis

// Check that this doesn't loop infinitely.

fn a(self) {} //~ ERROR `self` parameter is only allowed in associated functions

fn main() {}
10 changes: 10 additions & 0 deletions src/test/ui/save-analysis/issue-101505.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
error: `self` parameter is only allowed in associated functions
--> $DIR/issue-101505.rs:5:6
|
LL | fn a(self) {}
| ^^^^ not semantically valid as function parameter
|
= note: associated functions are those in `impl` or `trait` definitions

error: aborting due to previous error