From 93f8ad99507ecb851ace4b1d4e3e7c5cd67ed80c Mon Sep 17 00:00:00 2001 From: reddevilmidzy Date: Fri, 26 Dec 2025 00:13:11 +0900 Subject: [PATCH] cleaned up some tests cleaned up cast-enum-const.rs cleaned up ufcs-trait-object-format.rs add comment to cast-to-box-arr.rs add comment to shadow-primitives.rs add comment to associated-type-const-nomalization.rs add comment to fn-trait-explicit-call.rs add comment to call-unit-struct-impl-fn-once.rs add comment to cast-to-char-compare.rs add comment to self-in-method-body-resolves.rs add comment to derive-debug-newtype-unsized-slice.rs add comment to tuple-ref-order-distinct-impls.rs add comment to derive-debug-generic-with-lifetime.rs add comment to recursive-trait-bound-on-type-param.rs cleaned up const-static-ref-to-closure.rs add comment to const-iter-no-conflict-for-loop.rs --- .../associated-type-const-nomalization.rs | 1 + tests/ui/cast/cast-enum-const.rs | 12 +++---- tests/ui/cast/cast-to-box-arr.rs | 1 + tests/ui/cast/cast-to-char-compare.rs | 2 +- .../ui/consts/const-static-ref-to-closure.rs | 4 +-- .../derive-debug-generic-with-lifetime.rs | 1 + .../derive-debug-newtype-unsized-slice.rs | 1 + .../call-unit-struct-impl-fn-once.rs | 1 + tests/ui/fn_traits/fn-trait-explicit-call.rs | 1 + .../const-iter-no-conflict-for-loop.rs | 4 +++ tests/ui/resolve/shadow-primitives.rs | 33 ++++++++++--------- tests/ui/self/self-in-method-body-resolves.rs | 9 +++-- .../recursive-trait-bound-on-type-param.rs | 8 ++++- .../typeck/tuple-ref-order-distinct-impls.rs | 5 ++- tests/ui/ufcs/ufcs-trait-object-format.rs | 9 ++--- 15 files changed, 59 insertions(+), 33 deletions(-) diff --git a/tests/ui/associated-types/associated-type-const-nomalization.rs b/tests/ui/associated-types/associated-type-const-nomalization.rs index 576c7545924b..b7951ba9a435 100644 --- a/tests/ui/associated-types/associated-type-const-nomalization.rs +++ b/tests/ui/associated-types/associated-type-const-nomalization.rs @@ -1,3 +1,4 @@ +//! regression test for //@ check-pass trait Mirror { diff --git a/tests/ui/cast/cast-enum-const.rs b/tests/ui/cast/cast-enum-const.rs index 9cb02460f35b..cfad40c07b0e 100644 --- a/tests/ui/cast/cast-enum-const.rs +++ b/tests/ui/cast/cast-enum-const.rs @@ -1,14 +1,12 @@ +//! regression test for //@ run-pass -#![allow(non_upper_case_globals)] - -pub fn main() { - let _foo = 100; - const quux: isize = 5; +fn main() { + const QUUX: isize = 5; enum Stuff { - Bar = quux + Bar = QUUX, } - assert_eq!(Stuff::Bar as isize, quux); + assert_eq!(Stuff::Bar as isize, QUUX); } diff --git a/tests/ui/cast/cast-to-box-arr.rs b/tests/ui/cast/cast-to-box-arr.rs index 89c956913f93..1a9004cd074e 100644 --- a/tests/ui/cast/cast-to-box-arr.rs +++ b/tests/ui/cast/cast-to-box-arr.rs @@ -1,3 +1,4 @@ +//! regression test for //@ run-pass fn main() { let x = Box::new([1, 2, 3]); diff --git a/tests/ui/cast/cast-to-char-compare.rs b/tests/ui/cast/cast-to-char-compare.rs index 303bf7a57513..159b8ee04e02 100644 --- a/tests/ui/cast/cast-to-char-compare.rs +++ b/tests/ui/cast/cast-to-char-compare.rs @@ -1,6 +1,6 @@ +//! regression test for //@ check-pass - fn main() { if ('x' as char) < ('y' as char) { print!("x"); diff --git a/tests/ui/consts/const-static-ref-to-closure.rs b/tests/ui/consts/const-static-ref-to-closure.rs index 339aca037546..06b5ca5a935c 100644 --- a/tests/ui/consts/const-static-ref-to-closure.rs +++ b/tests/ui/consts/const-static-ref-to-closure.rs @@ -1,7 +1,7 @@ +//! regression test for //@ check-pass #![allow(dead_code)] -#![allow(non_upper_case_globals)] -const x: &'static dyn Fn() = &|| println!("ICE here"); +const X: &'static dyn Fn() = &|| println!("ICE here"); fn main() {} diff --git a/tests/ui/derives/derive-debug-generic-with-lifetime.rs b/tests/ui/derives/derive-debug-generic-with-lifetime.rs index c92853fb5dc2..430ade071795 100644 --- a/tests/ui/derives/derive-debug-generic-with-lifetime.rs +++ b/tests/ui/derives/derive-debug-generic-with-lifetime.rs @@ -1,3 +1,4 @@ +//! regression test for //@ check-pass #![allow(dead_code)] #[derive(Debug)] diff --git a/tests/ui/derives/derive-debug-newtype-unsized-slice.rs b/tests/ui/derives/derive-debug-newtype-unsized-slice.rs index 689c9f33af02..c735d9f039d2 100644 --- a/tests/ui/derives/derive-debug-newtype-unsized-slice.rs +++ b/tests/ui/derives/derive-debug-newtype-unsized-slice.rs @@ -1,3 +1,4 @@ +//! regression test for //@ check-pass #![allow(dead_code)] #[derive(Debug)] diff --git a/tests/ui/fn_traits/call-unit-struct-impl-fn-once.rs b/tests/ui/fn_traits/call-unit-struct-impl-fn-once.rs index a5693b3aca8e..15554482931b 100644 --- a/tests/ui/fn_traits/call-unit-struct-impl-fn-once.rs +++ b/tests/ui/fn_traits/call-unit-struct-impl-fn-once.rs @@ -1,3 +1,4 @@ +//! regression test for //@ run-pass #![feature(unboxed_closures)] #![feature(fn_traits)] diff --git a/tests/ui/fn_traits/fn-trait-explicit-call.rs b/tests/ui/fn_traits/fn-trait-explicit-call.rs index 364b07bf6922..f37e0a558baa 100644 --- a/tests/ui/fn_traits/fn-trait-explicit-call.rs +++ b/tests/ui/fn_traits/fn-trait-explicit-call.rs @@ -1,3 +1,4 @@ +//! regression test for //@ run-pass #![feature(fn_traits)] diff --git a/tests/ui/resolve/const-iter-no-conflict-for-loop.rs b/tests/ui/resolve/const-iter-no-conflict-for-loop.rs index 95edcb8695e2..ddbba64e5a31 100644 --- a/tests/ui/resolve/const-iter-no-conflict-for-loop.rs +++ b/tests/ui/resolve/const-iter-no-conflict-for-loop.rs @@ -1,3 +1,7 @@ +//! regression test for +//! Ensure that a constant named `iter` does not +//! interfere with the name resolution of the `iter` methods used internally +//! by `for` loops //@ run-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] diff --git a/tests/ui/resolve/shadow-primitives.rs b/tests/ui/resolve/shadow-primitives.rs index 4018043c371e..17da0cd0530c 100644 --- a/tests/ui/resolve/shadow-primitives.rs +++ b/tests/ui/resolve/shadow-primitives.rs @@ -1,3 +1,4 @@ +//! regression test for //@ run-pass #![allow(dead_code)] #![allow(unused_variables)] @@ -31,17 +32,10 @@ mod char { mod char_ {} mod str { - use super::i8 as i8; - use super::i32_ as i32; - use super::i64_ as i64; - use super::u8_ as u8; - use super::f_ as f64; - use super::u16_ as u16; - use super::u32_ as u32; - use super::u64_ as u64; - use super::bool_ as bool; - use super::{bool_ as str}; - use super::char_ as char; + use super::{ + bool_ as bool, bool_ as str, char_ as char, f_ as f64, i8, i32_ as i32, i64_ as i64, + u8_ as u8, u16_ as u16, u32_ as u32, u64_ as u64, + }; } } @@ -49,7 +43,9 @@ trait isize_ { type isize; } -fn usize<'usize>(usize: &'usize usize) -> &'usize usize { usize } +fn usize<'usize>(usize: &'usize usize) -> &'usize usize { + usize +} mod reuse { use std::mem::size_of; @@ -68,9 +64,10 @@ mod reuse { mod guard { pub fn check() { use std::u8; // bring module u8 in scope - fn f() -> u8 { // OK, resolves to primitive u8, not to std::u8 + fn f() -> u8 { + // OK, resolves to primitive u8, not to std::u8 u8::max_value() // OK, resolves to associated function ::max_value, - // not to non-existent std::u8::max_value + // not to non-existent std::u8::max_value } assert_eq!(f(), u8::MAX); // OK, resolves to std::u8::MAX } @@ -79,7 +76,13 @@ mod guard { fn main() { let bool = true; let _ = match bool { - str @ true => if str { i32 as i64 } else { i64 }, + str @ true => { + if str { + i32 as i64 + } else { + i64 + } + } false => i64, }; diff --git a/tests/ui/self/self-in-method-body-resolves.rs b/tests/ui/self/self-in-method-body-resolves.rs index 95bb2af9b25c..636922cd87ce 100644 --- a/tests/ui/self/self-in-method-body-resolves.rs +++ b/tests/ui/self/self-in-method-body-resolves.rs @@ -1,11 +1,16 @@ +//! regression test for //@ check-pass #![allow(dead_code)] struct Foo; impl Foo { - fn new() -> Self { Foo } - fn bar() { Self::new(); } + fn new() -> Self { + Foo + } + fn bar() { + Self::new(); + } } fn main() {} diff --git a/tests/ui/traits/bound/recursive-trait-bound-on-type-param.rs b/tests/ui/traits/bound/recursive-trait-bound-on-type-param.rs index e97819e4122d..41ae91afad49 100644 --- a/tests/ui/traits/bound/recursive-trait-bound-on-type-param.rs +++ b/tests/ui/traits/bound/recursive-trait-bound-on-type-param.rs @@ -1,6 +1,12 @@ +//! regression test for //@ check-pass trait A {} -struct B where B: A> { t: T } +struct B +where + B: A>, +{ + t: T, +} fn main() {} diff --git a/tests/ui/typeck/tuple-ref-order-distinct-impls.rs b/tests/ui/typeck/tuple-ref-order-distinct-impls.rs index ad0affa4b0d2..fdede8a1d9c4 100644 --- a/tests/ui/typeck/tuple-ref-order-distinct-impls.rs +++ b/tests/ui/typeck/tuple-ref-order-distinct-impls.rs @@ -1,6 +1,9 @@ +//! regression test for //@ check-pass -trait Common { fn dummy(&self) { } } +trait Common { + fn dummy(&self) {} +} impl<'t, T> Common for (T, &'t T) {} diff --git a/tests/ui/ufcs/ufcs-trait-object-format.rs b/tests/ui/ufcs/ufcs-trait-object-format.rs index 2059365c7d62..7d50a2444806 100644 --- a/tests/ui/ufcs/ufcs-trait-object-format.rs +++ b/tests/ui/ufcs/ufcs-trait-object-format.rs @@ -1,8 +1,9 @@ //@ run-pass -// Regression test for #20676. Error was that we didn't support -// UFCS-style calls to a method in `Trait` where `Self` was bound to a -// trait object of type `Trait`. See also `ufcs-trait-object.rs`. - +//! Regression test for . +//! Error was that we didn't support +//! UFCS-style calls to a method in `Trait` where `Self` was bound to a +//! trait object of type `Trait`. +//! See also . use std::fmt;