Rollup merge of #103221 - TaKO8Ki:fix-103202, r=oli-obk
Fix `SelfVisitor::is_self_ty` ICE Fixes #103202
This commit is contained in:
commit
7ee4b218a8
3 changed files with 19 additions and 3 deletions
|
@ -1939,11 +1939,11 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
|
||||||
match ty.kind {
|
match ty.kind {
|
||||||
TyKind::ImplicitSelf => true,
|
TyKind::ImplicitSelf => true,
|
||||||
TyKind::Path(None, _) => {
|
TyKind::Path(None, _) => {
|
||||||
let path_res = self.r.partial_res_map[&ty.id].expect_full_res();
|
let path_res = self.r.partial_res_map[&ty.id].full_res();
|
||||||
if let Res::SelfTyParam { .. } | Res::SelfTyAlias { .. } = path_res {
|
if let Some(Res::SelfTyParam { .. } | Res::SelfTyAlias { .. }) = path_res {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Some(path_res) == self.impl_self
|
self.impl_self.is_some() && path_res == self.impl_self
|
||||||
}
|
}
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
|
|
7
src/test/ui/resolve/issue-103202.rs
Normal file
7
src/test/ui/resolve/issue-103202.rs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
struct S {}
|
||||||
|
|
||||||
|
impl S {
|
||||||
|
fn f(self: &S::x) {} //~ ERROR ambiguous associated type
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
9
src/test/ui/resolve/issue-103202.stderr
Normal file
9
src/test/ui/resolve/issue-103202.stderr
Normal file
|
@ -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`.
|
Loading…
Add table
Add a link
Reference in a new issue