Rollup merge of #126236 - Bryanskiy:delegation-no-entry-ice-2, r=petrochenkov
Delegation: fix ICE on recursive delegation fixes https://github.com/rust-lang/rust/issues/124347 r? `@petrochenkov`
This commit is contained in:
commit
279d2b73f1
@ -67,7 +67,9 @@ pub(crate) fn delegation_has_self(&self, item_id: NodeId, path_id: NodeId, span:
|
||||
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,
|
||||
|
@ -1,4 +0,0 @@
|
||||
//@ known-bug: #124347
|
||||
trait Trait: ToReuse {
|
||||
reuse Trait::lolno { &self.0 };
|
||||
}
|
12
tests/ui/delegation/ice-issue-124347.rs
Normal file
12
tests/ui/delegation/ice-issue-124347.rs
Normal file
@ -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
tests/ui/delegation/ice-issue-124347.stderr
Normal file
14
tests/ui/delegation/ice-issue-124347.stderr
Normal file
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user