Skip to content

Commit 0952f86

Browse files
authored
Rollup merge of #143118 - Kivooeo:tf15, r=tgross35
`tests/ui`: A New Order [15/N] > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of #133895. r? `@jieyouxu`
2 parents a94f0a4 + 580bc12 commit 0952f86

9 files changed

+56
-40
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//! Regression test checks UI tests without error annotations are detected as failing.
2+
//!
3+
//! This tests that when we forget to use any `//~ ERROR` comments whatsoever,
4+
//! the test doesn't succeed
5+
//! Originally created in https://github.com/rust-lang/rust/pull/56244
6+
7+
//@ should-fail
8+
9+
fn main() {}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//! Test that `#[derive(Debug)]` for enums correctly formats variant names.
2+
3+
//@ run-pass
4+
5+
#[derive(Debug)]
6+
enum Foo {
7+
A(usize),
8+
C,
9+
}
10+
11+
#[derive(Debug)]
12+
enum Bar {
13+
D,
14+
}
15+
16+
pub fn main() {
17+
// Test variant with data
18+
let foo_a = Foo::A(22);
19+
assert_eq!("A(22)".to_string(), format!("{:?}", foo_a));
20+
21+
if let Foo::A(value) = foo_a {
22+
println!("Value: {}", value); // This needs to remove #[allow(dead_code)]
23+
}
24+
25+
// Test unit variant
26+
assert_eq!("C".to_string(), format!("{:?}", Foo::C));
27+
28+
// Test unit variant from different enum
29+
assert_eq!("D".to_string(), format!("{:?}", Bar::D));
30+
}

‎tests/ui/logging-only-prints-once.rs renamed to ‎tests/ui/fmt/debug-single-call.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
//! Test that Debug::fmt is called exactly once during formatting.
2+
//!
3+
//! This is a regression test for PR https://github.com/rust-lang/rust/pull/10715
4+
15
//@ run-pass
26
//@ needs-threads
37

48
use std::cell::Cell;
5-
use std::fmt;
6-
use std::thread;
9+
use std::{fmt, thread};
710

811
struct Foo(Cell<isize>);
912

‎tests/ui/link-section.rs renamed to ‎tests/ui/linkage-attr/link-section-placement.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
//! Test placement of functions and statics in custom link sections
2+
13
//@ run-pass
24

35
// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
46
#![allow(static_mut_refs)]
5-
67
#![allow(non_upper_case_globals)]
78
#[cfg(not(target_vendor = "apple"))]
89
#[link_section = ".moretext"]

‎tests/ui/log-err-phi.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

‎tests/ui/log-knows-the-names-of-variants.rs

Lines changed: 0 additions & 21 deletions
This file was deleted.

‎tests/ui/loud_ui.rs

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎tests/ui/max-min-classes.rs renamed to ‎tests/ui/resolve/struct-function-same-name.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Test that a struct and function can have the same name
2+
//!
13
//@ run-pass
24

35
#![allow(non_snake_case)]
@@ -23,7 +25,7 @@ impl Product for Foo {
2325
}
2426

2527
fn Foo(x: isize, y: isize) -> Foo {
26-
Foo { x: x, y: y }
28+
Foo { x, y }
2729
}
2830

2931
pub fn main() {

‎tests/ui/lexical-scoping.rs renamed to ‎tests/ui/resolve/type-param-local-var-shadowing.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
//! Test that items in subscopes correctly shadow type parameters and local variables
2+
//!
3+
//! Regression test for https://github.com/rust-lang/rust/issues/23880
4+
15
//@ run-pass
2-
// Tests that items in subscopes can shadow type parameters and local variables (see issue #23880).
36

47
#![allow(unused)]
5-
struct Foo<X> { x: Box<X> }
8+
struct Foo<X> {
9+
x: Box<X>,
10+
}
611
impl<Bar> Foo<Bar> {
712
fn foo(&self) {
813
type Bar = i32;

0 commit comments

Comments
 (0)