Skip to content

Commit 6457914

Browse files
committed
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.)
1 parent d21f9b7 commit 6457914

File tree

5 files changed

+61
-0
lines changed

5 files changed

+61
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// compile-flags: -C debuginfo=2
2+
3+
// no-prefer-dynamic
4+
#![crate_type = "rlib"]
5+
6+
pub trait Object { fn method(&self) { } }
7+
8+
impl Object for u32 { }
9+
impl Object for () { }
10+
impl<T> Object for &T { }
11+
12+
pub fn unused() {
13+
let ref u = 0_u32;
14+
let _d = &u as &dyn crate::Object;
15+
_d.method()
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// compile-flags: -C debuginfo=2 -C prefer-dynamic
2+
3+
#![crate_type="dylib"]
4+
5+
extern crate a_def_obj;
6+
7+
pub use a_def_obj::Object;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// no-prefer-dynamic
2+
// compile-flags: -C debuginfo=2
3+
#![crate_type="rlib"]
4+
5+
extern crate b_reexport_obj;
6+
use b_reexport_obj::Object;
7+
8+
pub fn another_dyn_debug() {
9+
let ref u = 1_u32;
10+
let _d = &u as &dyn crate::Object;
11+
_d.method()
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// compile-flags: -C debuginfo=2 -C prefer-dynamic
2+
3+
#![crate_type="rlib"]
4+
5+
extern crate c_another_vtable_for_obj;
6+
7+
pub fn chain() {
8+
c_another_vtable_for_obj::another_dyn_debug();
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// run-pass
2+
3+
// note that these aux-build directives must be in this order: the
4+
// later crates depend on the earlier ones. (The particular bug that
5+
// is being exercised here used to exhibit itself during the build of
6+
// `chain_of_rlibs_and_dylibs.dylib`)
7+
8+
// aux-build:a_def_obj.rs
9+
// aux-build:b_reexport_obj.rs
10+
// aux-build:c_another_vtable_for_obj.rs
11+
// aux-build:d_chain_of_rlibs_and_dylibs.rs
12+
13+
extern crate d_chain_of_rlibs_and_dylibs;
14+
15+
pub fn main() {
16+
d_chain_of_rlibs_and_dylibs::chain();
17+
}

0 commit comments

Comments
 (0)