Skip to content

Commit d11d239

Browse files
authored
Unrolled build for #155615
Rollup merge of #155615 - cyrgani:clean-deriving, r=Kivooeo test cleanups for `ui/derives` and `ui/deriving` The eventual goal is for `ui/deriving` to be merged into `ui/derives` entirely. This PR focuses on the `issue-*.rs` tests in `deriving` and a few other no-longer-useful tests. r? @Kivooeo
2 parents 1bfcb28 + d54b62f commit d11d239

23 files changed

Lines changed: 104 additions & 156 deletions

src/tools/tidy/src/issues.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -844,15 +844,6 @@ ui/derives/issue-43023.rs
844844
ui/derives/issue-91492.rs
845845
ui/derives/issue-91550.rs
846846
ui/derives/issue-97343.rs
847-
ui/deriving/issue-103157.rs
848-
ui/deriving/issue-15689-1.rs
849-
ui/deriving/issue-15689-2.rs
850-
ui/deriving/issue-18738.rs
851-
ui/deriving/issue-19358.rs
852-
ui/deriving/issue-3935.rs
853-
ui/deriving/issue-58319.rs
854-
ui/deriving/issue-6341.rs
855-
ui/deriving/issue-89188-gat-hrtb.rs
856847
ui/did_you_mean/issue-103909.rs
857848
ui/did_you_mean/issue-105225-named-args.rs
858849
ui/did_you_mean/issue-105225.rs

tests/ui/deriving/issue-89188-gat-hrtb.rs renamed to tests/ui/derives/clone-include-gat-hrtb.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Regression test for https://github.com/rust-lang/rust/issues/89188.
12
//@ check-pass
23

34
trait CallWithShim: Sized {
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
//! Make sure that `derive(Clone)` works for simple structs and enums.
2+
//@ run-pass
3+
#![allow(dead_code)]
4+
5+
#[derive(Clone)]
6+
enum SimpleEnum {
7+
A,
8+
B(()),
9+
C,
10+
}
11+
12+
#[derive(Clone)]
13+
enum GenericEnum<T, U> {
14+
A(T),
15+
B(T, U),
16+
C,
17+
}
18+
19+
#[derive(Clone)]
20+
struct TupleStruct((), ());
21+
22+
#[derive(Clone)]
23+
struct GenericStruct<T> {
24+
foo: (),
25+
bar: (),
26+
baz: T,
27+
}
28+
29+
#[derive(Clone)]
30+
struct GenericTupleStruct<T>(T, ());
31+
32+
#[derive(Clone)]
33+
struct ManyPrimitives {
34+
_int: isize,
35+
_i8: i8,
36+
_i16: i16,
37+
_i32: i32,
38+
_i64: i64,
39+
40+
_uint: usize,
41+
_u8: u8,
42+
_u16: u16,
43+
_u32: u32,
44+
_u64: u64,
45+
46+
_f32: f32,
47+
_f64: f64,
48+
49+
_bool: bool,
50+
_char: char,
51+
_nil: (),
52+
}
53+
54+
// Regression test for issue #30244
55+
#[derive(Copy, Clone)]
56+
struct Array {
57+
arr: [[u8; 256]; 4],
58+
}
59+
60+
pub fn main() {
61+
let _ = SimpleEnum::A.clone();
62+
let _ = GenericEnum::A::<isize, isize>(1).clone();
63+
let _ = GenericStruct { foo: (), bar: (), baz: 1 }.clone();
64+
let _ = GenericTupleStruct(1, ()).clone();
65+
}

tests/ui/deriving/issue-103157.rs renamed to tests/ui/derives/derive-eq-check-all-variants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ check-fail
1+
//! Regression test for https://github.com/rust-lang/rust/issues/103157.
22
33
#[derive(PartialEq, Eq)]
44
pub enum Value {

tests/ui/deriving/issue-103157.stderr renamed to tests/ui/derives/derive-eq-check-all-variants.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0277]: the trait bound `f64: Eq` is not satisfied
2-
--> $DIR/issue-103157.rs:6:11
2+
--> $DIR/derive-eq-check-all-variants.rs:6:11
33
|
44
LL | #[derive(PartialEq, Eq)]
55
| -- in this derive macro expansion
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
//! Regression test for https://github.com/rust-lang/rust/issues/6341.
12
//@ check-pass
23

34
#[derive(PartialEq)]
4-
struct A { x: usize }
5+
struct A {
6+
x: usize,
7+
}
58

69
impl Drop for A {
710
fn drop(&mut self) {}

tests/ui/deriving/issue-18738.rs renamed to tests/ui/derives/derive-static-str-field.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Regression test for https://github.com/rust-lang/rust/issues/18738.
12
//@ check-pass
23
#![allow(dead_code)]
34
#[derive(Eq, PartialEq, PartialOrd, Ord)]
@@ -8,7 +9,7 @@ enum Test<'a> {
89

910
#[derive(Eq, PartialEq, PartialOrd, Ord)]
1011
struct Version {
11-
vendor_info: &'static str
12+
vendor_info: &'static str,
1213
}
1314

1415
#[derive(Eq, PartialEq, PartialOrd, Ord)]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//! Regression test for https://github.com/rust-lang/rust/issues/15689.
2+
//@ run-pass
3+
4+
#[derive(PartialEq, Debug, Clone)]
5+
enum Test<'a> {
6+
Slice(&'a isize),
7+
}
8+
9+
fn main() {
10+
assert_eq!(Test::Slice(&1), Test::Slice(&1))
11+
}

tests/ui/deriving/issue-19358.rs renamed to tests/ui/derives/derive-with-where-bounds.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
//@ run-pass
1+
//! Regression test for https://github.com/rust-lang/rust/issues/19358.
2+
//@ check-pass
23

34
#![allow(dead_code)]
45

5-
trait Trait { fn dummy(&self) { } }
6+
trait Trait {
7+
fn dummy(&self) {}
8+
}
69

710
#[derive(Debug)]
811
struct Foo<T: Trait> {
912
foo: T,
1013
}
1114

1215
#[derive(Debug)]
13-
struct Bar<T> where T: Trait {
16+
struct Bar<T>
17+
where
18+
T: Trait,
19+
{
1420
bar: T,
1521
}
1622

0 commit comments

Comments
 (0)