diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index 574e8073d8e..3ec270a7c97 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -460,7 +460,7 @@ fn visit_variant(&mut self, var: &'tcx Variant<'tcx>) { AnnotationKind::Required, InheritDeprecation::Yes, InheritConstStability::No, - InheritStability::No, + InheritStability::Yes, |_| {}, ); } diff --git a/src/test/ui/stability-attribute/auxiliary/ctor-stability.rs b/src/test/ui/stability-attribute/auxiliary/ctor-stability.rs new file mode 100644 index 00000000000..74c6023d7fb --- /dev/null +++ b/src/test/ui/stability-attribute/auxiliary/ctor-stability.rs @@ -0,0 +1,8 @@ +#![crate_type = "lib"] +#![feature(staged_api)] +#![stable(feature = "none", since = "1.0")] + +#[stable(feature = "none", since = "1.0")] +pub enum Foo { + A, +} diff --git a/src/test/ui/stability-attribute/ctor-stability.rs b/src/test/ui/stability-attribute/ctor-stability.rs new file mode 100644 index 00000000000..fcab0cb1099 --- /dev/null +++ b/src/test/ui/stability-attribute/ctor-stability.rs @@ -0,0 +1,8 @@ +// aux-build:ctor-stability.rs +// check-pass + +extern crate ctor_stability; + +fn main() { + let _ = ctor_stability::Foo::A; +}