Move all compile-fail tests to ui tests

The update-references.sh script makes these much easier to update in
bulk compared to compile-fail tests.
This commit is contained in:
David Tolnay
2018-11-24 15:37:35 -08:00
parent b3d9d51b51
commit 4821d09a48
134 changed files with 603 additions and 73 deletions
@@ -0,0 +1,18 @@
// Copyright 2017 Serde Developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)]
enum Enum {
#[serde(deserialize_with = "deserialize_some_newtype_variant")]
Newtype(#[serde(skip_deserializing)] String),
}
fn main() {}
@@ -0,0 +1,8 @@
error: variant `Newtype` cannot have both #[serde(deserialize_with)] and a field 0 marked with #[serde(skip_deserializing)]
--> $DIR/skip_de_newtype_field.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error
@@ -0,0 +1,22 @@
// Copyright 2017 Serde Developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)]
enum Enum {
#[serde(deserialize_with = "deserialize_some_other_variant")]
Struct {
#[serde(skip_deserializing)]
f1: String,
f2: u8,
},
}
fn main() {}
@@ -0,0 +1,8 @@
error: variant `Struct` cannot have both #[serde(deserialize_with)] and a field `f1` marked with #[serde(skip_deserializing)]
--> $DIR/skip_de_struct_field.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error
@@ -0,0 +1,18 @@
// Copyright 2017 Serde Developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)]
enum Enum {
#[serde(deserialize_with = "deserialize_some_other_variant")]
Tuple(#[serde(skip_deserializing)] String, u8),
}
fn main() {}
@@ -0,0 +1,8 @@
error: variant `Tuple` cannot have both #[serde(deserialize_with)] and a field 0 marked with #[serde(skip_deserializing)]
--> $DIR/skip_de_tuple_field.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error
@@ -0,0 +1,19 @@
// Copyright 2017 Serde Developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)]
enum Enum {
#[serde(deserialize_with = "deserialize_some_unit_variant")]
#[serde(skip_deserializing)]
Unit,
}
fn main() {}
@@ -0,0 +1,8 @@
error: variant `Unit` cannot have both #[serde(deserialize_with)] and #[serde(skip_deserializing)]
--> $DIR/skip_de_whole_variant.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error
@@ -0,0 +1,18 @@
// Copyright 2017 Serde Developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)]
enum Enum {
#[serde(serialize_with = "serialize_some_newtype_variant")]
Newtype(#[serde(skip_serializing)] String),
}
fn main() {}
@@ -0,0 +1,8 @@
error: variant `Newtype` cannot have both #[serde(serialize_with)] and a field 0 marked with #[serde(skip_serializing)]
--> $DIR/skip_ser_newtype_field.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error
@@ -0,0 +1,18 @@
// Copyright 2017 Serde Developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)]
enum Enum {
#[serde(serialize_with = "serialize_some_newtype_variant")]
Newtype(#[serde(skip_serializing_if = "always")] String),
}
fn main() {}
@@ -0,0 +1,8 @@
error: variant `Newtype` cannot have both #[serde(serialize_with)] and a field 0 marked with #[serde(skip_serializing_if)]
--> $DIR/skip_ser_newtype_field_if.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error
@@ -0,0 +1,22 @@
// Copyright 2017 Serde Developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)]
enum Enum {
#[serde(serialize_with = "serialize_some_other_variant")]
Struct {
#[serde(skip_serializing)]
f1: String,
f2: u8,
},
}
fn main() {}
@@ -0,0 +1,8 @@
error: variant `Struct` cannot have both #[serde(serialize_with)] and a field `f1` marked with #[serde(skip_serializing)]
--> $DIR/skip_ser_struct_field.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error
@@ -0,0 +1,22 @@
// Copyright 2017 Serde Developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)]
enum Enum {
#[serde(serialize_with = "serialize_some_newtype_variant")]
Struct {
#[serde(skip_serializing_if = "always")]
f1: String,
f2: u8,
},
}
fn main() {}
@@ -0,0 +1,8 @@
error: variant `Struct` cannot have both #[serde(serialize_with)] and a field `f1` marked with #[serde(skip_serializing_if)]
--> $DIR/skip_ser_struct_field_if.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error
@@ -0,0 +1,18 @@
// Copyright 2017 Serde Developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)]
enum Enum {
#[serde(serialize_with = "serialize_some_other_variant")]
Tuple(#[serde(skip_serializing)] String, u8),
}
fn main() {}
@@ -0,0 +1,8 @@
error: variant `Tuple` cannot have both #[serde(serialize_with)] and a field 0 marked with #[serde(skip_serializing)]
--> $DIR/skip_ser_tuple_field.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error
@@ -0,0 +1,18 @@
// Copyright 2017 Serde Developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)]
enum Enum {
#[serde(serialize_with = "serialize_some_other_variant")]
Tuple(#[serde(skip_serializing_if = "always")] String, u8),
}
fn main() {}
@@ -0,0 +1,8 @@
error: variant `Tuple` cannot have both #[serde(serialize_with)] and a field 0 marked with #[serde(skip_serializing_if)]
--> $DIR/skip_ser_tuple_field_if.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error
@@ -0,0 +1,19 @@
// Copyright 2017 Serde Developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)]
enum Enum {
#[serde(serialize_with = "serialize_some_unit_variant")]
#[serde(skip_serializing)]
Unit,
}
fn main() {}
@@ -0,0 +1,8 @@
error: variant `Unit` cannot have both #[serde(serialize_with)] and #[serde(skip_serializing)]
--> $DIR/skip_ser_whole_variant.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error