From 08b34e8263f369c78c76bf5683828b019eae50ce Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Fri, 10 Jul 2020 05:30:25 -0700 Subject: [PATCH] Fix and re-enable UI tests. --- contrib/codegen/Cargo.toml | 2 +- core/codegen/Cargo.toml | 2 +- core/codegen/tests/ui-fail/async-entry.stderr | 10 +++--- .../tests/ui-fail/catch_type_errors.stderr | 31 +++++++++---------- .../tests/ui-fail/responder-types.stderr | 24 +++++++------- .../tests/ui-fail/route-type-errors.stderr | 4 --- 6 files changed, 33 insertions(+), 40 deletions(-) diff --git a/contrib/codegen/Cargo.toml b/contrib/codegen/Cargo.toml index c13ef388..b2f07c03 100644 --- a/contrib/codegen/Cargo.toml +++ b/contrib/codegen/Cargo.toml @@ -27,6 +27,6 @@ yansi = "0.5" version_check = "0.9.1" [dev-dependencies] -compiletest_rs = "0.4" +compiletest_rs = "0.5" rocket = { version = "0.5.0-dev", path = "../../core/lib" } rocket_contrib = { version = "0.5.0-dev", path = "../lib", features = ["diesel_sqlite_pool"] } diff --git a/core/codegen/Cargo.toml b/core/codegen/Cargo.toml index 6034434e..2079af82 100644 --- a/core/codegen/Cargo.toml +++ b/core/codegen/Cargo.toml @@ -29,4 +29,4 @@ version_check = "0.9.1" [dev-dependencies] rocket = { version = "0.5.0-dev", path = "../lib" } tokio = { version = "0.2.9", features = ["io-util"] } -compiletest_rs = { version = "0.3", features = ["stable"] } +compiletest_rs = "0.5" diff --git a/core/codegen/tests/ui-fail/async-entry.stderr b/core/codegen/tests/ui-fail/async-entry.stderr index a5eba8ac..c4c4bb06 100644 --- a/core/codegen/tests/ui-fail/async-entry.stderr +++ b/core/codegen/tests/ui-fail/async-entry.stderr @@ -117,13 +117,13 @@ error[E0308]: mismatched types --> $DIR/async-entry.rs:40:9 | 40 | rocket::ignite() - | ^^^^^^^^^^^^^^^^ expected struct `std::string::String`, found struct `rocket::rocket::Rocket` + | ^^^^^^^^^^^^^^^^ expected struct `std::string::String`, found struct `rocket::Rocket` error[E0308]: mismatched types --> $DIR/async-entry.rs:49:9 | 49 | "hi".to_string() - | ^^^^^^^^^^^^^^^^ expected struct `rocket::rocket::Rocket`, found struct `std::string::String` + | ^^^^^^^^^^^^^^^^ expected struct `rocket::Rocket`, found struct `std::string::String` error[E0308]: mismatched types --> $DIR/async-entry.rs:27:21 @@ -137,7 +137,7 @@ error[E0308]: mismatched types 30 | | } | | ^- help: try adding a semicolon: `;` | |_____| - | expected `()`, found struct `rocket::rocket::Rocket` + | expected `()`, found struct `rocket::Rocket` error[E0308]: mismatched types --> $DIR/async-entry.rs:37:26 @@ -145,10 +145,10 @@ error[E0308]: mismatched types 37 | async fn rocket() -> String { | ^^^^^^ | | - | expected struct `rocket::rocket::Rocket`, found struct `std::string::String` + | expected struct `rocket::Rocket`, found struct `std::string::String` | expected due to this -error[E0277]: `main` has invalid return type `rocket::rocket::Rocket` +error[E0277]: `main` has invalid return type `rocket::Rocket` --> $DIR/async-entry.rs:106:20 | 106 | async fn main() -> rocket::Rocket { diff --git a/core/codegen/tests/ui-fail/catch_type_errors.stderr b/core/codegen/tests/ui-fail/catch_type_errors.stderr index f91cb572..0dbb2039 100644 --- a/core/codegen/tests/ui-fail/catch_type_errors.stderr +++ b/core/codegen/tests/ui-fail/catch_type_errors.stderr @@ -1,16 +1,16 @@ -error[E0277]: the trait bound `usize: rocket::response::Responder<'_>` is not satisfied +error[E0277]: the trait bound `usize: rocket::response::Responder<'_, '_>` is not satisfied --> $DIR/catch_type_errors.rs:6:30 | 6 | fn f1(_request: &Request) -> usize { - | ^^^^^ the trait `rocket::response::Responder<'_>` is not implemented for `usize` + | ^^^^^ the trait `rocket::response::Responder<'_, '_>` is not implemented for `usize` | = note: required by `rocket::response::Responder::respond_to` -error[E0277]: the trait bound `bool: rocket::response::Responder<'_>` is not satisfied +error[E0277]: the trait bound `bool: rocket::response::Responder<'_, '_>` is not satisfied --> $DIR/catch_type_errors.rs:12:30 | 12 | fn f2(_request: &Request) -> bool { - | ^^^^ the trait `rocket::response::Responder<'_>` is not implemented for `bool` + | ^^^^ the trait `rocket::response::Responder<'_, '_>` is not implemented for `bool` | = note: required by `rocket::response::Responder::respond_to` @@ -18,26 +18,23 @@ error[E0308]: mismatched types --> $DIR/catch_type_errors.rs:17:1 | 17 | #[catch(404)] - | ^^^^^^^^^^^^^ expected bool, found reference + | ^^^^^^^^^^^^^ expected `bool`, found `&rocket::Request<'_>` | - = note: expected type `bool` - found type `&'_b rocket::Request<'_>` + = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: the trait bound `usize: rocket::response::Responder<'_>` is not satisfied - --> $DIR/catch_type_errors.rs:18:26 +error[E0277]: the trait bound `usize: rocket::response::Responder<'_, '_>` is not satisfied + --> $DIR/catch_type_errors.rs:19:26 | -17 | #[catch(404)] - | ------------- expected due to this -18 | fn f3(_request: bool) -> usize { - | ^^^^^ the trait `rocket::response::Responder<'_>` is not implemented for `usize` +19 | fn f3(_request: bool) -> usize { + | ^^^^^ the trait `rocket::response::Responder<'_, '_>` is not implemented for `usize` | = note: required by `rocket::response::Responder::respond_to` -error[E0277]: the trait bound `usize: rocket::response::Responder<'_>` is not satisfied - --> $DIR/catch_type_errors.rs:24:12 +error[E0277]: the trait bound `usize: rocket::response::Responder<'_, '_>` is not satisfied + --> $DIR/catch_type_errors.rs:25:12 | -24 | fn f4() -> usize { - | ^^^^^ the trait `rocket::response::Responder<'_>` is not implemented for `usize` +25 | fn f4() -> usize { + | ^^^^^ the trait `rocket::response::Responder<'_, '_>` is not implemented for `usize` | = note: required by `rocket::response::Responder::respond_to` diff --git a/core/codegen/tests/ui-fail/responder-types.stderr b/core/codegen/tests/ui-fail/responder-types.stderr index 8abaccf8..9e2ac6e3 100644 --- a/core/codegen/tests/ui-fail/responder-types.stderr +++ b/core/codegen/tests/ui-fail/responder-types.stderr @@ -1,16 +1,8 @@ -error[E0277]: the trait bound `usize: rocket::response::Responder<'_>` is not satisfied - --> $DIR/responder-types.rs:38:13 - | -38 | fn foo() -> usize { 0 } - | ^^^^^ the trait `rocket::response::Responder<'_>` is not implemented for `usize` - | - = note: required by `rocket::handler::, rocket::http::Status, rocket::Data>>::from` - -error[E0277]: the trait bound `u8: rocket::response::Responder<'_>` is not satisfied +error[E0277]: the trait bound `u8: rocket::response::Responder<'_, '_>` is not satisfied --> $DIR/responder-types.rs:11:5 | 11 | thing: u8, - | ^^^^^^^^^ the trait `rocket::response::Responder<'_>` is not implemented for `u8` + | ^^^^^^^^^ the trait `rocket::response::Responder<'_, '_>` is not implemented for `u8` | = note: required by `rocket::response::Responder::respond_to` @@ -25,11 +17,11 @@ error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From` rocket::http::Header<'static> as $TRAIT = note: required because of the requirements on the impl of `std::convert::Into>` for `u8` -error[E0277]: the trait bound `u8: rocket::response::Responder<'_>` is not satisfied +error[E0277]: the trait bound `u8: rocket::response::Responder<'_, '_>` is not satisfied --> $DIR/responder-types.rs:24:5 | 24 | thing: u8, - | ^^^^^^^^^ the trait `rocket::response::Responder<'_>` is not implemented for `u8` + | ^^^^^^^^^ the trait `rocket::response::Responder<'_, '_>` is not implemented for `u8` | = note: required by `rocket::response::Responder::respond_to` @@ -55,6 +47,14 @@ error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From as $TRAIT = note: required because of the requirements on the impl of `std::convert::Into>` for `std::string::String` +error[E0277]: the trait bound `usize: rocket::response::Responder<'_, '_>` is not satisfied + --> $DIR/responder-types.rs:39:13 + | +39 | fn foo() -> usize { 0 } + | ^^^^^ the trait `rocket::response::Responder<'_, '_>` is not implemented for `usize` + | + = note: required by `rocket::handler::, rocket::http::Status, rocket::Data>>::from` + error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/core/codegen/tests/ui-fail/route-type-errors.stderr b/core/codegen/tests/ui-fail/route-type-errors.stderr index fa2268c7..5466c67b 100644 --- a/core/codegen/tests/ui-fail/route-type-errors.stderr +++ b/core/codegen/tests/ui-fail/route-type-errors.stderr @@ -35,8 +35,6 @@ error[E0277]: the trait bound `Q: rocket::request::FromRequest<'_, '_>` is not s | 23 | fn f5(a: Q, foo: Q) {} | ^^^^ the trait `rocket::request::FromRequest<'_, '_>` is not implemented for `Q` - | - = note: required because of the requirements on the impl of `rocket::request::FromRequestAsync<'_, '_>` for `Q` error[E0277]: the trait bound `Q: rocket::request::FromParam<'_>` is not satisfied --> $DIR/route-type-errors.rs:23:13 @@ -49,8 +47,6 @@ error[E0277]: the trait bound `Q: rocket::request::FromRequest<'_, '_>` is not s | 28 | fn f6(a: Q, foo: Q, good: usize, bar: Q) {} | ^^^^ the trait `rocket::request::FromRequest<'_, '_>` is not implemented for `Q` - | - = note: required because of the requirements on the impl of `rocket::request::FromRequestAsync<'_, '_>` for `Q` error[E0277]: the trait bound `Q: rocket::request::FromParam<'_>` is not satisfied --> $DIR/route-type-errors.rs:28:13