diff options
| author | Kivooeo <Kivooeo123@gmail.com> | 2025-07-01 23:33:59 +0500 |
|---|---|---|
| committer | Kivooeo <Kivooeo123@gmail.com> | 2025-07-01 23:33:59 +0500 |
| commit | 1fb5e0149fb85af0e49fa40329cbc352b4cba861 (patch) | |
| tree | 99717c06e20c4557a9e4d756a13bbf88d8093966 /tests/ui/modules | |
| parent | f46ce66fcc3d6058f90ac5bf0930f940f1e7b0ca (diff) | |
| download | rust-1fb5e0149fb85af0e49fa40329cbc352b4cba861.tar.gz rust-1fb5e0149fb85af0e49fa40329cbc352b4cba861.zip | |
moved tests
Diffstat (limited to 'tests/ui/modules')
| -rw-r--r-- | tests/ui/modules/module-qualified-paths-basic.rs | 11 | ||||
| -rw-r--r-- | tests/ui/modules/module-use-nested-groups.rs | 32 | ||||
| -rw-r--r-- | tests/ui/modules/primitive-type-module-deprecated-paths.rs | 12 | ||||
| -rw-r--r-- | tests/ui/modules/use-keyword-reexport-type-alias.rs | 23 |
4 files changed, 78 insertions, 0 deletions
diff --git a/tests/ui/modules/module-qualified-paths-basic.rs b/tests/ui/modules/module-qualified-paths-basic.rs new file mode 100644 index 00000000000..d948ffc1520 --- /dev/null +++ b/tests/ui/modules/module-qualified-paths-basic.rs @@ -0,0 +1,11 @@ +//@ run-pass + +mod foo { + pub fn x() -> isize { return 1; } +} + +mod bar { + pub fn y() -> isize { return 1; } +} + +pub fn main() { foo::x(); bar::y(); } diff --git a/tests/ui/modules/module-use-nested-groups.rs b/tests/ui/modules/module-use-nested-groups.rs new file mode 100644 index 00000000000..c5d66a86935 --- /dev/null +++ b/tests/ui/modules/module-use-nested-groups.rs @@ -0,0 +1,32 @@ +//@ run-pass + +mod a { + pub enum B {} + + pub mod d { + pub enum E {} + pub enum F {} + + pub mod g { + pub enum H {} + pub enum I {} + } + } +} + +// Test every possible part of the syntax +use a::{B, d::{self, *, g::H}}; + +// Test a more common use case +use std::sync::{Arc, atomic::{AtomicBool, Ordering}}; + +fn main() { + let _: B; + let _: E; + let _: F; + let _: H; + let _: d::g::I; + + let _: Arc<AtomicBool>; + let _: Ordering; +} diff --git a/tests/ui/modules/primitive-type-module-deprecated-paths.rs b/tests/ui/modules/primitive-type-module-deprecated-paths.rs new file mode 100644 index 00000000000..6e8c7053c57 --- /dev/null +++ b/tests/ui/modules/primitive-type-module-deprecated-paths.rs @@ -0,0 +1,12 @@ +//@ run-pass + +// Make sure the module level constants are still there and accessible even after +// the corresponding associated constants have been added, and later stabilized. +#![allow(deprecated, deprecated_in_future)] +use std::{u16, f32}; + +fn main() { + let _ = u16::MAX; + let _ = f32::EPSILON; + let _ = std::f64::MANTISSA_DIGITS; +} diff --git a/tests/ui/modules/use-keyword-reexport-type-alias.rs b/tests/ui/modules/use-keyword-reexport-type-alias.rs new file mode 100644 index 00000000000..4f3d1ee500d --- /dev/null +++ b/tests/ui/modules/use-keyword-reexport-type-alias.rs @@ -0,0 +1,23 @@ +//@ run-pass + +#![allow(unused_variables)] +pub struct A; + +mod test { + pub use super :: A; + + pub use self :: A as B; +} + +impl A { + fn f() {} + fn g() { + Self :: f() + } +} + +fn main() { + let a: A = test::A; + let b: A = test::B; + let c: () = A::g(); +} |
