mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Delegation: fix ICE on late diagnostics
This commit is contained in:
parent
06194cadcd
commit
040791a9c5
@ -2041,8 +2041,11 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
|
||||
ast::AssocItemKind::Fn(..) => AssocSuggestion::AssocFn { called },
|
||||
ast::AssocItemKind::Type(..) => AssocSuggestion::AssocType,
|
||||
ast::AssocItemKind::Delegation(..)
|
||||
if self.r.delegation_fn_sigs[&self.r.local_def_id(assoc_item.id)]
|
||||
.has_self =>
|
||||
if self
|
||||
.r
|
||||
.delegation_fn_sigs
|
||||
.get(&self.r.local_def_id(assoc_item.id))
|
||||
.map_or(false, |sig| sig.has_self) =>
|
||||
{
|
||||
AssocSuggestion::MethodWithSelf { called }
|
||||
}
|
||||
|
@ -1,6 +0,0 @@
|
||||
//@ known-bug: #124342
|
||||
trait Trait2 : Trait {
|
||||
reuse <() as Trait>::async {
|
||||
(async || {}).await;
|
||||
};
|
||||
}
|
12
tests/ui/delegation/ice-issue-124342.rs
Normal file
12
tests/ui/delegation/ice-issue-124342.rs
Normal file
@ -0,0 +1,12 @@
|
||||
#![feature(fn_delegation)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
mod to_reuse {}
|
||||
|
||||
trait Trait {
|
||||
reuse to_reuse::foo { foo }
|
||||
//~^ ERROR cannot find function `foo` in module `to_reuse`
|
||||
//~| ERROR cannot find value `foo` in this scope
|
||||
}
|
||||
|
||||
fn main() {}
|
20
tests/ui/delegation/ice-issue-124342.stderr
Normal file
20
tests/ui/delegation/ice-issue-124342.stderr
Normal file
@ -0,0 +1,20 @@
|
||||
error[E0425]: cannot find function `foo` in module `to_reuse`
|
||||
--> $DIR/ice-issue-124342.rs:7:21
|
||||
|
|
||||
LL | reuse to_reuse::foo { foo }
|
||||
| ^^^ not found in `to_reuse`
|
||||
|
||||
error[E0425]: cannot find value `foo` in this scope
|
||||
--> $DIR/ice-issue-124342.rs:7:27
|
||||
|
|
||||
LL | reuse to_reuse::foo { foo }
|
||||
| ^^^
|
||||
|
|
||||
help: you might have meant to refer to the associated function
|
||||
|
|
||||
LL | reuse to_reuse::foo { Self::foo }
|
||||
| ++++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0425`.
|
Loading…
Reference in New Issue
Block a user