Use rmake diff
output in test
This commit is contained in:
parent
8574f374e2
commit
e97e15dea5
2 changed files with 46 additions and 13 deletions
|
@ -0,0 +1,34 @@
|
||||||
|
error[E0277]: the trait bound `foo::Struct: Trait` is not satisfied
|
||||||
|
--> foo-current.rs:13:19
|
||||||
|
|
|
||||||
|
13 | check_trait::<foo::Struct>();
|
||||||
|
| ^^^^^^^^^^^ the trait `Trait` is not implemented for `foo::Struct`
|
||||||
|
|
|
||||||
|
note: there are multiple different versions of crate `foo` in the dependency graph
|
||||||
|
--> foo-current.rs:7:1
|
||||||
|
|
|
||||||
|
4 | extern crate foo;
|
||||||
|
| ----------------- one version of crate `foo` is used here, as a direct dependency of the current crate
|
||||||
|
5 |
|
||||||
|
6 | pub struct Struct;
|
||||||
|
| ----------------- this type implements the required trait
|
||||||
|
7 | pub trait Trait {}
|
||||||
|
| ^^^^^^^^^^^^^^^ this is the required trait
|
||||||
|
|
|
||||||
|
::: foo-prev.rs:X:Y
|
||||||
|
|
|
||||||
|
4 | pub struct Struct;
|
||||||
|
| ----------------- this type doesn't implement the required trait
|
||||||
|
5 | pub trait Trait {}
|
||||||
|
| --------------- this is the found trait
|
||||||
|
= note: two types coming from two different versions of the same crate are different types even if they look the same
|
||||||
|
= help: you can use `cargo tree` to explore your dependency tree
|
||||||
|
note: required by a bound in `check_trait`
|
||||||
|
--> foo-current.rs:10:19
|
||||||
|
|
|
||||||
|
10 | fn check_trait<T: Trait>() {}
|
||||||
|
| ^^^^^ required by this bound in `check_trait`
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0277`.
|
|
@ -7,26 +7,25 @@
|
||||||
// and traits of the different versions are mixed, we produce diagnostic output and not an ICE.
|
// and traits of the different versions are mixed, we produce diagnostic output and not an ICE.
|
||||||
// #133563
|
// #133563
|
||||||
|
|
||||||
use run_make_support::{rust_lib_name, rustc};
|
use run_make_support::{diff, rust_lib_name, rustc};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
rustc().input("foo-prev.rs").run();
|
rustc().input("foo-prev.rs").run();
|
||||||
|
|
||||||
rustc()
|
let out = rustc()
|
||||||
.extra_filename("current")
|
.extra_filename("current")
|
||||||
.metadata("current")
|
.metadata("current")
|
||||||
.input("foo-current.rs")
|
.input("foo-current.rs")
|
||||||
.extern_("foo", rust_lib_name("foo"))
|
.extern_("foo", rust_lib_name("foo"))
|
||||||
.run_fail()
|
.run_fail()
|
||||||
.assert_stderr_contains(r#"
|
.stderr_utf8();
|
||||||
note: there are multiple different versions of crate `foo` in the dependency graph
|
|
||||||
--> foo-current.rs:7:1
|
// We don't remap the path of the `foo-prev` crate, so we remap it here.
|
||||||
|
|
let mut lines: Vec<_> = out.lines().collect();
|
||||||
4 | extern crate foo;
|
for line in &mut lines {
|
||||||
| ----------------- one version of crate `foo` is used here, as a direct dependency of the current crate
|
if line.starts_with(" ::: ") {
|
||||||
5 |
|
*line = " ::: foo-prev.rs:X:Y";
|
||||||
6 | pub struct Struct;
|
}
|
||||||
| ----------------- this type implements the required trait
|
}
|
||||||
7 | pub trait Trait {}
|
diff().expected_file("foo.stderr").actual_text("(rustc)", &lines.join("\n")).run();
|
||||||
| ^^^^^^^^^^^^^^^ this is the required trait"#);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue