-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.)
- Loading branch information
Showing
5 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
src/test/ui/cross-crate/issue-64872/auxiliary/a_def_obj.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} |
7 changes: 7 additions & 0 deletions
7
src/test/ui/cross-crate/issue-64872/auxiliary/b_reexport_obj.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
12 changes: 12 additions & 0 deletions
12
src/test/ui/cross-crate/issue-64872/auxiliary/c_another_vtable_for_obj.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} |
9 changes: 9 additions & 0 deletions
9
src/test/ui/cross-crate/issue-64872/auxiliary/d_chain_of_rlibs_and_dylibs.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} |