diff options
| author | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-11-02 14:47:48 +0900 |
|---|---|---|
| committer | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-11-02 14:47:48 +0900 |
| commit | b96ad1c0960bd64fde273efe00df3fbc580a9c0a (patch) | |
| tree | 68748b0ca3c7ff27702bfa7bb9689d24b4c8bc81 /compiler | |
| parent | 33b55ac39fa633d0983fad014469e1036669bf28 (diff) | |
return const_error when ty has errors
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/astconv/mod.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_hir_analysis/src/astconv/mod.rs b/compiler/rustc_hir_analysis/src/astconv/mod.rs index 6baf9844977..21e6ab13a59 100644 --- a/compiler/rustc_hir_analysis/src/astconv/mod.rs +++ b/compiler/rustc_hir_analysis/src/astconv/mod.rs @@ -501,6 +501,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { } GenericParamDefKind::Const { has_default } => { let ty = tcx.at(self.span).type_of(param.def_id); + if ty.references_error() { + return tcx.const_error(ty).into(); + } if !infer_args && has_default { tcx.bound_const_param_default(param.def_id) .subst(tcx, substs.unwrap()) |
