Skip to content

Commit

Permalink
ui test formulation of regression test for issue 64872.
Browse files Browse the repository at this point in the history
(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.)
  • Loading branch information
pnkfelix committed Nov 1, 2019
1 parent d21f9b7 commit 6457914
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 0 deletions.
16 changes: 16 additions & 0 deletions 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()
}
@@ -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;
@@ -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()
}
@@ -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();
}
17 changes: 17 additions & 0 deletions 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();
}

0 comments on commit 6457914

Please sign in to comment.