summaryrefslogtreecommitdiffstats
path: root/tests/ui/stability-attribute/allow-unstable-reexport.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/ui/stability-attribute/allow-unstable-reexport.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/stability-attribute/allow-unstable-reexport.rs')
-rw-r--r--tests/ui/stability-attribute/allow-unstable-reexport.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/ui/stability-attribute/allow-unstable-reexport.rs b/tests/ui/stability-attribute/allow-unstable-reexport.rs
new file mode 100644
index 000000000..937913954
--- /dev/null
+++ b/tests/ui/stability-attribute/allow-unstable-reexport.rs
@@ -0,0 +1,30 @@
+// Allow an unstable re-export without requiring a feature gate.
+// #94972
+
+// aux-build:lint-stability.rs
+// aux-build:lint-stability-reexport.rs
+#![feature(staged_api)]
+#![stable(feature = "lint_stability", since = "1.0.0")]
+
+extern crate lint_stability;
+extern crate lint_stability_reexport;
+
+#[unstable(feature = "unstable_test_feature", issue = "none")]
+pub use lint_stability::unstable;
+
+// We want to confirm that using a re-export through another crate behaves
+// the same way as using an item directly
+#[unstable(feature = "unstable_test_feature", issue = "none")]
+pub use lint_stability_reexport::unstable_text;
+
+// Ensure items which aren't marked as unstable can't re-export unstable items
+#[stable(feature = "lint_stability", since = "1.0.0")]
+pub use lint_stability::unstable as unstable2;
+//~^ ERROR use of unstable library feature 'unstable_test_feature'
+
+fn main() {
+ // Since we didn't enable the feature in this crate, we still can't
+ // use these items, even though they're in scope from the `use`s which are now allowed.
+ unstable(); //~ ERROR use of unstable library feature 'unstable_test_feature'
+ unstable_text(); //~ ERROR use of unstable library feature 'unstable_test_feature'
+}