diff options
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_passes/src/stability.rs | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index 78591e640e3..9591aeb881f 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -888,14 +888,26 @@ impl<'tcx> Visitor<'tcx> for CheckTraitImplStable<'tcx> { } fn visit_ty(&mut self, t: &'tcx Ty<'tcx>) { - match t.kind { - TyKind::Never => self.fully_stable = false, - TyKind::BareFn(f) => { - if rustc_target::spec::abi::is_stable(f.abi.name()).is_err() { - self.fully_stable = false; - } + if let TyKind::Never = t.kind { + self.fully_stable = false; + } + if let TyKind::BareFn(f) = t.kind { + if rustc_target::spec::abi::is_stable(f.abi.name()).is_err() { + self.fully_stable = false; + } + } + intravisit::walk_ty(self, t) + } + + fn visit_fn_decl(&mut self, fd: &'tcx hir::FnDecl<'tcx>) { + for ty in fd.inputs { + self.visit_ty(ty) + } + if let hir::FnRetTy::Return(output_ty) = fd.output { + match output_ty.kind { + TyKind::Never => {} // `-> !` is stable + _ => self.visit_ty(output_ty), } - _ => intravisit::walk_ty(self, t), } } } |
