From 1fb5e0149fb85af0e49fa40329cbc352b4cba861 Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Tue, 1 Jul 2025 23:33:59 +0500 Subject: [PATCH 01/23] moved tests --- .../weak-uninhabited-type.rs} | 0 .../underscore-prefixed-function-argument.rs} | 0 .../ownership-struct-update-moved-error.rs} | 0 .../ownership-struct-update-moved-error.stderr} | 0 .../no-capture-closure-call.rs} | 0 .../ui/{unknown-llvm-arg.rs => codegen/llvm-args-invalid-flag.rs} | 0 .../llvm-args-invalid-flag.stderr} | 0 .../box-drop-unused-value-statement-regression.rs} | 0 tests/ui/{weird-exprs.rs => expr/syntax-edge-cases-lint-clean.rs} | 0 .../hashset-enum-variant.rs} | 0 tests/ui/{write-fmt-errors.rs => io-checks/write-macro-error.rs} | 0 .../lang-item-unknown-definition-error.rs} | 0 .../lang-item-unknown-definition-error.stderr} | 0 .../module-qualified-paths-basic.rs} | 0 .../{use-nested-groups.rs => modules/module-use-nested-groups.rs} | 0 .../primitive-type-module-deprecated-paths.rs} | 0 .../use-keyword-reexport-type-alias.rs} | 0 .../unary-negation-unsigned-integer-error.rs} | 0 .../unary-negation-unsigned-integer-error.stderr} | 0 .../unwind-force-no-unwind-tables.rs} | 0 .../process-spawn-failure.rs} | 0 .../windows-exit-code-still-active.rs} | 0 .../diverging-expressions-unreachable-code.rs} | 0 .../unreachable-code-diverging-expressions.rs} | 0 .../virtual-call-parameter-handling.rs} | 0 tests/ui/{unit.rs => type/unit-type-basic-usages.rs} | 0 .../usize-no-generic-arguments.rs} | 0 .../usize-no-generic-arguments.stderr} | 0 .../maybe-uninit-zero-sized-types.rs} | 0 29 files changed, 0 insertions(+), 0 deletions(-) rename tests/ui/{weak-new-uninhabited-issue-48493.rs => allocator/weak-uninhabited-type.rs} (100%) rename tests/ui/{unnamed_argument_mode.rs => binding/underscore-prefixed-function-argument.rs} (100%) rename tests/ui/{walk-struct-literal-with.rs => borrowck/ownership-struct-update-moved-error.rs} (100%) rename tests/ui/{walk-struct-literal-with.stderr => borrowck/ownership-struct-update-moved-error.stderr} (100%) rename tests/ui/{unused-move-capture.rs => closures/no-capture-closure-call.rs} (100%) rename tests/ui/{unknown-llvm-arg.rs => codegen/llvm-args-invalid-flag.rs} (100%) rename tests/ui/{unknown-llvm-arg.stderr => codegen/llvm-args-invalid-flag.stderr} (100%) rename tests/ui/{unused-move.rs => drop/box-drop-unused-value-statement-regression.rs} (100%) rename tests/ui/{weird-exprs.rs => expr/syntax-edge-cases-lint-clean.rs} (100%) rename tests/ui/{wrong-hashset-issue-42918.rs => hashmap/hashset-enum-variant.rs} (100%) rename tests/ui/{write-fmt-errors.rs => io-checks/write-macro-error.rs} (100%) rename tests/ui/{unknown-language-item.rs => lang-items/lang-item-unknown-definition-error.rs} (100%) rename tests/ui/{unknown-language-item.stderr => lang-items/lang-item-unknown-definition-error.stderr} (100%) rename tests/ui/{use-import-export.rs => modules/module-qualified-paths-basic.rs} (100%) rename tests/ui/{use-nested-groups.rs => modules/module-use-nested-groups.rs} (100%) rename tests/ui/{use-module-level-int-consts.rs => modules/primitive-type-module-deprecated-paths.rs} (100%) rename tests/ui/{use-keyword-2.rs => modules/use-keyword-reexport-type-alias.rs} (100%) rename tests/ui/{unsigned-literal-negation.rs => numbers-arithmetic/unary-negation-unsigned-integer-error.rs} (100%) rename tests/ui/{unsigned-literal-negation.stderr => numbers-arithmetic/unary-negation-unsigned-integer-error.stderr} (100%) rename tests/ui/{unwind-no-uwtable.rs => panics/unwind-force-no-unwind-tables.rs} (100%) rename tests/ui/{wait-forked-but-failed-child.rs => process/process-spawn-failure.rs} (100%) rename tests/ui/{weird-exit-code.rs => process/windows-exit-code-still-active.rs} (100%) rename tests/ui/{unreachable-code-1.rs => reachable/diverging-expressions-unreachable-code.rs} (100%) rename tests/ui/{unreachable-code.rs => reachable/unreachable-code-diverging-expressions.rs} (100%) rename tests/ui/{virtual-call-attrs-issue-137646.rs => traits/virtual-call-parameter-handling.rs} (100%) rename tests/ui/{unit.rs => type/unit-type-basic-usages.rs} (100%) rename tests/ui/{usize-generic-argument-parent.rs => type/usize-no-generic-arguments.rs} (100%) rename tests/ui/{usize-generic-argument-parent.stderr => type/usize-no-generic-arguments.stderr} (100%) rename tests/ui/{uninit-empty-types.rs => unsafe/maybe-uninit-zero-sized-types.rs} (100%) diff --git a/tests/ui/weak-new-uninhabited-issue-48493.rs b/tests/ui/allocator/weak-uninhabited-type.rs similarity index 100% rename from tests/ui/weak-new-uninhabited-issue-48493.rs rename to tests/ui/allocator/weak-uninhabited-type.rs diff --git a/tests/ui/unnamed_argument_mode.rs b/tests/ui/binding/underscore-prefixed-function-argument.rs similarity index 100% rename from tests/ui/unnamed_argument_mode.rs rename to tests/ui/binding/underscore-prefixed-function-argument.rs diff --git a/tests/ui/walk-struct-literal-with.rs b/tests/ui/borrowck/ownership-struct-update-moved-error.rs similarity index 100% rename from tests/ui/walk-struct-literal-with.rs rename to tests/ui/borrowck/ownership-struct-update-moved-error.rs diff --git a/tests/ui/walk-struct-literal-with.stderr b/tests/ui/borrowck/ownership-struct-update-moved-error.stderr similarity index 100% rename from tests/ui/walk-struct-literal-with.stderr rename to tests/ui/borrowck/ownership-struct-update-moved-error.stderr diff --git a/tests/ui/unused-move-capture.rs b/tests/ui/closures/no-capture-closure-call.rs similarity index 100% rename from tests/ui/unused-move-capture.rs rename to tests/ui/closures/no-capture-closure-call.rs diff --git a/tests/ui/unknown-llvm-arg.rs b/tests/ui/codegen/llvm-args-invalid-flag.rs similarity index 100% rename from tests/ui/unknown-llvm-arg.rs rename to tests/ui/codegen/llvm-args-invalid-flag.rs diff --git a/tests/ui/unknown-llvm-arg.stderr b/tests/ui/codegen/llvm-args-invalid-flag.stderr similarity index 100% rename from tests/ui/unknown-llvm-arg.stderr rename to tests/ui/codegen/llvm-args-invalid-flag.stderr diff --git a/tests/ui/unused-move.rs b/tests/ui/drop/box-drop-unused-value-statement-regression.rs similarity index 100% rename from tests/ui/unused-move.rs rename to tests/ui/drop/box-drop-unused-value-statement-regression.rs diff --git a/tests/ui/weird-exprs.rs b/tests/ui/expr/syntax-edge-cases-lint-clean.rs similarity index 100% rename from tests/ui/weird-exprs.rs rename to tests/ui/expr/syntax-edge-cases-lint-clean.rs diff --git a/tests/ui/wrong-hashset-issue-42918.rs b/tests/ui/hashmap/hashset-enum-variant.rs similarity index 100% rename from tests/ui/wrong-hashset-issue-42918.rs rename to tests/ui/hashmap/hashset-enum-variant.rs diff --git a/tests/ui/write-fmt-errors.rs b/tests/ui/io-checks/write-macro-error.rs similarity index 100% rename from tests/ui/write-fmt-errors.rs rename to tests/ui/io-checks/write-macro-error.rs diff --git a/tests/ui/unknown-language-item.rs b/tests/ui/lang-items/lang-item-unknown-definition-error.rs similarity index 100% rename from tests/ui/unknown-language-item.rs rename to tests/ui/lang-items/lang-item-unknown-definition-error.rs diff --git a/tests/ui/unknown-language-item.stderr b/tests/ui/lang-items/lang-item-unknown-definition-error.stderr similarity index 100% rename from tests/ui/unknown-language-item.stderr rename to tests/ui/lang-items/lang-item-unknown-definition-error.stderr diff --git a/tests/ui/use-import-export.rs b/tests/ui/modules/module-qualified-paths-basic.rs similarity index 100% rename from tests/ui/use-import-export.rs rename to tests/ui/modules/module-qualified-paths-basic.rs diff --git a/tests/ui/use-nested-groups.rs b/tests/ui/modules/module-use-nested-groups.rs similarity index 100% rename from tests/ui/use-nested-groups.rs rename to tests/ui/modules/module-use-nested-groups.rs diff --git a/tests/ui/use-module-level-int-consts.rs b/tests/ui/modules/primitive-type-module-deprecated-paths.rs similarity index 100% rename from tests/ui/use-module-level-int-consts.rs rename to tests/ui/modules/primitive-type-module-deprecated-paths.rs diff --git a/tests/ui/use-keyword-2.rs b/tests/ui/modules/use-keyword-reexport-type-alias.rs similarity index 100% rename from tests/ui/use-keyword-2.rs rename to tests/ui/modules/use-keyword-reexport-type-alias.rs diff --git a/tests/ui/unsigned-literal-negation.rs b/tests/ui/numbers-arithmetic/unary-negation-unsigned-integer-error.rs similarity index 100% rename from tests/ui/unsigned-literal-negation.rs rename to tests/ui/numbers-arithmetic/unary-negation-unsigned-integer-error.rs diff --git a/tests/ui/unsigned-literal-negation.stderr b/tests/ui/numbers-arithmetic/unary-negation-unsigned-integer-error.stderr similarity index 100% rename from tests/ui/unsigned-literal-negation.stderr rename to tests/ui/numbers-arithmetic/unary-negation-unsigned-integer-error.stderr diff --git a/tests/ui/unwind-no-uwtable.rs b/tests/ui/panics/unwind-force-no-unwind-tables.rs similarity index 100% rename from tests/ui/unwind-no-uwtable.rs rename to tests/ui/panics/unwind-force-no-unwind-tables.rs diff --git a/tests/ui/wait-forked-but-failed-child.rs b/tests/ui/process/process-spawn-failure.rs similarity index 100% rename from tests/ui/wait-forked-but-failed-child.rs rename to tests/ui/process/process-spawn-failure.rs diff --git a/tests/ui/weird-exit-code.rs b/tests/ui/process/windows-exit-code-still-active.rs similarity index 100% rename from tests/ui/weird-exit-code.rs rename to tests/ui/process/windows-exit-code-still-active.rs diff --git a/tests/ui/unreachable-code-1.rs b/tests/ui/reachable/diverging-expressions-unreachable-code.rs similarity index 100% rename from tests/ui/unreachable-code-1.rs rename to tests/ui/reachable/diverging-expressions-unreachable-code.rs diff --git a/tests/ui/unreachable-code.rs b/tests/ui/reachable/unreachable-code-diverging-expressions.rs similarity index 100% rename from tests/ui/unreachable-code.rs rename to tests/ui/reachable/unreachable-code-diverging-expressions.rs diff --git a/tests/ui/virtual-call-attrs-issue-137646.rs b/tests/ui/traits/virtual-call-parameter-handling.rs similarity index 100% rename from tests/ui/virtual-call-attrs-issue-137646.rs rename to tests/ui/traits/virtual-call-parameter-handling.rs diff --git a/tests/ui/unit.rs b/tests/ui/type/unit-type-basic-usages.rs similarity index 100% rename from tests/ui/unit.rs rename to tests/ui/type/unit-type-basic-usages.rs diff --git a/tests/ui/usize-generic-argument-parent.rs b/tests/ui/type/usize-no-generic-arguments.rs similarity index 100% rename from tests/ui/usize-generic-argument-parent.rs rename to tests/ui/type/usize-no-generic-arguments.rs diff --git a/tests/ui/usize-generic-argument-parent.stderr b/tests/ui/type/usize-no-generic-arguments.stderr similarity index 100% rename from tests/ui/usize-generic-argument-parent.stderr rename to tests/ui/type/usize-no-generic-arguments.stderr diff --git a/tests/ui/uninit-empty-types.rs b/tests/ui/unsafe/maybe-uninit-zero-sized-types.rs similarity index 100% rename from tests/ui/uninit-empty-types.rs rename to tests/ui/unsafe/maybe-uninit-zero-sized-types.rs From c9f97d333567b971331d4382422c5619fc587985 Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Tue, 1 Jul 2025 23:37:49 +0500 Subject: [PATCH 02/23] uninit-empty-types --- tests/ui/unsafe/maybe-uninit-zero-sized-types.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/ui/unsafe/maybe-uninit-zero-sized-types.rs b/tests/ui/unsafe/maybe-uninit-zero-sized-types.rs index 82474d873b788..e587ca554fe4d 100644 --- a/tests/ui/unsafe/maybe-uninit-zero-sized-types.rs +++ b/tests/ui/unsafe/maybe-uninit-zero-sized-types.rs @@ -1,6 +1,9 @@ -//@ build-pass -// Test the uninit() construct returning various empty types. +//! This test checks that ZSTs can be safely initialized from +//! `MaybeUninit::uninit().assume_init()` and `std::mem::uninitialized()` +//! (which is deprecated). This is safe because ZSTs inherently +//! require no actual memory initialization, as they occupy no memory. +//@ build-pass use std::mem::MaybeUninit; From 34cea131cf4bb0f9a60baedf75b80306ad7ab341 Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Tue, 1 Jul 2025 23:39:55 +0500 Subject: [PATCH 03/23] unit --- tests/ui/type/unit-type-basic-usages.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/tests/ui/type/unit-type-basic-usages.rs b/tests/ui/type/unit-type-basic-usages.rs index 04404fc3f5e66..24c685aebdc0b 100644 --- a/tests/ui/type/unit-type-basic-usages.rs +++ b/tests/ui/type/unit-type-basic-usages.rs @@ -1,16 +1,14 @@ -//@ run-pass - -#![allow(unused_assignments)] -#![allow(unknown_lints)] +// Checks the basic usage of unit type -#![allow(unused_variables)] -#![allow(dead_assignment)] +//@ run-pass -fn f(u: ()) { return u; } +fn f(u: ()) { + u +} pub fn main() { let u1: () = (); - let mut u2: () = f(u1); - u2 = (); - return (); + let mut _u2: () = f(u1); + _u2 = (); + () } From 6d8cc7356b68daaa03f6db34bf6afc629d0294d6 Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Tue, 1 Jul 2025 23:41:33 +0500 Subject: [PATCH 04/23] unknown-language-item --- tests/ui/lang-items/lang-item-unknown-definition-error.rs | 4 +++- tests/ui/lang-items/lang-item-unknown-definition-error.stderr | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/ui/lang-items/lang-item-unknown-definition-error.rs b/tests/ui/lang-items/lang-item-unknown-definition-error.rs index ce206d20358a1..22812128c2d36 100644 --- a/tests/ui/lang-items/lang-item-unknown-definition-error.rs +++ b/tests/ui/lang-items/lang-item-unknown-definition-error.rs @@ -1,9 +1,11 @@ +//! Checks that compiler prevernt attempting to define an unrecognized or unknown lang item + #![allow(unused)] #![feature(lang_items)] #[lang = "foo"] fn bar() -> ! { -//~^^ ERROR definition of an unknown lang item: `foo` + //~^^ ERROR definition of an unknown lang item: `foo` loop {} } diff --git a/tests/ui/lang-items/lang-item-unknown-definition-error.stderr b/tests/ui/lang-items/lang-item-unknown-definition-error.stderr index 832f134241844..3b939757ac2b0 100644 --- a/tests/ui/lang-items/lang-item-unknown-definition-error.stderr +++ b/tests/ui/lang-items/lang-item-unknown-definition-error.stderr @@ -1,5 +1,5 @@ error[E0522]: definition of an unknown lang item: `foo` - --> $DIR/unknown-language-item.rs:4:1 + --> $DIR/lang-item-unknown-definition-error.rs:6:1 | LL | #[lang = "foo"] | ^^^^^^^^^^^^^^^ definition of unknown lang item `foo` From 41efd61a69370b29f6d647b8def3f8ded6073189 Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Tue, 1 Jul 2025 23:44:18 +0500 Subject: [PATCH 05/23] unnamed_argument_mode --- .../binding/underscore-prefixed-function-argument.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/ui/binding/underscore-prefixed-function-argument.rs b/tests/ui/binding/underscore-prefixed-function-argument.rs index 2014e0d23d849..aec2e1b9eb861 100644 --- a/tests/ui/binding/underscore-prefixed-function-argument.rs +++ b/tests/ui/binding/underscore-prefixed-function-argument.rs @@ -1,11 +1,13 @@ -//@ run-pass +//! Test that functions with unnamed arguments are correct handled by compiler -fn good(_a: &isize) { -} +//@ run-pass -// unnamed argument &isize is now parse x: &isize +fn good(_a: &isize) {} -fn called(_f: F) where F: FnOnce(&isize) { +fn called(_f: F) +where + F: FnOnce(&isize), +{ } pub fn main() { From ccbb2a4544e7a2355d02d946925c0e17ce1152d2 Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Tue, 1 Jul 2025 23:49:56 +0500 Subject: [PATCH 06/23] unreachable-code-1 --- .../diverging-expressions-unreachable-code.rs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/ui/reachable/diverging-expressions-unreachable-code.rs b/tests/ui/reachable/diverging-expressions-unreachable-code.rs index 9c5f7c8f45190..bb56987775ff2 100644 --- a/tests/ui/reachable/diverging-expressions-unreachable-code.rs +++ b/tests/ui/reachable/diverging-expressions-unreachable-code.rs @@ -3,17 +3,17 @@ #![allow(unused_must_use)] #![allow(unreachable_code)] -#![allow(unused_variables)] -#![allow(dead_code)] - -fn id(x: bool) -> bool { x } - -fn call_id() { - let c = panic!(); - id(c); +fn _id(x: bool) -> bool { + x } -fn call_id_3() { id(return) && id(return); } +fn _call_id() { + let _c = panic!(); + _id(_c); +} -pub fn main() { +fn _call_id_3() { + _id(return) && _id(return); } + +pub fn main() {} From f19500ec2ec31737e4d5b6e0691002dbc7fcf62e Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Tue, 1 Jul 2025 23:50:46 +0500 Subject: [PATCH 07/23] unreachable-code --- .../unreachable-code-diverging-expressions.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/ui/reachable/unreachable-code-diverging-expressions.rs b/tests/ui/reachable/unreachable-code-diverging-expressions.rs index 0c46a38d73f35..00676418002c9 100644 --- a/tests/ui/reachable/unreachable-code-diverging-expressions.rs +++ b/tests/ui/reachable/unreachable-code-diverging-expressions.rs @@ -26,9 +26,13 @@ fn call_id_3() { fn ret_guard() { match 2 { - x if (return) => { x; } - x if let true = return => { x; } - _ => {} + x if (return) => { + x; + } + x if let true = return => { + x; + } + _ => {} } } From ace1230d52c1f9406aeb8eeb143bb5fea2c1b96c Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Tue, 1 Jul 2025 23:51:49 +0500 Subject: [PATCH 08/23] unsigned-literal-negation --- .../unary-negation-unsigned-integer-error.rs | 2 ++ .../unary-negation-unsigned-integer-error.stderr | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/ui/numbers-arithmetic/unary-negation-unsigned-integer-error.rs b/tests/ui/numbers-arithmetic/unary-negation-unsigned-integer-error.rs index 943c7f79742ab..4325c8b111bc5 100644 --- a/tests/ui/numbers-arithmetic/unary-negation-unsigned-integer-error.rs +++ b/tests/ui/numbers-arithmetic/unary-negation-unsigned-integer-error.rs @@ -1,3 +1,5 @@ +//! This test ensures that the unary negation operator (`-`) cannot be applied to unsigned ints + fn main() { let x = -1 as usize; //~ ERROR: cannot apply unary operator `-` let x = (-1) as usize; //~ ERROR: cannot apply unary operator `-` diff --git a/tests/ui/numbers-arithmetic/unary-negation-unsigned-integer-error.stderr b/tests/ui/numbers-arithmetic/unary-negation-unsigned-integer-error.stderr index 0bedbc1accd3b..4ce870ded9f76 100644 --- a/tests/ui/numbers-arithmetic/unary-negation-unsigned-integer-error.stderr +++ b/tests/ui/numbers-arithmetic/unary-negation-unsigned-integer-error.stderr @@ -1,5 +1,5 @@ error[E0600]: cannot apply unary operator `-` to type `usize` - --> $DIR/unsigned-literal-negation.rs:2:13 + --> $DIR/unary-negation-unsigned-integer-error.rs:4:13 | LL | let x = -1 as usize; | ^^ cannot apply unary operator `-` @@ -12,7 +12,7 @@ LL + let x = usize::MAX; | error[E0600]: cannot apply unary operator `-` to type `usize` - --> $DIR/unsigned-literal-negation.rs:3:13 + --> $DIR/unary-negation-unsigned-integer-error.rs:5:13 | LL | let x = (-1) as usize; | ^^^^ cannot apply unary operator `-` @@ -25,7 +25,7 @@ LL + let x = usize::MAX; | error[E0600]: cannot apply unary operator `-` to type `u32` - --> $DIR/unsigned-literal-negation.rs:4:18 + --> $DIR/unary-negation-unsigned-integer-error.rs:6:18 | LL | let x: u32 = -1; | ^^ cannot apply unary operator `-` From b2eb2b162f3fceab142101f0e8835c330fcd4731 Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Tue, 1 Jul 2025 23:54:50 +0500 Subject: [PATCH 09/23] unused-move-capture --- tests/ui/closures/no-capture-closure-call.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/ui/closures/no-capture-closure-call.rs b/tests/ui/closures/no-capture-closure-call.rs index 5f42bcbe280e6..29e5ac635b421 100644 --- a/tests/ui/closures/no-capture-closure-call.rs +++ b/tests/ui/closures/no-capture-closure-call.rs @@ -1,3 +1,5 @@ +//! Sanity check for no capture closures + //@ run-pass pub fn main() { From 9203c44377060ad12c315e699a3fdfc395e5de05 Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Tue, 1 Jul 2025 23:56:32 +0500 Subject: [PATCH 10/23] unused-move --- .../box-drop-unused-value-statement-regression.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/ui/drop/box-drop-unused-value-statement-regression.rs b/tests/ui/drop/box-drop-unused-value-statement-regression.rs index 3d5eff2c48d50..43865e0844457 100644 --- a/tests/ui/drop/box-drop-unused-value-statement-regression.rs +++ b/tests/ui/drop/box-drop-unused-value-statement-regression.rs @@ -1,12 +1,12 @@ -//@ run-pass -// Issue #3878 -// Issue Name: Unused move causes a crash -// Abstract: zero-fill to block after drop - +//! Regression test for a crash caused by an "unsused move" +//! (specifically, a variable bound to a `Box` used as a statement) +//! leading to incorrect memory zero-filling after drop. +//! +//! Regression test for . -#![allow(path_statements)] +//@ run-pass pub fn main() { let y: Box<_> = Box::new(1); - y; + drop(y); } From c2a8336806dce6a67dcca09e791c1a871c3784a2 Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Tue, 1 Jul 2025 23:57:28 +0500 Subject: [PATCH 11/23] unwind-no-uwtable --- tests/ui/panics/unwind-force-no-unwind-tables.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/ui/panics/unwind-force-no-unwind-tables.rs b/tests/ui/panics/unwind-force-no-unwind-tables.rs index fb8082e31880a..2226e4dd03ebc 100644 --- a/tests/ui/panics/unwind-force-no-unwind-tables.rs +++ b/tests/ui/panics/unwind-force-no-unwind-tables.rs @@ -1,3 +1,7 @@ +//! This test checks that Rust's unwinding mechanism correctly executes `Drop` +//! implementations during stack unwinding, even when unwind tables (`uwtable`) +//! are explicitly disabled via `-C force-unwind-tables=n`. + //@ run-pass //@ needs-unwind //@ ignore-windows target requires uwtable @@ -26,9 +30,12 @@ fn increase(count: &mut u8) { fn main() { let mut count = 0; - assert!(panic::catch_unwind(AssertUnwindSafe( - #[inline(never)] - || increase(&mut count) - )).is_err()); + assert!( + panic::catch_unwind(AssertUnwindSafe( + #[inline(never)] + || increase(&mut count) + )) + .is_err() + ); assert_eq!(count, 1); } From 79e155c6c275be88acdbf774fcf99142d23a06ea Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Tue, 1 Jul 2025 23:59:01 +0500 Subject: [PATCH 12/23] use-import-export --- tests/ui/modules/module-qualified-paths-basic.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/ui/modules/module-qualified-paths-basic.rs b/tests/ui/modules/module-qualified-paths-basic.rs index d948ffc1520b3..c02f6060caa71 100644 --- a/tests/ui/modules/module-qualified-paths-basic.rs +++ b/tests/ui/modules/module-qualified-paths-basic.rs @@ -1,11 +1,20 @@ +//! Checks that functions from different modules are accessible via their fully-qualified paths. + //@ run-pass mod foo { - pub fn x() -> isize { return 1; } + pub fn x() -> isize { + return 1; + } } mod bar { - pub fn y() -> isize { return 1; } + pub fn y() -> isize { + return 1; + } } -pub fn main() { foo::x(); bar::y(); } +pub fn main() { + foo::x(); + bar::y(); +} From 698c614f494f108599eff405f785c7682c317a5a Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Wed, 2 Jul 2025 00:00:20 +0500 Subject: [PATCH 13/23] use-keyword-2 --- tests/ui/modules/use-keyword-reexport-type-alias.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/ui/modules/use-keyword-reexport-type-alias.rs b/tests/ui/modules/use-keyword-reexport-type-alias.rs index 4f3d1ee500d80..c62bd9687ae62 100644 --- a/tests/ui/modules/use-keyword-reexport-type-alias.rs +++ b/tests/ui/modules/use-keyword-reexport-type-alias.rs @@ -1,18 +1,20 @@ +//! Checks module re-exports, aliasing with `pub use`, +//! and calling private methods via `Self` in an impl block. + //@ run-pass #![allow(unused_variables)] pub struct A; mod test { - pub use super :: A; - - pub use self :: A as B; + pub use self::A as B; + pub use super::A; } impl A { fn f() {} fn g() { - Self :: f() + Self::f() } } From cc1df9f85d6c3249cec8c3dfb6715a2e975724f7 Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Wed, 2 Jul 2025 00:02:54 +0500 Subject: [PATCH 14/23] use-module-level-int-consts --- tests/ui/modules/primitive-type-module-deprecated-paths.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/ui/modules/primitive-type-module-deprecated-paths.rs b/tests/ui/modules/primitive-type-module-deprecated-paths.rs index 6e8c7053c5760..5c9d2a616b3f0 100644 --- a/tests/ui/modules/primitive-type-module-deprecated-paths.rs +++ b/tests/ui/modules/primitive-type-module-deprecated-paths.rs @@ -1,9 +1,10 @@ +//! Make sure the module level constants are still there and accessible even after +//! the corresponding associated constants have been added, and later stabilized. + //@ 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}; +use std::{f32, u16}; fn main() { let _ = u16::MAX; From a3922df0922432d86867c427e16bef1c1a37c0c9 Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Wed, 2 Jul 2025 00:05:06 +0500 Subject: [PATCH 15/23] use-nested-groups --- tests/ui/modules/module-use-nested-groups.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/ui/modules/module-use-nested-groups.rs b/tests/ui/modules/module-use-nested-groups.rs index c5d66a8693533..9ac3246735fc8 100644 --- a/tests/ui/modules/module-use-nested-groups.rs +++ b/tests/ui/modules/module-use-nested-groups.rs @@ -1,3 +1,5 @@ +//! Checks complex `use` syntax and availability of types across nested modules. + //@ run-pass mod a { @@ -15,10 +17,13 @@ mod a { } // 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}}; +use std::sync::Arc; +use std::sync::atomic::{AtomicBool, Ordering}; + +use a::B; +use a::d::g::H; +use a::d::{self, *}; fn main() { let _: B; From bc8af49a3636a4e434a9d8c6d24fbfdf899bb142 Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Wed, 2 Jul 2025 00:08:29 +0500 Subject: [PATCH 16/23] usize-generic-argument-parent --- tests/ui/type/usize-no-generic-arguments.rs | 2 ++ tests/ui/type/usize-no-generic-arguments.stderr | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/ui/type/usize-no-generic-arguments.rs b/tests/ui/type/usize-no-generic-arguments.rs index 4ab80d944a56f..d4d1eea757cab 100644 --- a/tests/ui/type/usize-no-generic-arguments.rs +++ b/tests/ui/type/usize-no-generic-arguments.rs @@ -1,3 +1,5 @@ +//! Sanity test that primitives cannot have const generics. + fn foo() { let x: usize; //~ ERROR const arguments are not allowed on builtin type `usize` } diff --git a/tests/ui/type/usize-no-generic-arguments.stderr b/tests/ui/type/usize-no-generic-arguments.stderr index 9c081a287ed75..f1f3456461fc6 100644 --- a/tests/ui/type/usize-no-generic-arguments.stderr +++ b/tests/ui/type/usize-no-generic-arguments.stderr @@ -1,5 +1,5 @@ error[E0109]: const arguments are not allowed on builtin type `usize` - --> $DIR/usize-generic-argument-parent.rs:2:18 + --> $DIR/usize-no-generic-arguments.rs:4:18 | LL | let x: usize; | ----- ^^^ const argument not allowed From b987f400417845b9aab2aed462420f17201fd508 Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Wed, 2 Jul 2025 00:10:07 +0500 Subject: [PATCH 17/23] virtual-call-attrs-issue-137646 --- tests/ui/traits/virtual-call-parameter-handling.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/ui/traits/virtual-call-parameter-handling.rs b/tests/ui/traits/virtual-call-parameter-handling.rs index e80bd5768a429..71ed459d15aca 100644 --- a/tests/ui/traits/virtual-call-parameter-handling.rs +++ b/tests/ui/traits/virtual-call-parameter-handling.rs @@ -1,5 +1,7 @@ -//! Regression test for https://github.com/rust-lang/rust/issues/137646. -//! The parameter value at all calls to `check` should be `(1, 1, 1)`. +//! This test checks the correct parameter handling during virtual method calls +//! through a `dyn Trait` object. +//! +//! Regression test for: //@ run-pass From b1086cea938046bbacf0aa64e2a28718ec87bed8 Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Wed, 2 Jul 2025 00:13:43 +0500 Subject: [PATCH 18/23] wait-forked-but-failed-child --- tests/ui/process/process-spawn-failure.rs | 47 +++++++++++++++-------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/tests/ui/process/process-spawn-failure.rs b/tests/ui/process/process-spawn-failure.rs index 4a7f2bee9d954..0950b044c97ca 100644 --- a/tests/ui/process/process-spawn-failure.rs +++ b/tests/ui/process/process-spawn-failure.rs @@ -1,3 +1,9 @@ +//! Tests that repeatedly spawning a failing command does not create zombie processes. +//! Spawns a deliberately invalid command multiple times, verifies each spawn fails, +//! then uses `ps` (on Unix) to detect any leftover zombie (defunct) child processes. +//! Checks Rust's process spawning cleans up resources properly. +//! Skipped on platforms without `ps` utility. + //@ run-pass //@ needs-subprocess //@ ignore-vxworks no 'ps' @@ -36,35 +42,42 @@ fn find_zombies() { // the PPID column contains a "-" for the respective process. // Filter out any lines that have a "-" as the PPID as the PPID is // expected to be an integer. - let filtered_ps: Vec<_> = ps_output - .lines() - .filter(|line| line.split_whitespace().nth(1) != Some("-")) - .collect(); + let filtered_ps: Vec<_> = + ps_output.lines().filter(|line| line.split_whitespace().nth(1) != Some("-")).collect(); for (line_no, line) in filtered_ps.into_iter().enumerate() { - if 0 < line_no && 0 < line.len() && - my_pid == line.split(' ').filter(|w| 0 < w.len()).nth(1) - .expect("1st column should be PPID") - .parse().ok() - .expect("PPID string into integer") && - line.contains("defunct") { + if 0 < line_no + && 0 < line.len() + && my_pid + == line + .split(' ') + .filter(|w| 0 < w.len()) + .nth(1) + .expect("1st column should be PPID") + .parse() + .ok() + .expect("PPID string into integer") + && line.contains("defunct") + { panic!("Zombie child {}", line); } } } #[cfg(windows)] -fn find_zombies() { } +fn find_zombies() {} fn main() { let too_long = format!("/NoSuchCommand{:0300}", 0u8); - let _failures = (0..100).map(|_| { - let mut cmd = Command::new(&too_long); - let failed = cmd.spawn(); - assert!(failed.is_err(), "Make sure the command fails to spawn(): {:?}", cmd); - failed - }).collect::>(); + let _failures = (0..100) + .map(|_| { + let mut cmd = Command::new(&too_long); + let failed = cmd.spawn(); + assert!(failed.is_err(), "Make sure the command fails to spawn(): {:?}", cmd); + failed + }) + .collect::>(); find_zombies(); // then _failures goes out of scope From a927d1171aadc20d2f2d3dcb325ae133eb6bef0f Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Wed, 2 Jul 2025 00:15:33 +0500 Subject: [PATCH 19/23] walk-struct-literal-with --- .../ownership-struct-update-moved-error.rs | 16 +++++++++------- .../ownership-struct-update-moved-error.stderr | 12 ++++++------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/tests/ui/borrowck/ownership-struct-update-moved-error.rs b/tests/ui/borrowck/ownership-struct-update-moved-error.rs index ee1a77eb9a48a..62fc1f42969f4 100644 --- a/tests/ui/borrowck/ownership-struct-update-moved-error.rs +++ b/tests/ui/borrowck/ownership-struct-update-moved-error.rs @@ -1,17 +1,19 @@ -struct Mine{ +//! Checks borrow after move error when using `self` consuming method with struct update syntax. + +struct Mine { test: String, - other_val: isize + other_val: isize, } -impl Mine{ - fn make_string_bar(mut self) -> Mine{ +impl Mine { + fn make_string_bar(mut self) -> Mine { self.test = "Bar".to_string(); self } } -fn main(){ - let start = Mine{test:"Foo".to_string(), other_val:0}; - let end = Mine{other_val:1, ..start.make_string_bar()}; +fn main() { + let start = Mine { test: "Foo".to_string(), other_val: 0 }; + let end = Mine { other_val: 1, ..start.make_string_bar() }; println!("{}", start.test); //~ ERROR borrow of moved value: `start` } diff --git a/tests/ui/borrowck/ownership-struct-update-moved-error.stderr b/tests/ui/borrowck/ownership-struct-update-moved-error.stderr index 34b501f8ec881..83cfc7bb412cf 100644 --- a/tests/ui/borrowck/ownership-struct-update-moved-error.stderr +++ b/tests/ui/borrowck/ownership-struct-update-moved-error.stderr @@ -1,17 +1,17 @@ error[E0382]: borrow of moved value: `start` - --> $DIR/walk-struct-literal-with.rs:16:20 + --> $DIR/ownership-struct-update-moved-error.rs:18:20 | -LL | let start = Mine{test:"Foo".to_string(), other_val:0}; +LL | let start = Mine { test: "Foo".to_string(), other_val: 0 }; | ----- move occurs because `start` has type `Mine`, which does not implement the `Copy` trait -LL | let end = Mine{other_val:1, ..start.make_string_bar()}; - | ----------------- `start` moved due to this method call +LL | let end = Mine { other_val: 1, ..start.make_string_bar() }; + | ----------------- `start` moved due to this method call LL | println!("{}", start.test); | ^^^^^^^^^^ value borrowed here after move | note: `Mine::make_string_bar` takes ownership of the receiver `self`, which moves `start` - --> $DIR/walk-struct-literal-with.rs:7:28 + --> $DIR/ownership-struct-update-moved-error.rs:9:28 | -LL | fn make_string_bar(mut self) -> Mine{ +LL | fn make_string_bar(mut self) -> Mine { | ^^^^ = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) From 10951bb440fa657fba7059ca1ab2d15c04c558fb Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Wed, 2 Jul 2025 00:17:45 +0500 Subject: [PATCH 20/23] weak-new-uninhabited-issue-48493 --- tests/ui/allocator/weak-uninhabited-type.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/ui/allocator/weak-uninhabited-type.rs b/tests/ui/allocator/weak-uninhabited-type.rs index ce7d5786b41bb..74258eedc6ac3 100644 --- a/tests/ui/allocator/weak-uninhabited-type.rs +++ b/tests/ui/allocator/weak-uninhabited-type.rs @@ -1,7 +1,13 @@ +//! Checks that `Weak` pointers can be created with an empty enum type parameter. +//! And generic `Weak` handles zero-variant enums without error. +//! +//! Regression test for + //@ run-pass +enum Void {} + fn main() { - enum Void {} let _ = std::rc::Weak::::new(); let _ = std::sync::Weak::::new(); } From d08fb12f40d081d433ccd6d8cea5a513cadb4208 Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Wed, 2 Jul 2025 00:18:17 +0500 Subject: [PATCH 21/23] weird-exit-code --- .../process/windows-exit-code-still-active.rs | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/tests/ui/process/windows-exit-code-still-active.rs b/tests/ui/process/windows-exit-code-still-active.rs index e016343f8ba2f..e661a4f6adc53 100644 --- a/tests/ui/process/windows-exit-code-still-active.rs +++ b/tests/ui/process/windows-exit-code-still-active.rs @@ -1,23 +1,21 @@ +//! On Windows the GetExitCodeProcess API is used to get the exit code of a +//! process, but it's easy to mistake a process exiting with the code 259 as +//! "still running" because this is the value of the STILL_ACTIVE constant. Make +//! sure we handle this case in the standard library and correctly report the +//! status. +//! +//! Note that this is disabled on unix as processes exiting with 259 will have +//! their exit status truncated to 3 (only the lower 8 bits are used). + //@ run-pass -// On Windows the GetExitCodeProcess API is used to get the exit code of a -// process, but it's easy to mistake a process exiting with the code 259 as -// "still running" because this is the value of the STILL_ACTIVE constant. Make -// sure we handle this case in the standard library and correctly report the -// status. -// -// Note that this is disabled on unix as processes exiting with 259 will have -// their exit status truncated to 3 (only the lower 8 bits are used). #[cfg(windows)] fn main() { - use std::process::{self, Command}; use std::env; + use std::process::{self, Command}; if env::args().len() == 1 { - let status = Command::new(env::current_exe().unwrap()) - .arg("foo") - .status() - .unwrap(); + let status = Command::new(env::current_exe().unwrap()).arg("foo").status().unwrap(); assert_eq!(status.code(), Some(259)); } else { process::exit(259); From 14f84f36b1ac7f88a899d2759e94966bfe32edd1 Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Wed, 2 Jul 2025 00:20:30 +0500 Subject: [PATCH 22/23] write-fmt-errors --- tests/ui/io-checks/write-macro-error.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/ui/io-checks/write-macro-error.rs b/tests/ui/io-checks/write-macro-error.rs index b48fa3f11ccb1..857ea0024e16c 100644 --- a/tests/ui/io-checks/write-macro-error.rs +++ b/tests/ui/io-checks/write-macro-error.rs @@ -1,3 +1,6 @@ +//! Tests that errors from both the writer (`Write::write`) and formatter (`Display::fmt`) +//! are correctly propagated: writer errors return `Err`, formatter errors cause panics. + //@ run-pass //@ needs-unwind @@ -24,7 +27,9 @@ impl Write for ErrorWriter { Err(Error::new(WRITER_ERROR, "not connected")) } - fn flush(&mut self) -> io::Result<()> { Ok(()) } + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } } fn main() { @@ -37,7 +42,8 @@ fn main() { let err = res.expect_err("formatter error did not lead to panic").downcast::<&str>().unwrap(); assert!( err.contains("formatting trait implementation returned an error"), - "unexpected panic: {}", err + "unexpected panic: {}", + err ); // Writer error when there's some string before the first `{}` @@ -50,6 +56,7 @@ fn main() { let err = res.expect_err("formatter error did not lead to panic").downcast::<&str>().unwrap(); assert!( err.contains("formatting trait implementation returned an error"), - "unexpected panic: {}", err + "unexpected panic: {}", + err ); } From f6b57e4b5c7e9a924f0a535805510d9f3cc4b279 Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Wed, 2 Jul 2025 00:23:41 +0500 Subject: [PATCH 23/23] wrong-hashset-issue-42918.rs --- tests/ui/hashmap/hashset-enum-variant.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/ui/hashmap/hashset-enum-variant.rs b/tests/ui/hashmap/hashset-enum-variant.rs index 5795cc527cf27..ac715c7c54739 100644 --- a/tests/ui/hashmap/hashset-enum-variant.rs +++ b/tests/ui/hashmap/hashset-enum-variant.rs @@ -1,26 +1,28 @@ +//! Checks that `HashSet` initialization with enum variants correctly includes only +//! specified variants, preventing platform-specific bugs +//! where all enum variants were mistakenly included +//! +//! Regression test for + //@ run-pass -// -#![allow(dead_code)] //@ compile-flags: -O +#![allow(dead_code)] + use std::collections::HashSet; #[derive(PartialEq, Debug, Hash, Eq, Clone, PartialOrd, Ord)] enum MyEnum { E0, - E1, - E2, E3, E4, - E5, E6, E7, } - fn main() { use MyEnum::*; let s: HashSet<_> = [E4, E1].iter().cloned().collect();