Update 'compiletest' and fix and re-enable compile UI tests.

This commit is contained in:
Jeb Rosen 2020-01-15 16:53:57 -08:00
parent 859224a209
commit ff2000293c
10 changed files with 78 additions and 60 deletions

View File

@ -27,6 +27,6 @@ yansi = "0.5"
version_check = "0.9.1"
[dev-dependencies]
compiletest_rs = { version = "0.3", features = ["stable"] }
compiletest_rs = "0.4"
rocket = { version = "0.5.0-dev", path = "../../core/lib" }
rocket_contrib = { version = "0.5.0-dev", path = "../lib", features = ["diesel_sqlite_pool"] }

View File

@ -97,7 +97,6 @@ fn run_mode(mode: &'static str, path: &'static str) {
#[test]
fn compile_test() {
// TODO.async: Restore UI tests once they can be fixed
// run_mode("ui", "ui-fail");
run_mode("ui", "ui-fail");
run_mode("compile-fail", "ui-fail");
}

View File

@ -27,4 +27,4 @@ version_check = "0.9.1"
[dev-dependencies]
rocket = { version = "0.5.0-dev", path = "../lib" }
compiletest_rs = { version = "0.3", features = ["stable"] }
compiletest_rs = "0.4"

View File

@ -96,7 +96,6 @@ fn run_mode(mode: &'static str, path: &'static str) {
#[test]
fn compile_test() {
// TODO: Restore UI tests once they can be fixed
// run_mode("ui", "ui-fail");
run_mode("ui", "ui-fail");
run_mode("compile-fail", "ui-fail");
}

View File

@ -17,11 +17,13 @@ error[E0277]: the trait bound `bool: rocket::response::Responder<'_>` is not sat
error[E0308]: mismatched types
--> $DIR/catch_type_errors.rs:18:7
|
17 | #[catch(404)]
| ------------- expected due to this
18 | fn f3(_request: bool) -> usize {
| ^^^^^^^^^^^^^^ expected reference, found bool
| ^^^^^^^^^^^^^^ expected `&rocket::Request<'_>`, found `bool`
|
= note: expected type `for<'r, 's> fn(&'r rocket::Request<'s>) -> _`
found type `fn(bool) -> usize {f3}`
= note: expected fn pointer `for<'r, 's> fn(&'r rocket::Request<'s>) -> _`
found fn item `fn(bool) -> usize {f3}`
error[E0277]: the trait bound `usize: rocket::response::Responder<'_>` is not satisfied
--> $DIR/catch_type_errors.rs:24:12

View File

@ -1,5 +1,6 @@
// normalize-stderr-test: "<(.*) as (.*)>" -> "$1 as $$TRAIT"
// normalize-stderr-test: "and \d+ others" -> "and $$N others"
// normalize-stderr-test: "::: (.*)/core/lib" -> "::: $$ROCKET/core/lib"
#![feature(proc_macro_hygiene)]

View File

@ -1,15 +1,15 @@
error[E0277]: the trait bound `u8: rocket::response::Responder<'_>` is not satisfied
--> $DIR/responder-types.rs:10:5
--> $DIR/responder-types.rs:11:5
|
10 | thing: u8,
11 | thing: u8,
| ^^^^^^^^^ the trait `rocket::response::Responder<'_>` is not implemented for `u8`
|
= note: required by `rocket::response::Responder::respond_to`
error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From<u8>` is not satisfied
--> $DIR/responder-types.rs:17:5
--> $DIR/responder-types.rs:18:5
|
17 | other: u8,
18 | other: u8,
| ^^^^^^^^^ the trait `std::convert::From<u8>` is not implemented for `rocket::http::Header<'_>`
|
= help: the following implementations were found:
@ -21,17 +21,17 @@ error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From<u8>`
= note: required because of the requirements on the impl of `std::convert::Into<rocket::http::Header<'_>>` for `u8`
error[E0277]: the trait bound `u8: rocket::response::Responder<'_>` is not satisfied
--> $DIR/responder-types.rs:23:5
--> $DIR/responder-types.rs:24:5
|
23 | thing: u8,
24 | thing: u8,
| ^^^^^^^^^ the trait `rocket::response::Responder<'_>` is not implemented for `u8`
|
= note: required by `rocket::response::Responder::respond_to`
error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From<u8>` is not satisfied
--> $DIR/responder-types.rs:25:5
--> $DIR/responder-types.rs:26:5
|
25 | other: u8,
26 | other: u8,
| ^^^^^^^^^ the trait `std::convert::From<u8>` is not implemented for `rocket::http::Header<'_>`
|
= help: the following implementations were found:
@ -43,9 +43,9 @@ error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From<u8>`
= note: required because of the requirements on the impl of `std::convert::Into<rocket::http::Header<'_>>` for `u8`
error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From<std::string::String>` is not satisfied
--> $DIR/responder-types.rs:33:5
--> $DIR/responder-types.rs:34:5
|
33 | then: String,
34 | then: String,
| ^^^^^^^^^^^^ the trait `std::convert::From<std::string::String>` is not implemented for `rocket::http::Header<'_>`
|
= help: the following implementations were found:
@ -57,12 +57,15 @@ error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From<std:
= note: required because of the requirements on the impl of `std::convert::Into<rocket::http::Header<'_>>` for `std::string::String`
error[E0277]: the trait bound `usize: rocket::response::Responder<'_>` is not satisfied
--> $DIR/responder-types.rs:38:13
--> $DIR/responder-types.rs:39:13
|
38 | fn foo() -> usize { 0 }
39 | fn foo() -> usize { 0 }
| ^^^^^ the trait `rocket::response::Responder<'_>` is not implemented for `usize`
|
= note: required by `rocket::handler::<impl rocket::Outcome<rocket::Response<'r>, rocket::http::Status, rocket::Data>>::from`
::: $ROCKET/core/lib/src/handler.rs:202:20
|
202 | pub fn from<T: Responder<'r>>(req: &Request<'_>, responder: T) -> Outcome<'r> {
| ------------- required by this bound in `rocket::handler::<impl rocket::Outcome<rocket::Response<'r>, rocket::http::Status, rocket::Data>>::from`
error: aborting due to 6 previous errors

View File

@ -1,5 +1,6 @@
// normalize-stderr-test: "<(.*) as (.*)>" -> "$1 as $$TRAIT"
// normalize-stderr-test: "and \d+ others" -> "and $$N others"
// normalize-stderr-test: "::: (.*)/core/http" -> "::: $$ROCKET/core/http"
#![feature(proc_macro_hygiene)]

View File

@ -1,7 +1,7 @@
error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam<rocket::http::uri::Path, &str>` is not satisfied
--> $DIR/typed-uri-bad-type.rs:47:23
--> $DIR/typed-uri-bad-type.rs:50:23
|
47 | uri!(simple: id = "hi");
50 | uri!(simple: id = "hi");
| ^^^^ the trait `rocket::http::uri::FromUriParam<rocket::http::uri::Path, &str>` is not implemented for `usize`
|
= help: the following implementations were found:
@ -11,9 +11,9 @@ error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam<rocket::ht
= note: required by `rocket::http::uri::FromUriParam::from_uri_param`
error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam<rocket::http::uri::Path, &str>` is not satisfied
--> $DIR/typed-uri-bad-type.rs:50:18
--> $DIR/typed-uri-bad-type.rs:53:18
|
50 | uri!(simple: "hello");
53 | uri!(simple: "hello");
| ^^^^^^^ the trait `rocket::http::uri::FromUriParam<rocket::http::uri::Path, &str>` is not implemented for `usize`
|
= help: the following implementations were found:
@ -23,9 +23,9 @@ error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam<rocket::ht
= note: required by `rocket::http::uri::FromUriParam::from_uri_param`
error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam<rocket::http::uri::Path, i64>` is not satisfied
--> $DIR/typed-uri-bad-type.rs:53:23
--> $DIR/typed-uri-bad-type.rs:56:23
|
53 | uri!(simple: id = 239239i64);
56 | uri!(simple: id = 239239i64);
| ^^^^^^^^^ the trait `rocket::http::uri::FromUriParam<rocket::http::uri::Path, i64>` is not implemented for `usize`
|
= help: the following implementations were found:
@ -35,15 +35,15 @@ error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam<rocket::ht
= note: required by `rocket::http::uri::FromUriParam::from_uri_param`
error[E0277]: the trait bound `S: rocket::http::uri::FromUriParam<rocket::http::uri::Path, _>` is not satisfied
--> $DIR/typed-uri-bad-type.rs:56:31
--> $DIR/typed-uri-bad-type.rs:59:31
|
56 | uri!(not_uri_display: 10, S);
59 | uri!(not_uri_display: 10, S);
| ^ the trait `rocket::http::uri::FromUriParam<rocket::http::uri::Path, _>` is not implemented for `S`
error[E0277]: the trait bound `i32: rocket::http::uri::FromUriParam<rocket::http::uri::Path, std::option::Option<{integer}>>` is not satisfied
--> $DIR/typed-uri-bad-type.rs:62:26
--> $DIR/typed-uri-bad-type.rs:65:26
|
62 | uri!(optionals: id = Some(10), name = Ok("bob".into()));
65 | uri!(optionals: id = Some(10), name = Ok("bob".into()));
| ^^^^^^^^ the trait `rocket::http::uri::FromUriParam<rocket::http::uri::Path, std::option::Option<{integer}>>` is not implemented for `i32`
|
= help: the following implementations were found:
@ -53,9 +53,9 @@ error[E0277]: the trait bound `i32: rocket::http::uri::FromUriParam<rocket::http
= note: required because of the requirements on the impl of `rocket::http::uri::FromUriParam<rocket::http::uri::Path, std::option::Option<{integer}>>` for `std::option::Option<i32>`
error[E0277]: the trait bound `std::string::String: rocket::http::uri::FromUriParam<rocket::http::uri::Path, std::result::Result<_, _>>` is not satisfied
--> $DIR/typed-uri-bad-type.rs:62:43
--> $DIR/typed-uri-bad-type.rs:65:43
|
62 | uri!(optionals: id = Some(10), name = Ok("bob".into()));
65 | uri!(optionals: id = Some(10), name = Ok("bob".into()));
| ^^^^^^^^^^^^^^^^ the trait `rocket::http::uri::FromUriParam<rocket::http::uri::Path, std::result::Result<_, _>>` is not implemented for `std::string::String`
|
= help: the following implementations were found:
@ -67,9 +67,9 @@ error[E0277]: the trait bound `std::string::String: rocket::http::uri::FromUriPa
= note: required because of the requirements on the impl of `rocket::http::uri::FromUriParam<rocket::http::uri::Path, std::result::Result<_, _>>` for `std::result::Result<std::string::String, &rocket::http::RawStr>`
error[E0277]: the trait bound `isize: rocket::http::uri::FromUriParam<rocket::http::uri::Query, &str>` is not satisfied
--> $DIR/typed-uri-bad-type.rs:66:20
--> $DIR/typed-uri-bad-type.rs:69:20
|
66 | uri!(simple_q: "hi");
69 | uri!(simple_q: "hi");
| ^^^^ the trait `rocket::http::uri::FromUriParam<rocket::http::uri::Query, &str>` is not implemented for `isize`
|
= help: the following implementations were found:
@ -79,9 +79,9 @@ error[E0277]: the trait bound `isize: rocket::http::uri::FromUriParam<rocket::ht
= note: required by `rocket::http::uri::FromUriParam::from_uri_param`
error[E0277]: the trait bound `isize: rocket::http::uri::FromUriParam<rocket::http::uri::Query, &str>` is not satisfied
--> $DIR/typed-uri-bad-type.rs:69:25
--> $DIR/typed-uri-bad-type.rs:72:25
|
69 | uri!(simple_q: id = "hi");
72 | uri!(simple_q: id = "hi");
| ^^^^ the trait `rocket::http::uri::FromUriParam<rocket::http::uri::Query, &str>` is not implemented for `isize`
|
= help: the following implementations were found:
@ -91,37 +91,49 @@ error[E0277]: the trait bound `isize: rocket::http::uri::FromUriParam<rocket::ht
= note: required by `rocket::http::uri::FromUriParam::from_uri_param`
error[E0277]: the trait bound `S: rocket::http::uri::FromUriParam<rocket::http::uri::Query, _>` is not satisfied
--> $DIR/typed-uri-bad-type.rs:72:24
--> $DIR/typed-uri-bad-type.rs:75:24
|
72 | uri!(other_q: 100, S);
75 | uri!(other_q: 100, S);
| ^ the trait `rocket::http::uri::FromUriParam<rocket::http::uri::Query, _>` is not implemented for `S`
error[E0277]: the trait bound `S: rocket::http::uri::FromUriParam<rocket::http::uri::Query, _>` is not satisfied
--> $DIR/typed-uri-bad-type.rs:75:26
--> $DIR/typed-uri-bad-type.rs:78:26
|
75 | uri!(other_q: rest = S, id = 100);
78 | uri!(other_q: rest = S, id = 100);
| ^ the trait `rocket::http::uri::FromUriParam<rocket::http::uri::Query, _>` is not implemented for `S`
error[E0277]: the trait bound `S: rocket::http::uri::Ignorable<rocket::http::uri::Query>` is not satisfied
--> $DIR/typed-uri-bad-type.rs:78:26
--> $DIR/typed-uri-bad-type.rs:42:29
|
78 | uri!(other_q: rest = _, id = 100);
42 | fn other_q(id: usize, rest: S) { }
| ^ the trait `rocket::http::uri::Ignorable<rocket::http::uri::Query>` is not implemented for `S`
...
81 | uri!(other_q: rest = _, id = 100);
| ---------------------------------- in this macro invocation
|
= note: required by `rocket::http::uri::assert_ignorable`
::: $ROCKET/core/http/src/uri/uri_display.rs:467:40
|
467 | pub fn assert_ignorable<P: UriPart, T: Ignorable<P>>() { }
| ------------ required by this bound in `rocket::http::uri::assert_ignorable`
error[E0277]: the trait bound `usize: rocket::http::uri::Ignorable<rocket::http::uri::Query>` is not satisfied
--> $DIR/typed-uri-bad-type.rs:81:34
--> $DIR/typed-uri-bad-type.rs:42:16
|
81 | uri!(other_q: rest = S, id = _);
| ^ the trait `rocket::http::uri::Ignorable<rocket::http::uri::Query>` is not implemented for `usize`
42 | fn other_q(id: usize, rest: S) { }
| ^^^^^ the trait `rocket::http::uri::Ignorable<rocket::http::uri::Query>` is not implemented for `usize`
...
83 | uri!(other_q: rest = S, id = _);
| -------------------------------- in this macro invocation
|
= note: required by `rocket::http::uri::assert_ignorable`
::: $ROCKET/core/http/src/uri/uri_display.rs:467:40
|
467 | pub fn assert_ignorable<P: UriPart, T: Ignorable<P>>() { }
| ------------ required by this bound in `rocket::http::uri::assert_ignorable`
error[E0277]: the trait bound `S: rocket::http::uri::FromUriParam<rocket::http::uri::Query, _>` is not satisfied
--> $DIR/typed-uri-bad-type.rs:81:26
--> $DIR/typed-uri-bad-type.rs:83:26
|
81 | uri!(other_q: rest = S, id = _);
83 | uri!(other_q: rest = S, id = _);
| ^ the trait `rocket::http::uri::FromUriParam<rocket::http::uri::Query, _>` is not implemented for `S`
error: aborting due to 13 previous errors

View File

@ -41,7 +41,8 @@ function ensure_tab_free() {
# Ensures there are no files with trailing whitespace.
function ensure_trailing_whitespace_free() {
local matches=$(git grep -E -I "\s+$" "${PROJECT_ROOT}")
# FIXME: Some .stderr files contain trailing spaces
local matches=$(git grep -E -I "\s+$" "${PROJECT_ROOT}" | grep -v -F '.stderr:')
if ! [ -z "${matches}" ]; then
echo "Trailing whitespace was found in the following:"
echo "${matches}"