about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKivooeo <Kivooeo123@gmail.com>2025-06-09 02:16:25 +0500
committerKivooeo <Kivooeo123@gmail.com>2025-06-11 20:51:49 +0500
commitc6c55cc0cb63667833c54c13ad4a2eb576d48e13 (patch)
tree32ae5b6ade574c1282453e7caa8778cc1765474e
parent8072811356a178dbdf8ca09b1635cfafd4661971 (diff)
downloadrust-c6c55cc0cb63667833c54c13ad4a2eb576d48e13.tar.gz
rust-c6c55cc0cb63667833c54c13ad4a2eb576d48e13.zip
cleaned up some tests
-rw-r--r--tests/ui/cfg/cfg-false-use-item.rs (renamed from tests/ui/filter-block-view-items.rs)2
-rw-r--r--tests/ui/drop/explicit-drop-call-error.fixed (renamed from tests/ui/illegal-ufcs-drop.fixed)2
-rw-r--r--tests/ui/drop/explicit-drop-call-error.rs (renamed from tests/ui/illegal-ufcs-drop.rs)2
-rw-r--r--tests/ui/drop/explicit-drop-call-error.stderr (renamed from tests/ui/illegal-ufcs-drop.stderr)2
-rw-r--r--tests/ui/fmt/format-macro-no-std.rs (renamed from tests/ui/format-no-std.rs)7
-rw-r--r--tests/ui/fun-indirect-call.rs9
-rw-r--r--tests/ui/future-incompatible-lint-group.rs15
-rw-r--r--tests/ui/global-scope.rs13
-rw-r--r--tests/ui/hello.rs10
-rw-r--r--tests/ui/include-macros/parent_dir.rs2
-rw-r--r--tests/ui/include-macros/parent_dir.stderr17
-rw-r--r--tests/ui/lint/future-incompatible-lint-group.rs21
-rw-r--r--tests/ui/lint/future-incompatible-lint-group.stderr (renamed from tests/ui/future-incompatible-lint-group.stderr)18
-rw-r--r--tests/ui/methods/inherent-methods-same-name.rs (renamed from tests/ui/impl-inherent-non-conflict.rs)11
-rw-r--r--tests/ui/modules/impl-cross-module.rs (renamed from tests/ui/impl-not-adjacent-to-type.rs)2
-rw-r--r--tests/ui/resolve/global-scope-resolution.rs21
16 files changed, 76 insertions, 78 deletions
diff --git a/tests/ui/filter-block-view-items.rs b/tests/ui/cfg/cfg-false-use-item.rs
index cb599c27264..d37b48cdedb 100644
--- a/tests/ui/filter-block-view-items.rs
+++ b/tests/ui/cfg/cfg-false-use-item.rs
@@ -1,3 +1,5 @@
+//! Test that use items with cfg(false) are properly filtered out
+
 //@ run-pass
 
 pub fn main() {
diff --git a/tests/ui/illegal-ufcs-drop.fixed b/tests/ui/drop/explicit-drop-call-error.fixed
index 2b1c967ed1e..f2f0245df96 100644
--- a/tests/ui/illegal-ufcs-drop.fixed
+++ b/tests/ui/drop/explicit-drop-call-error.fixed
@@ -1,3 +1,5 @@
+//! Test error for explicit destructor method calls via UFCS
+
 //@ run-rustfix
 
 #![allow(dropping_references)]
diff --git a/tests/ui/illegal-ufcs-drop.rs b/tests/ui/drop/explicit-drop-call-error.rs
index 99dda0dab34..e41c806bd1e 100644
--- a/tests/ui/illegal-ufcs-drop.rs
+++ b/tests/ui/drop/explicit-drop-call-error.rs
@@ -1,3 +1,5 @@
+//! Test error for explicit destructor method calls via UFCS
+
 //@ run-rustfix
 
 #![allow(dropping_references)]
diff --git a/tests/ui/illegal-ufcs-drop.stderr b/tests/ui/drop/explicit-drop-call-error.stderr
index 4f214a12747..95d5c31ab6d 100644
--- a/tests/ui/illegal-ufcs-drop.stderr
+++ b/tests/ui/drop/explicit-drop-call-error.stderr
@@ -1,5 +1,5 @@
 error[E0040]: explicit use of destructor method
-  --> $DIR/illegal-ufcs-drop.rs:12:5
+  --> $DIR/explicit-drop-call-error.rs:14:5
    |
 LL |     Drop::drop(&mut Foo)
    |     ^^^^^^^^^^
diff --git a/tests/ui/format-no-std.rs b/tests/ui/fmt/format-macro-no-std.rs
index 657b210a9a0..d096b4de013 100644
--- a/tests/ui/format-no-std.rs
+++ b/tests/ui/fmt/format-macro-no-std.rs
@@ -1,3 +1,5 @@
+//! Test format! macro functionality in no_std environment
+
 //@ run-pass
 //@ ignore-emscripten no no_std executables
 //@ ignore-wasm different `main` convention
@@ -9,7 +11,8 @@
 // Import global allocator and panic handler.
 extern crate std as other;
 
-#[macro_use] extern crate alloc;
+#[macro_use]
+extern crate alloc;
 
 use alloc::string::ToString;
 
@@ -21,7 +24,7 @@ extern "C" fn main(_argc: core::ffi::c_int, _argv: *const *const u8) -> core::ff
     let s = format!("test");
     assert_eq!(s, "test".to_string());
 
-    let s = format!("{test}", test=3_isize);
+    let s = format!("{test}", test = 3_isize);
     assert_eq!(s, "3".to_string());
 
     let s = format!("hello {}", "world");
diff --git a/tests/ui/fun-indirect-call.rs b/tests/ui/fun-indirect-call.rs
deleted file mode 100644
index 7919be07f7e..00000000000
--- a/tests/ui/fun-indirect-call.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-//@ run-pass
-
-fn f() -> isize { return 42; }
-
-pub fn main() {
-    let g: fn() -> isize = f;
-    let i: isize = g();
-    assert_eq!(i, 42);
-}
diff --git a/tests/ui/future-incompatible-lint-group.rs b/tests/ui/future-incompatible-lint-group.rs
deleted file mode 100644
index ed2c47bb609..00000000000
--- a/tests/ui/future-incompatible-lint-group.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Ensure that the future_incompatible lint group only includes
-// lints for changes that are not tied to an edition
-#![deny(future_incompatible)]
-
-// Error since this is a `future_incompatible` lint
-macro_rules! m { ($i) => {} } //~ ERROR missing fragment specifier
-                              //~| WARN this was previously accepted
-
-trait Tr {
-    // Warn only since this is not a `future_incompatible` lint
-    fn f(u8) {} //~ WARN anonymous parameters are deprecated
-                //~| WARN this is accepted in the current edition
-}
-
-fn main() {}
diff --git a/tests/ui/global-scope.rs b/tests/ui/global-scope.rs
deleted file mode 100644
index 33b56bca940..00000000000
--- a/tests/ui/global-scope.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-//@ run-pass
-
-pub fn f() -> isize { return 1; }
-
-pub mod foo {
-    pub fn f() -> isize { return 2; }
-    pub fn g() {
-        assert_eq!(f(), 2);
-        assert_eq!(::f(), 1);
-    }
-}
-
-pub fn main() { return foo::g(); }
diff --git a/tests/ui/hello.rs b/tests/ui/hello.rs
deleted file mode 100644
index f329ee086f9..00000000000
--- a/tests/ui/hello.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-//@ run-pass
-//@ revisions: e2015 e2018 e2021 e2024
-
-//@[e2018] edition:2018
-//@[e2021] edition:2021
-//@[e2024] edition:2024
-
-fn main() {
-    println!("hello");
-}
diff --git a/tests/ui/include-macros/parent_dir.rs b/tests/ui/include-macros/parent_dir.rs
index 1dcf27324d1..9a81a6deeb1 100644
--- a/tests/ui/include-macros/parent_dir.rs
+++ b/tests/ui/include-macros/parent_dir.rs
@@ -3,8 +3,6 @@
 fn main() {
     let _ = include_str!("include-macros/file.txt");            //~ ERROR couldn't read
                                                                 //~^HELP different directory
-    let _ = include_str!("hello.rs");                           //~ ERROR couldn't read
-                                                                //~^HELP different directory
     let _ = include_bytes!("../../data.bin");                   //~ ERROR couldn't read
                                                                 //~^HELP different directory
     let _ = include_str!("tests/ui/include-macros/file.txt");   //~ ERROR couldn't read
diff --git a/tests/ui/include-macros/parent_dir.stderr b/tests/ui/include-macros/parent_dir.stderr
index 4ee6fe104b0..7a18b1de5d1 100644
--- a/tests/ui/include-macros/parent_dir.stderr
+++ b/tests/ui/include-macros/parent_dir.stderr
@@ -10,19 +10,8 @@ LL -     let _ = include_str!("include-macros/file.txt");
 LL +     let _ = include_str!("file.txt");
    |
 
-error: couldn't read `$DIR/hello.rs`: $FILE_NOT_FOUND_MSG
-  --> $DIR/parent_dir.rs:6:13
-   |
-LL |     let _ = include_str!("hello.rs");
-   |             ^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: there is a file with the same name in a different directory
-   |
-LL |     let _ = include_str!("../hello.rs");
-   |                           +++
-
 error: couldn't read `$DIR/../../data.bin`: $FILE_NOT_FOUND_MSG
-  --> $DIR/parent_dir.rs:8:13
+  --> $DIR/parent_dir.rs:6:13
    |
 LL |     let _ = include_bytes!("../../data.bin");
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -34,7 +23,7 @@ LL +     let _ = include_bytes!("data.bin");
    |
 
 error: couldn't read `$DIR/tests/ui/include-macros/file.txt`: $FILE_NOT_FOUND_MSG
-  --> $DIR/parent_dir.rs:10:13
+  --> $DIR/parent_dir.rs:8:13
    |
 LL |     let _ = include_str!("tests/ui/include-macros/file.txt");
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -45,5 +34,5 @@ LL -     let _ = include_str!("tests/ui/include-macros/file.txt");
 LL +     let _ = include_str!("file.txt");
    |
 
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
 
diff --git a/tests/ui/lint/future-incompatible-lint-group.rs b/tests/ui/lint/future-incompatible-lint-group.rs
new file mode 100644
index 00000000000..d1adcf21cdc
--- /dev/null
+++ b/tests/ui/lint/future-incompatible-lint-group.rs
@@ -0,0 +1,21 @@
+//! Test that future_incompatible lint group only includes edition-independent lints
+
+// Ensure that the future_incompatible lint group only includes
+// lints for changes that are not tied to an edition
+#![deny(future_incompatible)]
+
+// Error since this is a `future_incompatible` lint
+macro_rules! m {
+    ($i) => {};
+    //~^ ERROR missing fragment specifier
+    //~| WARN this was previously accepted
+}
+
+trait Tr {
+    // Warn only since this is not a `future_incompatible` lint
+    fn f(u8) {}
+    //~^ WARN anonymous parameters are deprecated
+    //~| WARN this is accepted in the current edition
+}
+
+fn main() {}
diff --git a/tests/ui/future-incompatible-lint-group.stderr b/tests/ui/lint/future-incompatible-lint-group.stderr
index 4c867e0aab3..264911b46d4 100644
--- a/tests/ui/future-incompatible-lint-group.stderr
+++ b/tests/ui/lint/future-incompatible-lint-group.stderr
@@ -1,20 +1,20 @@
 error: missing fragment specifier
-  --> $DIR/future-incompatible-lint-group.rs:6:19
+  --> $DIR/future-incompatible-lint-group.rs:9:6
    |
-LL | macro_rules! m { ($i) => {} }
-   |                   ^^
+LL |     ($i) => {};
+   |      ^^
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
 note: the lint level is defined here
-  --> $DIR/future-incompatible-lint-group.rs:3:9
+  --> $DIR/future-incompatible-lint-group.rs:5:9
    |
 LL | #![deny(future_incompatible)]
    |         ^^^^^^^^^^^^^^^^^^^
    = note: `#[deny(missing_fragment_specifier)]` implied by `#[deny(future_incompatible)]`
 
 warning: anonymous parameters are deprecated and will be removed in the next edition
-  --> $DIR/future-incompatible-lint-group.rs:11:10
+  --> $DIR/future-incompatible-lint-group.rs:16:10
    |
 LL |     fn f(u8) {}
    |          ^^ help: try naming the parameter or explicitly ignoring it: `_: u8`
@@ -27,15 +27,15 @@ error: aborting due to 1 previous error; 1 warning emitted
 
 Future incompatibility report: Future breakage diagnostic:
 error: missing fragment specifier
-  --> $DIR/future-incompatible-lint-group.rs:6:19
+  --> $DIR/future-incompatible-lint-group.rs:9:6
    |
-LL | macro_rules! m { ($i) => {} }
-   |                   ^^
+LL |     ($i) => {};
+   |      ^^
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
 note: the lint level is defined here
-  --> $DIR/future-incompatible-lint-group.rs:3:9
+  --> $DIR/future-incompatible-lint-group.rs:5:9
    |
 LL | #![deny(future_incompatible)]
    |         ^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/impl-inherent-non-conflict.rs b/tests/ui/methods/inherent-methods-same-name.rs
index 41ab865892a..d7d19bc3325 100644
--- a/tests/ui/impl-inherent-non-conflict.rs
+++ b/tests/ui/methods/inherent-methods-same-name.rs
@@ -1,17 +1,22 @@
+//! Test multiple inherent methods with same name on different type parameters
+
 //@ run-pass
 // Ensure that a user-defined type admits multiple inherent methods
 // with the same name, which can be called on values that have a
 // precise enough type to allow distinguishing between the methods.
 
-
 struct Foo<T>(T);
 
 impl Foo<usize> {
-    fn bar(&self) -> i32 { self.0 as i32 }
+    fn bar(&self) -> i32 {
+        self.0 as i32
+    }
 }
 
 impl Foo<isize> {
-    fn bar(&self) -> i32 { -(self.0 as i32) }
+    fn bar(&self) -> i32 {
+        -(self.0 as i32)
+    }
 }
 
 fn main() {
diff --git a/tests/ui/impl-not-adjacent-to-type.rs b/tests/ui/modules/impl-cross-module.rs
index ccf59ed4393..3ed8c18ff3c 100644
--- a/tests/ui/impl-not-adjacent-to-type.rs
+++ b/tests/ui/modules/impl-cross-module.rs
@@ -1,3 +1,5 @@
+//! Test implementing methods for types defined in other modules
+
 //@ run-pass
 
 mod foo {
diff --git a/tests/ui/resolve/global-scope-resolution.rs b/tests/ui/resolve/global-scope-resolution.rs
new file mode 100644
index 00000000000..176bab36da7
--- /dev/null
+++ b/tests/ui/resolve/global-scope-resolution.rs
@@ -0,0 +1,21 @@
+//! Test global scope resolution with :: operator
+
+//@ run-pass
+
+pub fn f() -> isize {
+    return 1;
+}
+
+pub mod foo {
+    pub fn f() -> isize {
+        return 2;
+    }
+    pub fn g() {
+        assert_eq!(f(), 2);
+        assert_eq!(::f(), 1);
+    }
+}
+
+pub fn main() {
+    return foo::g();
+}