Skip to content

Commit ad36eb9

Browse files
authored
Unrolled build for rust-lang#126234
Rollup merge of rust-lang#126234 - Bryanskiy:delegation-no-entry-ice, r=petrochenkov Delegation: fix ICE on late diagnostics fixes rust-lang#124342
2 parents 336e6ab + 040791a commit ad36eb9

File tree

4 files changed

+37
-8
lines changed

4 files changed

+37
-8
lines changed

compiler/rustc_resolve/src/late/diagnostics.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -2041,8 +2041,11 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
20412041
ast::AssocItemKind::Fn(..) => AssocSuggestion::AssocFn { called },
20422042
ast::AssocItemKind::Type(..) => AssocSuggestion::AssocType,
20432043
ast::AssocItemKind::Delegation(..)
2044-
if self.r.delegation_fn_sigs[&self.r.local_def_id(assoc_item.id)]
2045-
.has_self =>
2044+
if self
2045+
.r
2046+
.delegation_fn_sigs
2047+
.get(&self.r.local_def_id(assoc_item.id))
2048+
.map_or(false, |sig| sig.has_self) =>
20462049
{
20472050
AssocSuggestion::MethodWithSelf { called }
20482051
}

tests/crashes/124342.rs

-6
This file was deleted.
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#![feature(fn_delegation)]
2+
#![allow(incomplete_features)]
3+
4+
mod to_reuse {}
5+
6+
trait Trait {
7+
reuse to_reuse::foo { foo }
8+
//~^ ERROR cannot find function `foo` in module `to_reuse`
9+
//~| ERROR cannot find value `foo` in this scope
10+
}
11+
12+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error[E0425]: cannot find function `foo` in module `to_reuse`
2+
--> $DIR/ice-issue-124342.rs:7:21
3+
|
4+
LL | reuse to_reuse::foo { foo }
5+
| ^^^ not found in `to_reuse`
6+
7+
error[E0425]: cannot find value `foo` in this scope
8+
--> $DIR/ice-issue-124342.rs:7:27
9+
|
10+
LL | reuse to_reuse::foo { foo }
11+
| ^^^
12+
|
13+
help: you might have meant to refer to the associated function
14+
|
15+
LL | reuse to_reuse::foo { Self::foo }
16+
| ++++++
17+
18+
error: aborting due to 2 previous errors
19+
20+
For more information about this error, try `rustc --explain E0425`.

0 commit comments

Comments
 (0)