diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index 37ec1dc01bd4b..7404b466f1d54 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -932,9 +932,6 @@ impl<'tcx> Visitor<'tcx> for CheckTraitImplStable<'tcx> { } fn visit_ty(&mut self, t: &'tcx Ty<'tcx, AmbigArg>) { - if let TyKind::Never = t.kind { - self.fully_stable = false; - } if let TyKind::FnPtr(function) = t.kind { if extern_abi_stability(function.abi).is_err() { self.fully_stable = false; @@ -942,18 +939,6 @@ impl<'tcx> Visitor<'tcx> for CheckTraitImplStable<'tcx> { } intravisit::walk_ty(self, t) } - - fn visit_fn_decl(&mut self, fd: &'tcx hir::FnDecl<'tcx>) { - for ty in fd.inputs { - self.visit_ty_unambig(ty) - } - if let hir::FnRetTy::Return(output_ty) = fd.output { - match output_ty.kind { - TyKind::Never => {} // `-> !` is stable - _ => self.visit_ty_unambig(output_ty), - } - } - } } /// Given the list of enabled features that were not language features (i.e., that diff --git a/tests/ui/stability-attribute/stability-attribute-trait-impl.rs b/tests/ui/stability-attribute/stability-attribute-trait-impl.rs index 2ef6ec81a56c5..124648017fe2b 100644 --- a/tests/ui/stability-attribute/stability-attribute-trait-impl.rs +++ b/tests/ui/stability-attribute/stability-attribute-trait-impl.rs @@ -23,6 +23,7 @@ impl StableTrait for UnstableType {} impl UnstableTrait for StableType {} #[unstable(feature = "h", issue = "none")] +//~^ ERROR an `#[unstable]` annotation here has no effect [ineffective_unstable_trait_impl] impl StableTrait for ! {} // Note: If rust_cold_cc is stabilized, switch this to another (unstable) ABI. @@ -40,4 +41,11 @@ impl StableTrait for fn() -> ! {} #[unstable(feature = "l", issue = "none")] impl StableTrait for fn() -> UnstableType {} +#[unstable(feature = "m", issue = "none")] +//~^ ERROR an `#[unstable]` annotation here has no effect [ineffective_unstable_trait_impl] +impl StableTrait for fn(!) {} + +#[unstable(feature = "n", issue = "none")] +impl StableTrait for fn(UnstableType) {} + fn main() {} diff --git a/tests/ui/stability-attribute/stability-attribute-trait-impl.stderr b/tests/ui/stability-attribute/stability-attribute-trait-impl.stderr index 1f6762795e618..11feda60a73a1 100644 --- a/tests/ui/stability-attribute/stability-attribute-trait-impl.stderr +++ b/tests/ui/stability-attribute/stability-attribute-trait-impl.stderr @@ -1,20 +1,36 @@ error: an `#[unstable]` annotation here has no effect - --> $DIR/stability-attribute-trait-impl.rs:32:1 + --> $DIR/stability-attribute-trait-impl.rs:25:1 | -LL | #[unstable(feature = "j", issue = "none")] +LL | #[unstable(feature = "h", issue = "none")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #55436 for more information = note: `#[deny(ineffective_unstable_trait_impl)]` on by default error: an `#[unstable]` annotation here has no effect - --> $DIR/stability-attribute-trait-impl.rs:36:1 + --> $DIR/stability-attribute-trait-impl.rs:33:1 + | +LL | #[unstable(feature = "j", issue = "none")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #55436 for more information + +error: an `#[unstable]` annotation here has no effect + --> $DIR/stability-attribute-trait-impl.rs:37:1 | LL | #[unstable(feature = "k", issue = "none")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #55436 for more information +error: an `#[unstable]` annotation here has no effect + --> $DIR/stability-attribute-trait-impl.rs:44:1 + | +LL | #[unstable(feature = "m", issue = "none")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #55436 for more information + error: module has missing stability attribute --> $DIR/stability-attribute-trait-impl.rs:1:1 | @@ -26,5 +42,5 @@ LL | | #[stable(feature = "a", since = "3.3.3")] LL | | fn main() {} | |____________^ -error: aborting due to 3 previous errors +error: aborting due to 5 previous errors