From ead96f7f749846a2310e7aaedef0ea38fc7c3a4a Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Wed, 19 Oct 2022 12:41:35 +0200 Subject: [PATCH] Allow #[unstable] impls for fn() with unstable abi. --- compiler/rustc_passes/src/stability.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index cfd6acd8d7c..78591e640e3 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -888,10 +888,15 @@ impl<'tcx> Visitor<'tcx> for CheckTraitImplStable<'tcx> { } fn visit_ty(&mut self, t: &'tcx Ty<'tcx>) { - if let TyKind::Never = t.kind { - self.fully_stable = false; + 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; + } + } + _ => intravisit::walk_ty(self, t), } - intravisit::walk_ty(self, t) } }