summaryrefslogtreecommitdiffstats
path: root/src/test/ui/explore-issue-38412.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/ui/explore-issue-38412.rs
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/explore-issue-38412.rs')
-rw-r--r--src/test/ui/explore-issue-38412.rs64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/test/ui/explore-issue-38412.rs b/src/test/ui/explore-issue-38412.rs
new file mode 100644
index 000000000..46d952df7
--- /dev/null
+++ b/src/test/ui/explore-issue-38412.rs
@@ -0,0 +1,64 @@
+// aux-build:pub-and-stability.rs
+
+// A big point of this test is that we *declare* `unstable_declared`,
+// but do *not* declare `unstable_undeclared`. This way we can check
+// that the compiler is letting in uses of declared feature-gated
+// stuff but still rejecting uses of undeclared feature-gated stuff.
+#![feature(unstable_declared)]
+
+extern crate pub_and_stability;
+use pub_and_stability::{Record, Trait, Tuple};
+
+fn main() {
+ // Okay
+ let Record { .. } = Record::new();
+
+ // Okay
+ let Record { a_stable_pub: _, a_unstable_declared_pub: _, .. } = Record::new();
+
+ let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } =
+ Record::new();
+ //~^^ ERROR use of unstable library feature 'unstable_undeclared'
+
+ let r = Record::new();
+ let t = Tuple::new();
+
+ r.a_stable_pub;
+ r.a_unstable_declared_pub;
+ r.a_unstable_undeclared_pub; //~ ERROR use of unstable library feature
+ r.b_crate; //~ ERROR is private
+ r.c_mod; //~ ERROR is private
+ r.d_priv; //~ ERROR is private
+
+ t.0;
+ t.1;
+ t.2; //~ ERROR use of unstable library feature
+ t.3; //~ ERROR is private
+ t.4; //~ ERROR is private
+ t.5; //~ ERROR is private
+
+ r.stable_trait_method();
+ r.unstable_declared_trait_method();
+ r.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature
+
+ r.stable();
+ r.unstable_declared();
+ r.unstable_undeclared(); //~ ERROR use of unstable library feature
+
+ r.pub_crate(); //~ ERROR `pub_crate` is private
+ r.pub_mod(); //~ ERROR `pub_mod` is private
+ r.private(); //~ ERROR `private` is private
+
+ let t = Tuple::new();
+ t.stable_trait_method();
+ t.unstable_declared_trait_method();
+ t.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature
+
+ t.stable();
+ t.unstable_declared();
+ t.unstable_undeclared(); //~ ERROR use of unstable library feature
+
+ t.pub_crate(); //~ ERROR `pub_crate` is private
+ t.pub_mod(); //~ ERROR `pub_mod` is private
+ t.private(); //~ ERROR `private` is private
+}