Skip to content

Commit

Permalink
Add test for mixing types from two incompatible crate versions
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed May 13, 2024
1 parent 0dba6c1 commit ec2ccdc
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/ui/crate-loading/auxiliary/dep-2-reexport.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//@ edition:2021
//@ aux-build:multiple-dep-versions-2.rs
extern crate dependency;
pub use dependency::do_something;
7 changes: 7 additions & 0 deletions tests/ui/crate-loading/auxiliary/multiple-dep-versions-1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#![crate_name="dependency"]
//@ edition:2021
//@ compile-flags: -C metadata=1 -C extra-filename=-1
pub struct Type;
pub trait Trait {}
impl Trait for Type {}
pub fn do_something<X: Trait>(_: X) { }
7 changes: 7 additions & 0 deletions tests/ui/crate-loading/auxiliary/multiple-dep-versions-2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#![crate_name="dependency"]
//@ edition:2021
//@ compile-flags: -C metadata=2 -C extra-filename=-2
pub struct Type(pub i32);
pub trait Trait {}
impl Trait for Type {}
pub fn do_something<X: Trait>(_: X) {}
14 changes: 14 additions & 0 deletions tests/ui/crate-loading/multiple-dep-versions.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//@ aux-build:dep-2-reexport.rs
//@ aux-build:multiple-dep-versions-1.rs
//@ edition:2021
//@ compile-flags: --error-format=human --color=always --crate-type bin --extern dependency={{build-base}}/crate-loading/multiple-dep-versions/auxiliary/libdependency-1.so --extern dep_2_reexport={{build-base}}/crate-loading/multiple-dep-versions/auxiliary/libdep_2_reexport.so
//@ ignore-windows

extern crate dependency;
extern crate dep_2_reexport;
use dependency::Type;
use dep_2_reexport::do_something;

fn main() {
do_something(Type);
}
101 changes: 101 additions & 0 deletions tests/ui/crate-loading/multiple-dep-versions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ec2ccdc

Please sign in to comment.