Rollup merge of #138639 - spencer3035:clean-ui-tests-2-of-n, r=jieyouxu

Clean UI tests 2 of n

Modified 4 tests in tests/ui. Cleaned 3 and deleted one.

I have a final commit changing the values in `src/tools/tidy/src/ui_tests.rs`.
I wasn't sure if it was best practice to change this value as you go along or
once at the end. I can rebase to something that incrementally changes the value
in the "cleaned" commits if that is preferred.

Related Issues:
#73494
#133895

r? jieyouxu
This commit is contained in:
Matthias Krüger 2025-03-22 12:00:48 +01:00 committed by GitHub
commit f01d0960e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 65 additions and 78 deletions

View file

@ -2000,7 +2000,6 @@ ui/issues/issue-28586.rs
ui/issues/issue-28600.rs
ui/issues/issue-28625.rs
ui/issues/issue-28776.rs
ui/issues/issue-28777.rs
ui/issues/issue-28828.rs
ui/issues/issue-28839.rs
ui/issues/issue-28936.rs
@ -2063,7 +2062,6 @@ ui/issues/issue-3091.rs
ui/issues/issue-31011.rs
ui/issues/issue-3109.rs
ui/issues/issue-3121.rs
ui/issues/issue-31260.rs
ui/issues/issue-31267-additional.rs
ui/issues/issue-31267.rs
ui/issues/issue-31299.rs
@ -2608,7 +2606,6 @@ ui/issues/issue-9243.rs
ui/issues/issue-9249.rs
ui/issues/issue-9259.rs
ui/issues/issue-92741.rs
ui/issues/issue-9382.rs
ui/issues/issue-9446.rs
ui/issues/issue-9719.rs
ui/issues/issue-9725.rs

View file

@ -17,7 +17,7 @@ use ignore::Walk;
const ENTRY_LIMIT: u32 = 901;
// FIXME: The following limits should be reduced eventually.
const ISSUES_ENTRY_LIMIT: u32 = 1634;
const ISSUES_ENTRY_LIMIT: u32 = 1631;
const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
"rs", // test source files

View file

@ -0,0 +1,20 @@
//! Regression test that ensures struct field literals can be coerced into slice and `Box` types
//@ check-pass
struct Thing1<'a> {
baz: &'a [Box<isize>],
bar: Box<u64>,
}
struct Thing2<'a> {
baz: &'a [Box<isize>],
bar: u64,
}
pub fn main() {
let _a = Thing1 { baz: &[], bar: Box::new(32) };
let _b = Thing1 { baz: &Vec::new(), bar: Box::new(32) };
let _c = Thing2 { baz: &[], bar: 32 };
let _d = Thing2 { baz: &Vec::new(), bar: 32 };
}

View file

@ -0,0 +1,16 @@
//! Regression test to check that literal expressions in a struct field can be coerced to the
//! expected field type, including block expressions.
//!
//! Issue: <https://github.com/rust-lang/rust/issues/31260>
//@ check-pass
pub struct Struct<K: 'static> {
pub field: K,
}
static STRUCT: Struct<&'static [u8]> = Struct { field: { &[1] } };
static STRUCT2: Struct<&'static [u8]> = Struct { field: &[1] };
fn main() {}

View file

@ -1,22 +0,0 @@
//@ run-pass
#![allow(unused_braces)]
fn main() {
let v1 = { 1 + {2} * {3} };
let v2 = 1 + {2} * {3} ;
assert_eq!(7, v1);
assert_eq!(7, v2);
let v3;
v3 = { 1 + {2} * {3} };
let v4;
v4 = 1 + {2} * {3};
assert_eq!(7, v3);
assert_eq!(7, v4);
let v5 = { 1 + {2} * 3 };
assert_eq!(7, v5);
let v9 = { 1 + if 1 > 2 {1} else {2} * {3} };
assert_eq!(7, v9);
}

View file

@ -1,15 +0,0 @@
//@ check-pass
#![allow(dead_code)]
pub struct Struct<K: 'static> {
pub field: K,
}
static STRUCT: Struct<&'static [u8]> = Struct {
field: {&[1]}
};
static STRUCT2: Struct<&'static [u8]> = Struct {
field: &[1]
};
fn main() {}

View file

@ -1,37 +0,0 @@
//@ run-pass
#![allow(dead_code)]
// Tests for a previous bug that occurred due to an interaction
// between struct field initialization and the auto-coercion
// from a vector to a slice. The drop glue was being invoked on
// the temporary slice with a wrong type, triggering an LLVM assert.
struct Thing1<'a> {
baz: &'a [Box<isize>],
bar: Box<u64>,
}
struct Thing2<'a> {
baz: &'a [Box<isize>],
bar: u64,
}
pub fn main() {
let _t1_fixed = Thing1 {
baz: &[],
bar: Box::new(32),
};
Thing1 {
baz: &Vec::new(),
bar: Box::new(32),
};
let _t2_fixed = Thing2 {
baz: &[],
bar: 32,
};
Thing2 {
baz: &Vec::new(),
bar: 32,
};
}

View file

@ -0,0 +1,28 @@
//! Regression test for ensuring that operator precedence is correctly handled in the presence of
//! braces
//!
//! Issue: <https://github.com/rust-lang/rust/issues/28777>
//@ run-pass
#[allow(unused_braces)]
fn main() {
let v1 = { 1 + { 2 } * { 3 } };
let v2 = 1 + { 2 } * { 3 };
assert_eq!(7, v1);
assert_eq!(7, v2);
let v3;
v3 = { 1 + { 2 } * { 3 } };
let v4;
v4 = 1 + { 2 } * { 3 };
assert_eq!(7, v3);
assert_eq!(7, v4);
let v5 = { 1 + { 2 } * 3 };
assert_eq!(7, v5);
let v9 = { 1 + if 1 > 2 { 1 } else { 2 } * { 3 } };
assert_eq!(7, v9);
}