summaryrefslogtreecommitdiffstats
path: root/tests/ui/reachable
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:42 +0000
commit837b550238aa671a591ccf282dddeab29cadb206 (patch)
tree914b6b8862bace72bd3245ca184d374b08d8a672 /tests/ui/reachable
parentAdding debian version 1.70.0+dfsg2-1. (diff)
downloadrustc-837b550238aa671a591ccf282dddeab29cadb206.tar.xz
rustc-837b550238aa671a591ccf282dddeab29cadb206.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/reachable')
-rw-r--r--tests/ui/reachable/auxiliary/foreign-priv-aux.rs21
-rw-r--r--tests/ui/reachable/foreign-priv.rs12
-rw-r--r--tests/ui/reachable/issue-948.rs15
3 files changed, 48 insertions, 0 deletions
diff --git a/tests/ui/reachable/auxiliary/foreign-priv-aux.rs b/tests/ui/reachable/auxiliary/foreign-priv-aux.rs
new file mode 100644
index 000000000..10dc08614
--- /dev/null
+++ b/tests/ui/reachable/auxiliary/foreign-priv-aux.rs
@@ -0,0 +1,21 @@
+trait PrivTrait {
+ fn priv_fn(&self);
+}
+
+pub struct ImplPrivTrait;
+
+impl PrivTrait for ImplPrivTrait {
+ fn priv_fn(&self) {}
+}
+
+pub struct Wrapper<T>(T);
+
+pub trait PubTrait {
+ fn pub_fn(&self);
+}
+
+impl<T: PrivTrait> PubTrait for Wrapper<T> {
+ fn pub_fn(&self) {
+ self.0.priv_fn()
+ }
+}
diff --git a/tests/ui/reachable/foreign-priv.rs b/tests/ui/reachable/foreign-priv.rs
new file mode 100644
index 000000000..bf336b6be
--- /dev/null
+++ b/tests/ui/reachable/foreign-priv.rs
@@ -0,0 +1,12 @@
+// aux-build:foreign-priv-aux.rs
+// build-pass
+
+#![crate_type = "lib"]
+
+extern crate foreign_priv_aux;
+
+use foreign_priv_aux::{ImplPrivTrait, PubTrait, Wrapper};
+
+pub fn foo(x: Wrapper<ImplPrivTrait>) {
+ x.pub_fn();
+}
diff --git a/tests/ui/reachable/issue-948.rs b/tests/ui/reachable/issue-948.rs
new file mode 100644
index 000000000..b9bbeb395
--- /dev/null
+++ b/tests/ui/reachable/issue-948.rs
@@ -0,0 +1,15 @@
+// run-fail
+// error-pattern:beep boop
+// ignore-emscripten no processes
+
+#![allow(unused_variables)]
+
+struct Point {
+ x: isize,
+ y: isize,
+}
+
+fn main() {
+ let origin = Point { x: 0, y: 0 };
+ let f: Point = Point { x: (panic!("beep boop")), ..origin };
+}