Skip to content

Commit

Permalink
Unrolled build for rust-lang#126236
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#126236 - Bryanskiy:delegation-no-entry-ice-2, r=petrochenkov

Delegation: fix ICE on recursive delegation

fixes rust-lang#124347

r? `@petrochenkov`
  • Loading branch information
rust-timer authored Jun 11, 2024
2 parents 20ba13c + 6f78e62 commit 983615b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
4 changes: 3 additions & 1 deletion compiler/rustc_ast_lowering/src/delegation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
return false;
};
if let Some(local_sig_id) = sig_id.as_local() {
self.resolver.delegation_fn_sigs[&local_sig_id].has_self
// The value may be missing due to recursive delegation.
// Error will be emmited later during HIR ty lowering.
self.resolver.delegation_fn_sigs.get(&local_sig_id).map_or(false, |sig| sig.has_self)
} else {
match self.tcx.def_kind(sig_id) {
DefKind::Fn => false,
Expand Down
4 changes: 0 additions & 4 deletions tests/crashes/124347.rs

This file was deleted.

12 changes: 12 additions & 0 deletions tests/ui/delegation/ice-issue-124347.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#![feature(fn_delegation)]
#![allow(incomplete_features)]

trait Trait {
reuse Trait::foo { &self.0 }
//~^ ERROR recursive delegation is not supported yet
}

reuse foo;
//~^ ERROR recursive delegation is not supported yet

fn main() {}
14 changes: 14 additions & 0 deletions tests/ui/delegation/ice-issue-124347.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error: recursive delegation is not supported yet
--> $DIR/ice-issue-124347.rs:5:18
|
LL | reuse Trait::foo { &self.0 }
| ^^^ callee defined here

error: recursive delegation is not supported yet
--> $DIR/ice-issue-124347.rs:9:7
|
LL | reuse foo;
| ^^^ callee defined here

error: aborting due to 2 previous errors

0 comments on commit 983615b

Please sign in to comment.