diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2019-10-30 16:32:40 +0100 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2019-11-01 15:06:21 +0100 |
| commit | 6457914ff663973c86d9c5a5ff3ff60cb460f2a1 (patch) | |
| tree | 7c9c32cc1915b965f24b3c8fdd9f906f5fd44dd4 | |
| parent | d21f9b7fd6d4e41257bb4a6db64e9873767374dc (diff) | |
| download | rust-6457914ff663973c86d9c5a5ff3ff60cb460f2a1.tar.gz rust-6457914ff663973c86d9c5a5ff3ff60cb460f2a1.zip | |
ui test formulation of regression test for issue 64872.
(Many thanks to alex for 1. making this even smaller than what I had originally minimized, and 2. pointing out that there is precedent for having ui tests with crate dependency chains of length > 2, thus allowing me to avoid encoding this as a run-make test.)
5 files changed, 61 insertions, 0 deletions
diff --git a/src/test/ui/cross-crate/issue-64872/auxiliary/a_def_obj.rs b/src/test/ui/cross-crate/issue-64872/auxiliary/a_def_obj.rs new file mode 100644 index 00000000000..82bb95f1ef2 --- /dev/null +++ b/src/test/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/src/test/ui/cross-crate/issue-64872/auxiliary/b_reexport_obj.rs b/src/test/ui/cross-crate/issue-64872/auxiliary/b_reexport_obj.rs new file mode 100644 index 00000000000..21c0274b991 --- /dev/null +++ b/src/test/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/src/test/ui/cross-crate/issue-64872/auxiliary/c_another_vtable_for_obj.rs b/src/test/ui/cross-crate/issue-64872/auxiliary/c_another_vtable_for_obj.rs new file mode 100644 index 00000000000..611238f5617 --- /dev/null +++ b/src/test/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/src/test/ui/cross-crate/issue-64872/auxiliary/d_chain_of_rlibs_and_dylibs.rs b/src/test/ui/cross-crate/issue-64872/auxiliary/d_chain_of_rlibs_and_dylibs.rs new file mode 100644 index 00000000000..8d73f9b666f --- /dev/null +++ b/src/test/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/src/test/ui/cross-crate/issue-64872/issue-64872.rs b/src/test/ui/cross-crate/issue-64872/issue-64872.rs new file mode 100644 index 00000000000..20fe2053cc7 --- /dev/null +++ b/src/test/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(); +} |
