Update ui tests to 2018 edition
diff --git a/tests/compiletest.rs b/tests/compiletest.rs
index c554d5a..2a481ad 100644
--- a/tests/compiletest.rs
+++ b/tests/compiletest.rs
@@ -5,7 +5,14 @@
compiletest::run_tests(&compiletest::Config {
mode: compiletest::common::Mode::Ui,
src_base: std::path::PathBuf::from("tests/ui"),
- target_rustcflags: Some(String::from("-L tests/deps/target/debug/deps")),
+ target_rustcflags: Some(String::from(
+ "\
+ --edition=2018 \
+ -L tests/deps/target/debug/deps \
+ -Z unstable-options \
+ --extern serde_json \
+ ",
+ )),
..Default::default()
});
}
diff --git a/tests/ui/missing_colon.rs b/tests/ui/missing_colon.rs
index 98d4f2c..d93b7b9 100644
--- a/tests/ui/missing_colon.rs
+++ b/tests/ui/missing_colon.rs
@@ -1,5 +1,4 @@
-#[macro_use]
-extern crate serde_json;
+use serde_json::json;
fn main() {
json!({ "a" });
diff --git a/tests/ui/missing_colon.stderr b/tests/ui/missing_colon.stderr
index b854d44..eec0ebd 100644
--- a/tests/ui/missing_colon.stderr
+++ b/tests/ui/missing_colon.stderr
@@ -1,7 +1,7 @@
error: unexpected end of macro invocation
- --> $DIR/missing_colon.rs:5:5
+ --> $DIR/missing_colon.rs:4:5
|
-5 | json!({ "a" });
+4 | json!({ "a" });
| ^^^^^^^^^^^^^^^ missing tokens in macro arguments
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
diff --git a/tests/ui/missing_value.rs b/tests/ui/missing_value.rs
index d72a49d..0ba14e2 100644
--- a/tests/ui/missing_value.rs
+++ b/tests/ui/missing_value.rs
@@ -1,5 +1,4 @@
-#[macro_use]
-extern crate serde_json;
+use serde_json::json;
fn main() {
json!({ "a" : });
diff --git a/tests/ui/missing_value.stderr b/tests/ui/missing_value.stderr
index 6d088ed..fc5a46d 100644
--- a/tests/ui/missing_value.stderr
+++ b/tests/ui/missing_value.stderr
@@ -1,7 +1,7 @@
error: unexpected end of macro invocation
- --> $DIR/missing_value.rs:5:5
+ --> $DIR/missing_value.rs:4:5
|
-5 | json!({ "a" : });
+4 | json!({ "a" : });
| ^^^^^^^^^^^^^^^^^ missing tokens in macro arguments
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
diff --git a/tests/ui/not_found.rs b/tests/ui/not_found.rs
index 08b802f..2df6870 100644
--- a/tests/ui/not_found.rs
+++ b/tests/ui/not_found.rs
@@ -1,5 +1,4 @@
-#[macro_use]
-extern crate serde_json;
+use serde_json::json;
fn main() {
json!({ "a" : x });
diff --git a/tests/ui/not_found.stderr b/tests/ui/not_found.stderr
index b544b37..6b39db1 100644
--- a/tests/ui/not_found.stderr
+++ b/tests/ui/not_found.stderr
@@ -1,7 +1,7 @@
error[E0425]: cannot find value `x` in this scope
- --> $DIR/not_found.rs:5:19
+ --> $DIR/not_found.rs:4:19
|
-5 | json!({ "a" : x });
+4 | json!({ "a" : x });
| ^ not found in this scope
error: aborting due to previous error
diff --git a/tests/ui/parse_expr.rs b/tests/ui/parse_expr.rs
index bcc58ae..e7f1805 100644
--- a/tests/ui/parse_expr.rs
+++ b/tests/ui/parse_expr.rs
@@ -1,5 +1,4 @@
-#[macro_use]
-extern crate serde_json;
+use serde_json::json;
fn main() {
json!({ "a" : ~ });
diff --git a/tests/ui/parse_expr.stderr b/tests/ui/parse_expr.stderr
index 76bbcaa..c182361 100644
--- a/tests/ui/parse_expr.stderr
+++ b/tests/ui/parse_expr.stderr
@@ -1,7 +1,7 @@
error: unexpected end of macro invocation
- --> $DIR/parse_expr.rs:5:5
+ --> $DIR/parse_expr.rs:4:5
|
-5 | json!({ "a" : ~ });
+4 | json!({ "a" : ~ });
| ^^^^^^^^^^^^^^^^^^^ missing tokens in macro arguments
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
diff --git a/tests/ui/parse_key.rs b/tests/ui/parse_key.rs
index e7f4e27..858bd71 100644
--- a/tests/ui/parse_key.rs
+++ b/tests/ui/parse_key.rs
@@ -1,5 +1,4 @@
-#[macro_use]
-extern crate serde_json;
+use serde_json::json;
fn main() {
json!({ "".s : true });
diff --git a/tests/ui/parse_key.stderr b/tests/ui/parse_key.stderr
index c1485a0..c91afcd 100644
--- a/tests/ui/parse_key.stderr
+++ b/tests/ui/parse_key.stderr
@@ -1,7 +1,7 @@
error[E0609]: no field `s` on type `&'static str`
- --> $DIR/parse_key.rs:5:16
+ --> $DIR/parse_key.rs:4:16
|
-5 | json!({ "".s : true });
+4 | json!({ "".s : true });
| ^
error: aborting due to previous error
diff --git a/tests/ui/unexpected_after_array_element.rs b/tests/ui/unexpected_after_array_element.rs
index f8f3e91..226c58c 100644
--- a/tests/ui/unexpected_after_array_element.rs
+++ b/tests/ui/unexpected_after_array_element.rs
@@ -1,5 +1,4 @@
-#[macro_use]
-extern crate serde_json;
+use serde_json::json;
fn main() {
json!([ true => ]);
diff --git a/tests/ui/unexpected_after_array_element.stderr b/tests/ui/unexpected_after_array_element.stderr
index 5b45a0a..835229b 100644
--- a/tests/ui/unexpected_after_array_element.stderr
+++ b/tests/ui/unexpected_after_array_element.stderr
@@ -1,7 +1,7 @@
error: no rules expected the token `=>`
- --> $DIR/unexpected_after_array_element.rs:5:18
+ --> $DIR/unexpected_after_array_element.rs:4:18
|
-5 | json!([ true => ]);
+4 | json!([ true => ]);
| ^^ no rules expected this token in macro call
error: aborting due to previous error
diff --git a/tests/ui/unexpected_after_map_entry.rs b/tests/ui/unexpected_after_map_entry.rs
index 4018541..0dfb731 100644
--- a/tests/ui/unexpected_after_map_entry.rs
+++ b/tests/ui/unexpected_after_map_entry.rs
@@ -1,5 +1,4 @@
-#[macro_use]
-extern crate serde_json;
+use serde_json::json;
fn main() {
json!({ "k": true => });
diff --git a/tests/ui/unexpected_after_map_entry.stderr b/tests/ui/unexpected_after_map_entry.stderr
index df58a06..02484c8 100644
--- a/tests/ui/unexpected_after_map_entry.stderr
+++ b/tests/ui/unexpected_after_map_entry.stderr
@@ -1,7 +1,7 @@
error: no rules expected the token `=>`
- --> $DIR/unexpected_after_map_entry.rs:5:23
+ --> $DIR/unexpected_after_map_entry.rs:4:23
|
-5 | json!({ "k": true => });
+4 | json!({ "k": true => });
| ^^ no rules expected this token in macro call
error: aborting due to previous error
diff --git a/tests/ui/unexpected_colon.rs b/tests/ui/unexpected_colon.rs
index e9a307e..e767ea6 100644
--- a/tests/ui/unexpected_colon.rs
+++ b/tests/ui/unexpected_colon.rs
@@ -1,5 +1,4 @@
-#[macro_use]
-extern crate serde_json;
+use serde_json::json;
fn main() {
json!({ : true });
diff --git a/tests/ui/unexpected_colon.stderr b/tests/ui/unexpected_colon.stderr
index b379d4e..495bbd9 100644
--- a/tests/ui/unexpected_colon.stderr
+++ b/tests/ui/unexpected_colon.stderr
@@ -1,7 +1,7 @@
error: no rules expected the token `:`
- --> $DIR/unexpected_colon.rs:5:13
+ --> $DIR/unexpected_colon.rs:4:13
|
-5 | json!({ : true });
+4 | json!({ : true });
| ^ no rules expected this token in macro call
error: aborting due to previous error
diff --git a/tests/ui/unexpected_comma.rs b/tests/ui/unexpected_comma.rs
index 66d106d..338874e 100644
--- a/tests/ui/unexpected_comma.rs
+++ b/tests/ui/unexpected_comma.rs
@@ -1,5 +1,4 @@
-#[macro_use]
-extern crate serde_json;
+use serde_json::json;
fn main() {
json!({ "a" , "b": true });
diff --git a/tests/ui/unexpected_comma.stderr b/tests/ui/unexpected_comma.stderr
index 274cb19..c6d2b66 100644
--- a/tests/ui/unexpected_comma.stderr
+++ b/tests/ui/unexpected_comma.stderr
@@ -1,7 +1,7 @@
error: no rules expected the token `,`
- --> $DIR/unexpected_comma.rs:5:17
+ --> $DIR/unexpected_comma.rs:4:17
|
-5 | json!({ "a" , "b": true });
+4 | json!({ "a" , "b": true });
| ^ no rules expected this token in macro call
error: aborting due to previous error