Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions compiler/rustc_passes/src/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -932,28 +932,13 @@ 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;
}
}
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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() {}
24 changes: 20 additions & 4 deletions tests/ui/stability-attribute/stability-attribute-trait-impl.stderr
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/55436> for more information

error: module has missing stability attribute
--> $DIR/stability-attribute-trait-impl.rs:1:1
|
Expand All @@ -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

Loading