mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
Rollup merge of #155659 - cyrgani:deriving-2, r=Kivooeo
cleanup, restructure and merge `tests/ui/deriving` into `tests/ui/derives` As a followup to https://github.com/rust-lang/rust/pull/155615, this PR deletes some outdated tests from these directories, splits up `ui/derives` into smaller directories to roughly group tests by the derive macros they use and moves over all tests from `ui/deriving` into `ui/derives`. r? @Kivooeo
This commit is contained in:
@@ -412,10 +412,6 @@ Tests for quality of diagnostics involving suppression of cascading errors in so
|
||||
|
||||
Tests for built-in derive macros (`Debug`, `Clone`, etc.) when used in conjunction with built-in `#[derive(..)]` attributes.
|
||||
|
||||
## `tests/ui/deriving/`: Derive Macro
|
||||
|
||||
**FIXME**: Coalesce with `tests/ui/derives`.
|
||||
|
||||
## `tests/ui/dest-prop/` Destination Propagation
|
||||
|
||||
**FIXME**: Contains a single test for the `DestProp` mir-opt, should probably be rehomed.
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
#![crate_type = "lib"]
|
||||
|
||||
pub trait Decoder {
|
||||
type Error;
|
||||
|
||||
fn read_enum<T, F>(&mut self, name: &str, f: F) -> Result<T, Self::Error>
|
||||
where F: FnOnce(&mut Self) -> Result<T, Self::Error>;
|
||||
fn read_enum_variant<T, F>(&mut self, names: &[&str], f: F)
|
||||
-> Result<T, Self::Error>
|
||||
where F: FnMut(&mut Self, usize) -> Result<T, Self::Error>;
|
||||
|
||||
}
|
||||
|
||||
pub trait Decodable: Sized {
|
||||
fn decode<D: Decoder>(d: &mut D) -> Result<Self, D::Error>;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
//@ run-pass
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
pub type task_id = isize;
|
||||
|
||||
#[derive(PartialEq)]
|
||||
pub enum Task {
|
||||
TaskHandle(task_id)
|
||||
}
|
||||
|
||||
pub fn main() { }
|
||||
@@ -1,16 +0,0 @@
|
||||
//@ check-pass
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
macro_rules! define_vec {
|
||||
() => (
|
||||
mod foo {
|
||||
#[derive(PartialEq)]
|
||||
pub struct bar;
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
define_vec![];
|
||||
|
||||
pub fn main() {}
|
||||
@@ -1,25 +0,0 @@
|
||||
//@ run-pass
|
||||
#![allow(unused_must_use)]
|
||||
#![allow(unused_imports)]
|
||||
#![allow(deprecated)]
|
||||
|
||||
use std::hash::{Hash, SipHasher};
|
||||
|
||||
// testing multiple separate deriving attributes
|
||||
#[derive(PartialEq)]
|
||||
#[derive(Clone)]
|
||||
#[derive(Hash)]
|
||||
struct Foo {
|
||||
bar: usize,
|
||||
baz: isize
|
||||
}
|
||||
|
||||
fn hash<T: Hash>(_t: &T) {}
|
||||
|
||||
pub fn main() {
|
||||
let a = Foo {bar: 4, baz: -3};
|
||||
|
||||
a == a; // check for PartialEq impl w/o testing its correctness
|
||||
a.clone(); // check for Clone impl w/o testing its correctness
|
||||
hash(&a); // check for Hash impl w/o testing its correctness
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
//@ run-pass
|
||||
#![allow(unused_must_use)]
|
||||
#![allow(unused_imports)]
|
||||
#![allow(deprecated)]
|
||||
|
||||
use std::hash::{Hash, SipHasher};
|
||||
|
||||
#[derive(PartialEq, Clone, Hash)]
|
||||
struct Foo {
|
||||
bar: usize,
|
||||
baz: isize
|
||||
}
|
||||
|
||||
fn hash<T: Hash>(_t: &T) {}
|
||||
|
||||
pub fn main() {
|
||||
let a = Foo {bar: 4, baz: -3};
|
||||
|
||||
a == a; // check for PartialEq impl w/o testing its correctness
|
||||
a.clone(); // check for Clone impl w/o testing its correctness
|
||||
hash(&a); // check for Hash impl w/o testing its correctness
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
//@ run-pass
|
||||
#![allow(dead_code)]
|
||||
#[derive(PartialEq, Debug)]
|
||||
enum Foo {
|
||||
Bar,
|
||||
Baz,
|
||||
Boo
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let a = Foo::Bar;
|
||||
let b = Foo::Bar;
|
||||
assert_eq!(a, b);
|
||||
assert!(!(a != b));
|
||||
assert!(a.eq(&b));
|
||||
assert!(!a.ne(&b));
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
//@ run-pass
|
||||
#![allow(dead_code)]
|
||||
#[derive(PartialEq, Debug)]
|
||||
enum Foo {
|
||||
Bar(isize, isize),
|
||||
Baz(f64, f64)
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let a = Foo::Bar(1, 2);
|
||||
let b = Foo::Bar(1, 2);
|
||||
assert_eq!(a, b);
|
||||
assert!(!(a != b));
|
||||
assert!(a.eq(&b));
|
||||
assert!(!a.ne(&b));
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
//@ run-pass
|
||||
#![allow(dead_code)]
|
||||
#[derive(Hash)]
|
||||
enum Foo {
|
||||
Bar(isize, char),
|
||||
Baz(char, isize)
|
||||
}
|
||||
|
||||
#[derive(Hash)]
|
||||
enum A {
|
||||
B,
|
||||
C,
|
||||
D,
|
||||
E
|
||||
}
|
||||
|
||||
pub fn main(){}
|
||||
@@ -1,11 +0,0 @@
|
||||
//@ run-pass
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[derive(Hash)]
|
||||
struct Foo {
|
||||
x: isize,
|
||||
y: isize,
|
||||
z: isize
|
||||
}
|
||||
|
||||
pub fn main() {}
|
||||
@@ -1,8 +0,0 @@
|
||||
//@ run-pass
|
||||
#[derive(PartialEq, Debug)]
|
||||
struct Foo;
|
||||
|
||||
pub fn main() {
|
||||
assert_eq!(Foo, Foo);
|
||||
assert!(!(Foo != Foo));
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
//@ run-pass
|
||||
#![allow(dead_code)]
|
||||
#[derive(PartialEq, Debug)]
|
||||
enum S {
|
||||
X { x: isize, y: isize },
|
||||
Y
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let x = S::X { x: 1, y: 2 };
|
||||
assert_eq!(x, x);
|
||||
assert!(!(x != x));
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
//@ run-pass
|
||||
#[derive(PartialEq, Debug)]
|
||||
struct Foo(isize, isize, String);
|
||||
|
||||
pub fn main() {
|
||||
let a1 = Foo(5, 6, "abc".to_string());
|
||||
let a2 = Foo(5, 6, "abc".to_string());
|
||||
let b = Foo(5, 7, "def".to_string());
|
||||
|
||||
assert_eq!(a1, a1);
|
||||
assert_eq!(a2, a1);
|
||||
assert!(!(a1 == b));
|
||||
|
||||
assert!(a1 != b);
|
||||
assert!(!(a1 != a1));
|
||||
assert!(!(a2 != a1));
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
//@ run-pass
|
||||
#[derive(PartialEq, Debug)]
|
||||
struct Foo {
|
||||
x: isize,
|
||||
y: isize,
|
||||
z: isize,
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let a = Foo { x: 1, y: 2, z: 3 };
|
||||
let b = Foo { x: 1, y: 2, z: 3 };
|
||||
assert_eq!(a, b);
|
||||
assert!(!(a != b));
|
||||
assert!(a.eq(&b));
|
||||
assert!(!a.ne(&b));
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
//@ run-pass
|
||||
#[derive(PartialEq, Hash, Debug)]
|
||||
struct Foo<T> {
|
||||
x: isize,
|
||||
y: T,
|
||||
z: isize
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let a = Foo { x: 1, y: 2.0f64, z: 3 };
|
||||
let b = Foo { x: 1, y: 2.0f64, z: 3 };
|
||||
assert_eq!(a, b);
|
||||
assert!(!(a != b));
|
||||
assert!(a.eq(&b));
|
||||
assert!(!a.ne(&b));
|
||||
}
|
||||
+1
-1
@@ -1283,7 +1283,7 @@ Please ensure that if you've changed the output:
|
||||
"""
|
||||
cc = ["@aDotInTheVoid", "@obi1kenobi"]
|
||||
|
||||
[mentions."tests/ui/deriving/deriving-all-codegen.stdout"]
|
||||
[mentions."tests/ui/derives/deriving-all-codegen.stdout"]
|
||||
message = "Changes to the code generated for builtin derived traits."
|
||||
cc = ["@nnethercote"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user