forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add convoluted test for issue 132920
- Loading branch information
Showing
4 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
tests/run-make/diagnostics-traits-from-duplicate-crates/minibevy.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,2 @@ | ||
pub trait Resource {} | ||
pub struct Ray2d; |
1 change: 1 addition & 0 deletions
1
tests/run-make/diagnostics-traits-from-duplicate-crates/minirapier.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 @@ | ||
pub type Ray = minibevy::Ray2d; |
14 changes: 14 additions & 0 deletions
14
tests/run-make/diagnostics-traits-from-duplicate-crates/repro.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,14 @@ | ||
extern crate minibevy; | ||
extern crate minirapier; | ||
|
||
use minibevy::Resource; | ||
use minirapier::Ray; | ||
|
||
fn insert_resource<R: Resource>(_resource: R) {} | ||
|
||
struct Res; | ||
impl Resource for Res {} | ||
|
||
fn main() { | ||
insert_resource(Res.into()); | ||
} |
45 changes: 45 additions & 0 deletions
45
tests/run-make/diagnostics-traits-from-duplicate-crates/rmake.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,45 @@ | ||
// Non-regression test for issue #132920 where multiple versions of the same crate are present in | ||
// the dependency graph, and an unexpected error in a dependent crate caused an ICE in the | ||
// unsatisfied bounds diagnostics for traits present in multiple crate versions. | ||
// | ||
// Setup: | ||
// - two versions of the same crate: minibevy_a and minibevy_b | ||
// - minirapier: depends on minibevy_a | ||
// - repro: depends on minirapier and minibevy_b | ||
|
||
use run_make_support::rustc; | ||
|
||
fn main() { | ||
// Prepare dependencies, mimicking a check build with cargo. | ||
rustc() | ||
.input("minibevy.rs") | ||
.crate_name("minibevy") | ||
.crate_type("lib") | ||
.emit("metadata") | ||
.metadata("a") | ||
.extra_filename("-a") | ||
.run(); | ||
rustc() | ||
.input("minibevy.rs") | ||
.crate_name("minibevy") | ||
.crate_type("lib") | ||
.emit("metadata") | ||
.metadata("b") | ||
.extra_filename("-b") | ||
.run(); | ||
rustc() | ||
.input("minirapier.rs") | ||
.crate_name("minirapier") | ||
.crate_type("lib") | ||
.emit("metadata") | ||
.extern_("minibevy", "libminibevy-a.rmeta") | ||
.run(); | ||
|
||
// Building the main crate used to ICE here when printing the `type annotations needed` error. | ||
rustc() | ||
.input("repro.rs") | ||
.extern_("minibevy", "libminibevy-b.rmeta") | ||
.extern_("minirapier", "libminirapier.rmeta") | ||
.run_fail() | ||
.assert_stderr_not_contains("error: the compiler unexpectedly panicked. this is a bug"); | ||
} |