Skip to content

Commit

Permalink
Rollup merge of rust-lang#103221 - TaKO8Ki:fix-103202, r=oli-obk
Browse files Browse the repository at this point in the history
Fix `SelfVisitor::is_self_ty` ICE

Fixes rust-lang#103202
  • Loading branch information
matthiaskrgr committed Oct 20, 2022
2 parents 38c5239 + 9a9e2fe commit ec378e6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_resolve/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1939,11 +1939,11 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
match ty.kind {
TyKind::ImplicitSelf => true,
TyKind::Path(None, _) => {
let path_res = self.r.partial_res_map[&ty.id].expect_full_res();
if let Res::SelfTyParam { .. } | Res::SelfTyAlias { .. } = path_res {
let path_res = self.r.partial_res_map[&ty.id].full_res();
if let Some(Res::SelfTyParam { .. } | Res::SelfTyAlias { .. }) = path_res {
return true;
}
Some(path_res) == self.impl_self
self.impl_self.is_some() && path_res == self.impl_self
}
_ => false,
}
Expand Down
7 changes: 7 additions & 0 deletions src/test/ui/resolve/issue-103202.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
struct S {}

impl S {
fn f(self: &S::x) {} //~ ERROR ambiguous associated type
}

fn main() {}
9 changes: 9 additions & 0 deletions src/test/ui/resolve/issue-103202.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0223]: ambiguous associated type
--> $DIR/issue-103202.rs:4:17
|
LL | fn f(self: &S::x) {}
| ^^^^ help: use fully-qualified syntax: `<S as Trait>::x`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0223`.

0 comments on commit ec378e6

Please sign in to comment.