File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed
compiler/rustc_save_analysis/src
src/test/ui/save-analysis Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -600,8 +600,9 @@ impl<'tcx> SaveContext<'tcx> {
600600 if seg. res != Res :: Err {
601601 seg. res
602602 } else {
603+ // Avoid infinite recursion!
603604 let parent_node = self . tcx . hir ( ) . get_parent_node ( hir_id) ;
604- self . get_path_res ( parent_node)
605+ if parent_node != hir_id { self . get_path_res ( parent_node) } else { Res :: Err }
605606 }
606607 }
607608
Original file line number Diff line number Diff line change 1+ // compile-flags: -Zsave-analysis
2+
3+ // Check that this doesn't loop infinitely.
4+
5+ fn a ( self ) { } //~ ERROR `self` parameter is only allowed in associated functions
6+
7+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error: `self` parameter is only allowed in associated functions
2+ --> $DIR/issue-101505.rs:5:6
3+ |
4+ LL | fn a(self) {}
5+ | ^^^^ not semantically valid as function parameter
6+ |
7+ = note: associated functions are those in `impl` or `trait` definitions
8+
9+ error: aborting due to previous error
10+
You can’t perform that action at this time.
0 commit comments