about summary refs log tree commit diff
path: root/tests/ui/modules
diff options
context:
space:
mode:
authorCaio <c410.f3r@gmail.com>2024-04-06 17:08:59 -0300
committerCaio <c410.f3r@gmail.com>2024-04-07 17:38:07 -0300
commitab8994d93e469d3f804e978e379e8342b0c6fe3b (patch)
tree393e4373c4f705aecef0db083e0da73fd3b50edd /tests/ui/modules
parent9d5cdf75aa42faaf0b58ba21a510117e8d0051a3 (diff)
downloadrust-ab8994d93e469d3f804e978e379e8342b0c6fe3b.tar.gz
rust-ab8994d93e469d3f804e978e379e8342b0c6fe3b.zip
Move tests
Diffstat (limited to 'tests/ui/modules')
-rw-r--r--tests/ui/modules/auxiliary/issue-13872-1.rs1
-rw-r--r--tests/ui/modules/auxiliary/issue-13872-2.rs3
-rw-r--r--tests/ui/modules/auxiliary/issue-13872-3.rs9
-rw-r--r--tests/ui/modules/auxiliary/issue-1920.rs4
-rw-r--r--tests/ui/modules/issue-13872.rs12
-rw-r--r--tests/ui/modules/issue-1920-1.rs14
-rw-r--r--tests/ui/modules/issue-1920-1.stderr15
-rw-r--r--tests/ui/modules/issue-1920-2.rs12
-rw-r--r--tests/ui/modules/issue-1920-2.stderr15
-rw-r--r--tests/ui/modules/issue-1920-3.rs16
-rw-r--r--tests/ui/modules/issue-1920-3.stderr15
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`.