mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
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
This commit is contained in:
@@ -844,15 +844,6 @@ ui/derives/issue-43023.rs
|
||||
ui/derives/issue-91492.rs
|
||||
ui/derives/issue-91550.rs
|
||||
ui/derives/issue-97343.rs
|
||||
ui/deriving/issue-103157.rs
|
||||
ui/deriving/issue-15689-1.rs
|
||||
ui/deriving/issue-15689-2.rs
|
||||
ui/deriving/issue-18738.rs
|
||||
ui/deriving/issue-19358.rs
|
||||
ui/deriving/issue-3935.rs
|
||||
ui/deriving/issue-58319.rs
|
||||
ui/deriving/issue-6341.rs
|
||||
ui/deriving/issue-89188-gat-hrtb.rs
|
||||
ui/did_you_mean/issue-103909.rs
|
||||
ui/did_you_mean/issue-105225-named-args.rs
|
||||
ui/did_you_mean/issue-105225.rs
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//! Regression test for https://github.com/rust-lang/rust/issues/89188.
|
||||
//@ check-pass
|
||||
|
||||
trait CallWithShim: Sized {
|
||||
@@ -0,0 +1,65 @@
|
||||
//! Make sure that `derive(Clone)` works for simple structs and enums.
|
||||
//@ run-pass
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[derive(Clone)]
|
||||
enum SimpleEnum {
|
||||
A,
|
||||
B(()),
|
||||
C,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
enum GenericEnum<T, U> {
|
||||
A(T),
|
||||
B(T, U),
|
||||
C,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct TupleStruct((), ());
|
||||
|
||||
#[derive(Clone)]
|
||||
struct GenericStruct<T> {
|
||||
foo: (),
|
||||
bar: (),
|
||||
baz: T,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct GenericTupleStruct<T>(T, ());
|
||||
|
||||
#[derive(Clone)]
|
||||
struct ManyPrimitives {
|
||||
_int: isize,
|
||||
_i8: i8,
|
||||
_i16: i16,
|
||||
_i32: i32,
|
||||
_i64: i64,
|
||||
|
||||
_uint: usize,
|
||||
_u8: u8,
|
||||
_u16: u16,
|
||||
_u32: u32,
|
||||
_u64: u64,
|
||||
|
||||
_f32: f32,
|
||||
_f64: f64,
|
||||
|
||||
_bool: bool,
|
||||
_char: char,
|
||||
_nil: (),
|
||||
}
|
||||
|
||||
// Regression test for issue #30244
|
||||
#[derive(Copy, Clone)]
|
||||
struct Array {
|
||||
arr: [[u8; 256]; 4],
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let _ = SimpleEnum::A.clone();
|
||||
let _ = GenericEnum::A::<isize, isize>(1).clone();
|
||||
let _ = GenericStruct { foo: (), bar: (), baz: 1 }.clone();
|
||||
let _ = GenericTupleStruct(1, ()).clone();
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
//@ check-fail
|
||||
//! Regression test for https://github.com/rust-lang/rust/issues/103157.
|
||||
|
||||
#[derive(PartialEq, Eq)]
|
||||
pub enum Value {
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
error[E0277]: the trait bound `f64: Eq` is not satisfied
|
||||
--> $DIR/issue-103157.rs:6:11
|
||||
--> $DIR/derive-eq-check-all-variants.rs:6:11
|
||||
|
|
||||
LL | #[derive(PartialEq, Eq)]
|
||||
| -- in this derive macro expansion
|
||||
@@ -1,7 +1,10 @@
|
||||
//! Regression test for https://github.com/rust-lang/rust/issues/6341.
|
||||
//@ check-pass
|
||||
|
||||
#[derive(PartialEq)]
|
||||
struct A { x: usize }
|
||||
struct A {
|
||||
x: usize,
|
||||
}
|
||||
|
||||
impl Drop for A {
|
||||
fn drop(&mut self) {}
|
||||
@@ -1,3 +1,4 @@
|
||||
//! Regression test for https://github.com/rust-lang/rust/issues/18738.
|
||||
//@ check-pass
|
||||
#![allow(dead_code)]
|
||||
#[derive(Eq, PartialEq, PartialOrd, Ord)]
|
||||
@@ -8,7 +9,7 @@ enum Test<'a> {
|
||||
|
||||
#[derive(Eq, PartialEq, PartialOrd, Ord)]
|
||||
struct Version {
|
||||
vendor_info: &'static str
|
||||
vendor_info: &'static str,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, PartialOrd, Ord)]
|
||||
@@ -0,0 +1,11 @@
|
||||
//! Regression test for https://github.com/rust-lang/rust/issues/15689.
|
||||
//@ run-pass
|
||||
|
||||
#[derive(PartialEq, Debug, Clone)]
|
||||
enum Test<'a> {
|
||||
Slice(&'a isize),
|
||||
}
|
||||
|
||||
fn main() {
|
||||
assert_eq!(Test::Slice(&1), Test::Slice(&1))
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
//@ run-pass
|
||||
//! Regression test for https://github.com/rust-lang/rust/issues/19358.
|
||||
//@ check-pass
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
trait Trait { fn dummy(&self) { } }
|
||||
trait Trait {
|
||||
fn dummy(&self) {}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Foo<T: Trait> {
|
||||
@@ -10,7 +13,10 @@ struct Foo<T: Trait> {
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Bar<T> where T: Trait {
|
||||
struct Bar<T>
|
||||
where
|
||||
T: Trait,
|
||||
{
|
||||
bar: T,
|
||||
}
|
||||
|
||||
+8
-8
@@ -1,48 +1,48 @@
|
||||
error: cannot find derive macro `Sync` in this scope
|
||||
--> $DIR/deriving-bounds.rs:6:10
|
||||
--> $DIR/no-send-sync-derives.rs:6:10
|
||||
|
|
||||
LL | #[derive(Sync)]
|
||||
| ^^^^
|
||||
|
|
||||
note: unsafe traits like `Sync` should be implemented explicitly
|
||||
--> $DIR/deriving-bounds.rs:6:10
|
||||
--> $DIR/no-send-sync-derives.rs:6:10
|
||||
|
|
||||
LL | #[derive(Sync)]
|
||||
| ^^^^
|
||||
|
||||
error: cannot find derive macro `Sync` in this scope
|
||||
--> $DIR/deriving-bounds.rs:6:10
|
||||
--> $DIR/no-send-sync-derives.rs:6:10
|
||||
|
|
||||
LL | #[derive(Sync)]
|
||||
| ^^^^
|
||||
|
|
||||
note: unsafe traits like `Sync` should be implemented explicitly
|
||||
--> $DIR/deriving-bounds.rs:6:10
|
||||
--> $DIR/no-send-sync-derives.rs:6:10
|
||||
|
|
||||
LL | #[derive(Sync)]
|
||||
| ^^^^
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: cannot find derive macro `Send` in this scope
|
||||
--> $DIR/deriving-bounds.rs:1:10
|
||||
--> $DIR/no-send-sync-derives.rs:1:10
|
||||
|
|
||||
LL | #[derive(Send)]
|
||||
| ^^^^
|
||||
|
|
||||
note: unsafe traits like `Send` should be implemented explicitly
|
||||
--> $DIR/deriving-bounds.rs:1:10
|
||||
--> $DIR/no-send-sync-derives.rs:1:10
|
||||
|
|
||||
LL | #[derive(Send)]
|
||||
| ^^^^
|
||||
|
||||
error: cannot find derive macro `Send` in this scope
|
||||
--> $DIR/deriving-bounds.rs:1:10
|
||||
--> $DIR/no-send-sync-derives.rs:1:10
|
||||
|
|
||||
LL | #[derive(Send)]
|
||||
| ^^^^
|
||||
|
|
||||
note: unsafe traits like `Send` should be implemented explicitly
|
||||
--> $DIR/deriving-bounds.rs:1:10
|
||||
--> $DIR/no-send-sync-derives.rs:1:10
|
||||
|
|
||||
LL | #[derive(Send)]
|
||||
| ^^^^
|
||||
@@ -1,4 +1,5 @@
|
||||
//@ run-pass
|
||||
//! Regression test for https://github.com/rust-lang/rust/issues/58319.
|
||||
//@ build-pass
|
||||
fn main() {}
|
||||
#[derive(Clone)]
|
||||
pub struct Little;
|
||||
@@ -1,5 +0,0 @@
|
||||
//@ check-pass
|
||||
#[derive(Copy, Clone)]
|
||||
struct Test;
|
||||
|
||||
pub fn main() {}
|
||||
@@ -1,10 +0,0 @@
|
||||
//@ run-pass
|
||||
#![allow(dead_code)]
|
||||
// test for issue #30244
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
struct Array {
|
||||
arr: [[u8; 256]; 4]
|
||||
}
|
||||
|
||||
pub fn main() {}
|
||||
@@ -1,13 +0,0 @@
|
||||
//@ run-pass
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[derive(Clone)]
|
||||
enum E {
|
||||
A,
|
||||
B(()),
|
||||
C
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let _ = E::A.clone();
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
//@ run-pass
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[derive(Clone)]
|
||||
enum E<T,U> {
|
||||
A(T),
|
||||
B(T,U),
|
||||
C
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let _ = E::A::<isize, isize>(1).clone();
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
//@ run-pass
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[derive(Clone)]
|
||||
struct S<T> {
|
||||
foo: (),
|
||||
bar: (),
|
||||
baz: T,
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let _ = S { foo: (), bar: (), baz: 1 }.clone();
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
//@ run-pass
|
||||
|
||||
#[derive(Clone)]
|
||||
#[allow(dead_code)]
|
||||
struct S<T>(T, ());
|
||||
|
||||
pub fn main() {
|
||||
let _ = S(1, ()).clone();
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
//@ run-pass
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[derive(Clone)]
|
||||
struct S {
|
||||
_int: isize,
|
||||
_i8: i8,
|
||||
_i16: i16,
|
||||
_i32: i32,
|
||||
_i64: i64,
|
||||
|
||||
_uint: usize,
|
||||
_u8: u8,
|
||||
_u16: u16,
|
||||
_u32: u32,
|
||||
_u64: u64,
|
||||
|
||||
_f32: f32,
|
||||
_f64: f64,
|
||||
|
||||
_bool: bool,
|
||||
_char: char,
|
||||
_nil: ()
|
||||
}
|
||||
|
||||
pub fn main() {}
|
||||
@@ -1,8 +0,0 @@
|
||||
//@ run-pass
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[derive(Clone)]
|
||||
struct S((), ());
|
||||
|
||||
pub fn main() {}
|
||||
@@ -1,10 +0,0 @@
|
||||
//@ run-pass
|
||||
|
||||
#[derive(PartialEq, Debug)]
|
||||
enum Test<'a> {
|
||||
Slice(&'a isize)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
assert_eq!(Test::Slice(&1), Test::Slice(&1))
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
//@ check-pass
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[derive(Clone)]
|
||||
enum Test<'a> {
|
||||
Slice(&'a isize)
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -1,13 +0,0 @@
|
||||
//@ run-pass
|
||||
|
||||
#[derive(PartialEq)]
|
||||
struct Bike {
|
||||
name: String,
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let town_bike = Bike { name: "schwinn".to_string() };
|
||||
let my_bike = Bike { name: "surly".to_string() };
|
||||
|
||||
assert!(town_bike != my_bike);
|
||||
}
|
||||
Reference in New Issue
Block a user