diff options
| author | Caio <c410.f3r@gmail.com> | 2024-04-06 17:08:59 -0300 |
|---|---|---|
| committer | Caio <c410.f3r@gmail.com> | 2024-04-07 17:38:07 -0300 |
| commit | ab8994d93e469d3f804e978e379e8342b0c6fe3b (patch) | |
| tree | 393e4373c4f705aecef0db083e0da73fd3b50edd /tests/ui/modules | |
| parent | 9d5cdf75aa42faaf0b58ba21a510117e8d0051a3 (diff) | |
| download | rust-ab8994d93e469d3f804e978e379e8342b0c6fe3b.tar.gz rust-ab8994d93e469d3f804e978e379e8342b0c6fe3b.zip | |
Move tests
Diffstat (limited to 'tests/ui/modules')
| -rw-r--r-- | tests/ui/modules/auxiliary/issue-13872-1.rs | 1 | ||||
| -rw-r--r-- | tests/ui/modules/auxiliary/issue-13872-2.rs | 3 | ||||
| -rw-r--r-- | tests/ui/modules/auxiliary/issue-13872-3.rs | 9 | ||||
| -rw-r--r-- | tests/ui/modules/auxiliary/issue-1920.rs | 4 | ||||
| -rw-r--r-- | tests/ui/modules/issue-13872.rs | 12 | ||||
| -rw-r--r-- | tests/ui/modules/issue-1920-1.rs | 14 | ||||
| -rw-r--r-- | tests/ui/modules/issue-1920-1.stderr | 15 | ||||
| -rw-r--r-- | tests/ui/modules/issue-1920-2.rs | 12 | ||||
| -rw-r--r-- | tests/ui/modules/issue-1920-2.stderr | 15 | ||||
| -rw-r--r-- | tests/ui/modules/issue-1920-3.rs | 16 | ||||
| -rw-r--r-- | tests/ui/modules/issue-1920-3.stderr | 15 |
11 files changed, 116 insertions, 0 deletions
diff --git a/tests/ui/modules/auxiliary/issue-13872-1.rs b/tests/ui/modules/auxiliary/issue-13872-1.rs new file mode 100644 index 00000000000..fa9258834c7 --- /dev/null +++ b/tests/ui/modules/auxiliary/issue-13872-1.rs @@ -0,0 +1 @@ +pub enum A { B } diff --git a/tests/ui/modules/auxiliary/issue-13872-2.rs b/tests/ui/modules/auxiliary/issue-13872-2.rs new file mode 100644 index 00000000000..8c64f16e3f9 --- /dev/null +++ b/tests/ui/modules/auxiliary/issue-13872-2.rs @@ -0,0 +1,3 @@ +extern crate issue_13872_1 as foo; + +pub use foo::A::B; diff --git a/tests/ui/modules/auxiliary/issue-13872-3.rs b/tests/ui/modules/auxiliary/issue-13872-3.rs new file mode 100644 index 00000000000..d31d52eb847 --- /dev/null +++ b/tests/ui/modules/auxiliary/issue-13872-3.rs @@ -0,0 +1,9 @@ +extern crate issue_13872_2 as bar; + +use bar::B; + +pub fn foo() { + match B { + B => {} + } +} diff --git a/tests/ui/modules/auxiliary/issue-1920.rs b/tests/ui/modules/auxiliary/issue-1920.rs new file mode 100644 index 00000000000..1548cb99563 --- /dev/null +++ b/tests/ui/modules/auxiliary/issue-1920.rs @@ -0,0 +1,4 @@ +// Just exporting some type to test for correct diagnostics when this +// crate is pulled in at a non-root location in client crate. + +pub struct S; diff --git a/tests/ui/modules/issue-13872.rs b/tests/ui/modules/issue-13872.rs new file mode 100644 index 00000000000..5589d2d4f68 --- /dev/null +++ b/tests/ui/modules/issue-13872.rs @@ -0,0 +1,12 @@ +//@ run-pass +//@ aux-build:issue-13872-1.rs +//@ aux-build:issue-13872-2.rs +//@ aux-build:issue-13872-3.rs + +//@ pretty-expanded FIXME #23616 + +extern crate issue_13872_3 as other; + +fn main() { + other::foo(); +} diff --git a/tests/ui/modules/issue-1920-1.rs b/tests/ui/modules/issue-1920-1.rs new file mode 100644 index 00000000000..763d07db2cd --- /dev/null +++ b/tests/ui/modules/issue-1920-1.rs @@ -0,0 +1,14 @@ +//! Test that absolute path names are correct when a crate is not linked into the root namespace + +//@ aux-build:issue-1920.rs + +mod foo { + pub extern crate issue_1920; +} + +fn assert_clone<T>() where T : Clone { } + +fn main() { + assert_clone::<foo::issue_1920::S>(); + //~^ ERROR `S: Clone` is not satisfied +} diff --git a/tests/ui/modules/issue-1920-1.stderr b/tests/ui/modules/issue-1920-1.stderr new file mode 100644 index 00000000000..b7c7da00672 --- /dev/null +++ b/tests/ui/modules/issue-1920-1.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `S: Clone` is not satisfied + --> $DIR/issue-1920-1.rs:12:20 + | +LL | assert_clone::<foo::issue_1920::S>(); + | ^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `S` + | +note: required by a bound in `assert_clone` + --> $DIR/issue-1920-1.rs:9:32 + | +LL | fn assert_clone<T>() where T : Clone { } + | ^^^^^ required by this bound in `assert_clone` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/modules/issue-1920-2.rs b/tests/ui/modules/issue-1920-2.rs new file mode 100644 index 00000000000..b5a90b2c8e8 --- /dev/null +++ b/tests/ui/modules/issue-1920-2.rs @@ -0,0 +1,12 @@ +//! Test that when a crate is linked under another name that name is used in global paths + +//@ aux-build:issue-1920.rs + +extern crate issue_1920 as bar; + +fn assert_clone<T>() where T : Clone { } + +fn main() { + assert_clone::<bar::S>(); + //~^ ERROR `S: Clone` is not satisfied +} diff --git a/tests/ui/modules/issue-1920-2.stderr b/tests/ui/modules/issue-1920-2.stderr new file mode 100644 index 00000000000..844cb0ff199 --- /dev/null +++ b/tests/ui/modules/issue-1920-2.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `S: Clone` is not satisfied + --> $DIR/issue-1920-2.rs:10:20 + | +LL | assert_clone::<bar::S>(); + | ^^^^^^ the trait `Clone` is not implemented for `S` + | +note: required by a bound in `assert_clone` + --> $DIR/issue-1920-2.rs:7:32 + | +LL | fn assert_clone<T>() where T : Clone { } + | ^^^^^ required by this bound in `assert_clone` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/modules/issue-1920-3.rs b/tests/ui/modules/issue-1920-3.rs new file mode 100644 index 00000000000..372c8b1511c --- /dev/null +++ b/tests/ui/modules/issue-1920-3.rs @@ -0,0 +1,16 @@ +//! Test that when a crate is linked multiple times that the shortest absolute path name is used + +//@ aux-build:issue-1920.rs + +mod foo { + pub extern crate issue_1920; +} + +extern crate issue_1920; + +fn assert_clone<T>() where T : Clone { } + +fn main() { + assert_clone::<foo::issue_1920::S>(); + //~^ ERROR `S: Clone` is not satisfied +} diff --git a/tests/ui/modules/issue-1920-3.stderr b/tests/ui/modules/issue-1920-3.stderr new file mode 100644 index 00000000000..525ca4685bb --- /dev/null +++ b/tests/ui/modules/issue-1920-3.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `S: Clone` is not satisfied + --> $DIR/issue-1920-3.rs:14:20 + | +LL | assert_clone::<foo::issue_1920::S>(); + | ^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `S` + | +note: required by a bound in `assert_clone` + --> $DIR/issue-1920-3.rs:11:32 + | +LL | fn assert_clone<T>() where T : Clone { } + | ^^^^^ required by this bound in `assert_clone` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. |
