diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:42 +0000 |
commit | 837b550238aa671a591ccf282dddeab29cadb206 (patch) | |
tree | 914b6b8862bace72bd3245ca184d374b08d8a672 /tests/ui/reachable | |
parent | Adding debian version 1.70.0+dfsg2-1. (diff) | |
download | rustc-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.rs | 21 | ||||
-rw-r--r-- | tests/ui/reachable/foreign-priv.rs | 12 | ||||
-rw-r--r-- | tests/ui/reachable/issue-948.rs | 15 |
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 }; +} |