|
| 1 | +// ignore-tidy-linelength |
| 2 | +// revisions: cpass1 cfail2 |
| 3 | +// edition: 2021 |
| 4 | +// [cpass1] compile-flags: --crate-type lib --emit dep-info,metadata |
| 5 | +// [cfail2] aux-build: circular-dependencies-aux.rs |
| 6 | +// [cfail2] compile-flags: --test --extern aux={{build-base}}/circular-dependencies/auxiliary/libcircular_dependencies_aux.rmeta -L dependency={{build-base}}/circular-dependencies |
| 7 | + |
| 8 | +pub struct Foo; |
| 9 | +//[cfail2]~^ NOTE `Foo` is defined in the current crate |
| 10 | +//[cfail2]~| NOTE `Foo` is defined in the current crate |
| 11 | +//[cfail2]~| NOTE `circular_dependencies::Foo` is defined in crate `circular_dependencies` |
| 12 | +//[cfail2]~| NOTE `circular_dependencies::Foo` is defined in crate `circular_dependencies` |
| 13 | + |
| 14 | +pub fn consume_foo(_: Foo) {} |
| 15 | +//[cfail2]~^ NOTE function defined here |
| 16 | + |
| 17 | +pub fn produce_foo() -> Foo { |
| 18 | + Foo |
| 19 | +} |
| 20 | + |
| 21 | +#[test] |
| 22 | +fn test() { |
| 23 | + aux::consume_foo(produce_foo()); |
| 24 | + //[cfail2]~^ ERROR mismatched types [E0308] |
| 25 | + //[cfail2]~| NOTE expected `circular_dependencies::Foo`, found `Foo` |
| 26 | + //[cfail2]~| NOTE arguments to this function are incorrect |
| 27 | + //[cfail2]~| NOTE `Foo` and `circular_dependencies::Foo` have similar names, but are actually distinct types |
| 28 | + //[cfail2]~| NOTE the crate `circular_dependencies` is compiled multiple times, possibly with different configurations |
| 29 | + //[cfail2]~| NOTE function defined here |
| 30 | + |
| 31 | + consume_foo(aux::produce_foo()); |
| 32 | + //[cfail2]~^ ERROR mismatched types [E0308] |
| 33 | + //[cfail2]~| NOTE expected `Foo`, found `circular_dependencies::Foo` |
| 34 | + //[cfail2]~| NOTE arguments to this function are incorrect |
| 35 | + //[cfail2]~| NOTE `circular_dependencies::Foo` and `Foo` have similar names, but are actually distinct types |
| 36 | + //[cfail2]~| NOTE the crate `circular_dependencies` is compiled multiple times, possibly with different configurations |
| 37 | +} |
0 commit comments