Skip to content

Commit 0b27164

Browse files
committed
fix SelfVisitor::is_self_ty ICE
1 parent ee1c3b3 commit 0b27164

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

compiler/rustc_resolve/src/late.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1928,11 +1928,11 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
19281928
match ty.kind {
19291929
TyKind::ImplicitSelf => true,
19301930
TyKind::Path(None, _) => {
1931-
let path_res = self.r.partial_res_map[&ty.id].expect_full_res();
1932-
if let Res::SelfTyParam { .. } | Res::SelfTyAlias { .. } = path_res {
1931+
let path_res = self.r.partial_res_map[&ty.id].full_res();
1932+
if let Some(Res::SelfTyParam { .. } | Res::SelfTyAlias { .. }) = path_res {
19331933
return true;
19341934
}
1935-
Some(path_res) == self.impl_self
1935+
path_res == self.impl_self
19361936
}
19371937
_ => false,
19381938
}

src/test/ui/resolve/issue-103202.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
struct S {}
2+
3+
impl S {
4+
fn f(self: &S::x) {} //~ ERROR ambiguous associated type
5+
}
6+
7+
fn main() {}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0223]: ambiguous associated type
2+
--> $DIR/issue-103202.rs:4:17
3+
|
4+
LL | fn f(self: &S::x) {}
5+
| ^^^^ help: use fully-qualified syntax: `<S as Trait>::x`
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0223`.

0 commit comments

Comments
 (0)