diff options
| author | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-10-16 22:24:27 +0900 |
|---|---|---|
| committer | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-10-16 22:24:27 +0900 |
| commit | 0b6fa0d418f8de754c32459c333a64b08b5ed863 (patch) | |
| tree | 619ace9d071031ddc942cd74c0325565be694317 /compiler | |
| parent | ee1c3b385b6673b6ef37d80dfabe048e993c2ae2 (diff) | |
| download | rust-0b6fa0d418f8de754c32459c333a64b08b5ed863.tar.gz rust-0b6fa0d418f8de754c32459c333a64b08b5ed863.zip | |
fix `own_substs` ICE
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs index f4b3ded53b0..7b3178e610f 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs @@ -902,11 +902,18 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> { // impl is currently the `DefId` of `Output` in the trait definition // which makes this somewhat difficult and prevents us from just // using `self.path_inferred_subst_iter` here. - hir::ExprKind::Struct(&hir::QPath::Resolved(_self_ty, path), _, _) => { - if let Some(ty) = self.opt_node_type(expr.hir_id) { - if let ty::Adt(_, substs) = ty.kind() { - return Box::new(self.resolved_path_inferred_subst_iter(path, substs)); - } + hir::ExprKind::Struct(&hir::QPath::Resolved(_self_ty, path), _, _) + // FIXME(TaKO8Ki): Ideally we should support this. For that + // we have to map back from the self type to the + // type alias though. That's difficult. + // + // See the `need_type_info/issue-103053.rs` test for + // a example. + if !matches!(path.res, Res::Def(DefKind::TyAlias, _)) => { + if let Some(ty) = self.opt_node_type(expr.hir_id) + && let ty::Adt(_, substs) = ty.kind() + { + return Box::new(self.resolved_path_inferred_subst_iter(path, substs)); } } hir::ExprKind::MethodCall(segment, ..) => { |
