summaryrefslogtreecommitdiffstats
path: root/tests/ui/cross-crate/issue-64872
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/cross-crate/issue-64872
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/cross-crate/issue-64872')
-rw-r--r--tests/ui/cross-crate/issue-64872/auxiliary/a_def_obj.rs16
-rw-r--r--tests/ui/cross-crate/issue-64872/auxiliary/b_reexport_obj.rs7
-rw-r--r--tests/ui/cross-crate/issue-64872/auxiliary/c_another_vtable_for_obj.rs12
-rw-r--r--tests/ui/cross-crate/issue-64872/auxiliary/d_chain_of_rlibs_and_dylibs.rs9
-rw-r--r--tests/ui/cross-crate/issue-64872/issue-64872.rs17
5 files changed, 61 insertions, 0 deletions
diff --git a/tests/ui/cross-crate/issue-64872/auxiliary/a_def_obj.rs b/tests/ui/cross-crate/issue-64872/auxiliary/a_def_obj.rs
new file mode 100644
index 000000000..82bb95f1e
--- /dev/null
+++ b/tests/ui/cross-crate/issue-64872/auxiliary/a_def_obj.rs
@@ -0,0 +1,16 @@
+// compile-flags: -C debuginfo=2
+
+// no-prefer-dynamic
+#![crate_type = "rlib"]
+
+pub trait Object { fn method(&self) { } }
+
+impl Object for u32 { }
+impl Object for () { }
+impl<T> Object for &T { }
+
+pub fn unused() {
+ let ref u = 0_u32;
+ let _d = &u as &dyn crate::Object;
+ _d.method()
+}
diff --git a/tests/ui/cross-crate/issue-64872/auxiliary/b_reexport_obj.rs b/tests/ui/cross-crate/issue-64872/auxiliary/b_reexport_obj.rs
new file mode 100644
index 000000000..21c0274b9
--- /dev/null
+++ b/tests/ui/cross-crate/issue-64872/auxiliary/b_reexport_obj.rs
@@ -0,0 +1,7 @@
+// compile-flags: -C debuginfo=2 -C prefer-dynamic
+
+#![crate_type="dylib"]
+
+extern crate a_def_obj;
+
+pub use a_def_obj::Object;
diff --git a/tests/ui/cross-crate/issue-64872/auxiliary/c_another_vtable_for_obj.rs b/tests/ui/cross-crate/issue-64872/auxiliary/c_another_vtable_for_obj.rs
new file mode 100644
index 000000000..611238f56
--- /dev/null
+++ b/tests/ui/cross-crate/issue-64872/auxiliary/c_another_vtable_for_obj.rs
@@ -0,0 +1,12 @@
+// no-prefer-dynamic
+// compile-flags: -C debuginfo=2
+#![crate_type="rlib"]
+
+extern crate b_reexport_obj;
+use b_reexport_obj::Object;
+
+pub fn another_dyn_debug() {
+ let ref u = 1_u32;
+ let _d = &u as &dyn crate::Object;
+ _d.method()
+}
diff --git a/tests/ui/cross-crate/issue-64872/auxiliary/d_chain_of_rlibs_and_dylibs.rs b/tests/ui/cross-crate/issue-64872/auxiliary/d_chain_of_rlibs_and_dylibs.rs
new file mode 100644
index 000000000..8d73f9b66
--- /dev/null
+++ b/tests/ui/cross-crate/issue-64872/auxiliary/d_chain_of_rlibs_and_dylibs.rs
@@ -0,0 +1,9 @@
+// compile-flags: -C debuginfo=2 -C prefer-dynamic
+
+#![crate_type="rlib"]
+
+extern crate c_another_vtable_for_obj;
+
+pub fn chain() {
+ c_another_vtable_for_obj::another_dyn_debug();
+}
diff --git a/tests/ui/cross-crate/issue-64872/issue-64872.rs b/tests/ui/cross-crate/issue-64872/issue-64872.rs
new file mode 100644
index 000000000..20fe2053c
--- /dev/null
+++ b/tests/ui/cross-crate/issue-64872/issue-64872.rs
@@ -0,0 +1,17 @@
+// run-pass
+
+// note that these aux-build directives must be in this order: the
+// later crates depend on the earlier ones. (The particular bug that
+// is being exercised here used to exhibit itself during the build of
+// `chain_of_rlibs_and_dylibs.dylib`)
+
+// aux-build:a_def_obj.rs
+// aux-build:b_reexport_obj.rs
+// aux-build:c_another_vtable_for_obj.rs
+// aux-build:d_chain_of_rlibs_and_dylibs.rs
+
+extern crate d_chain_of_rlibs_and_dylibs;
+
+pub fn main() {
+ d_chain_of_rlibs_and_dylibs::chain();
+}