Skip to content

Commit 0bd4396

Browse files
committed
add aux-crates to test
1 parent a9d5951 commit 0bd4396

File tree

4 files changed

+33
-3
lines changed

4 files changed

+33
-3
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pub trait A {
2+
fn foo() {}
3+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@ aux-crate:priv:private_dep=private-dep.rs
2+
//@ compile-flags: -Zunstable-options
3+
4+
extern crate private_dep;
5+
use private_dep::A;
6+
7+
pub struct B;
8+
9+
impl A for B {
10+
fn foo() {}
11+
}

‎tests/ui/typeck/dont-suggest-private-dependencies.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
//@ forbid-output: compiler_builtins
66
//@ forbid-output: object
77

8+
// Check a custom trait to withstand changes in above crates
9+
//@ aux-crate:public_dep=public-dep.rs
10+
//@ compile-flags: -Zunstable-options
11+
//@ forbid-output: private_dep
12+
813
struct VecReader(Vec<u8>);
914

1015
impl std::io::Read for VecReader {
@@ -14,7 +19,12 @@ impl std::io::Read for VecReader {
1419
}
1520
}
1621

22+
extern crate public_dep;
23+
use public_dep::B;
24+
1725
fn main() {
1826
let _ = u8::cast_from_lossy(9);
1927
//~^ ERROR no function or associated item named `cast_from_lossy` found for type `u8`
28+
let _ = B::foo();
29+
//~^ ERROR no function or associated item named `foo` found for struct `B`
2030
}
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0599]: no method named `read` found for struct `Vec<u8>` in the current scope
2-
--> $DIR/dont-suggest-private-dependencies.rs:12:16
2+
--> $DIR/dont-suggest-private-dependencies.rs:17:16
33
|
44
LL | self.0.read(buf)
55
| ^^^^
@@ -10,11 +10,17 @@ LL | self.0.read_at(buf)
1010
| +++
1111

1212
error[E0599]: no function or associated item named `cast_from_lossy` found for type `u8` in the current scope
13-
--> $DIR/dont-suggest-private-dependencies.rs:18:17
13+
--> $DIR/dont-suggest-private-dependencies.rs:26:17
1414
|
1515
LL | let _ = u8::cast_from_lossy(9);
1616
| ^^^^^^^^^^^^^^^ function or associated item not found in `u8`
1717

18-
error: aborting due to 2 previous errors
18+
error[E0599]: no function or associated item named `foo` found for struct `B` in the current scope
19+
--> $DIR/dont-suggest-private-dependencies.rs:28:16
20+
|
21+
LL | let _ = B::foo();
22+
| ^^^ function or associated item not found in `B`
23+
24+
error: aborting due to 3 previous errors
1925

2026
For more information about this error, try `rustc --explain E0599`.

0 commit comments

Comments
 (0)