From 185840320315a6803bf4e137b9372b5b0b44ba48 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Mon, 20 Jul 2020 15:02:10 -0700 Subject: [PATCH] Implement codegen testing on stable. This commits migrates to 'trybuild' from 'compiletest' for codegen diagnostic testing. --- contrib/codegen/Cargo.toml | 5 +- contrib/codegen/src/database.rs | 4 +- contrib/codegen/tests/compile-test.rs | 102 ---- .../tests/ui-fail-nightly/database-syntax.rs | 1 + .../database-syntax.stderr | 49 +- .../tests/ui-fail-nightly/database-types.rs | 1 + .../database-types.stderr | 4 - .../tests/ui-fail-stable/database-syntax.rs | 1 + .../ui-fail-stable/database-syntax.stderr | 56 ++ .../tests/ui-fail-stable/database-types.rs | 1 + .../ui-fail-stable/database-types.stderr | 11 + contrib/codegen/tests/ui-fail.rs | 10 + .../codegen/tests/ui-fail/database-syntax.rs | 1 + .../tests/ui-fail/update-references.sh | 48 -- core/codegen/Cargo.toml | 5 +- core/codegen/tests/compile-test.rs | 102 ---- .../tests/ui-fail-nightly/async-entry.rs | 1 + .../async-entry.stderr | 5 - core/codegen/tests/ui-fail-nightly/catch.rs | 1 + .../{ui-fail => ui-fail-nightly}/catch.stderr | 9 +- .../ui-fail-nightly/catch_type_errors.rs | 1 + .../catch_type_errors.stderr | 5 - .../codegen/tests/ui-fail-nightly/catchers.rs | 1 + .../catchers.stderr | 3 - .../tests/ui-fail-nightly/from_form.rs | 1 + .../from_form.stderr | 3 - .../ui-fail-nightly/from_form_type_errors.rs | 1 + .../from_form_type_errors.stderr | 4 - .../tests/ui-fail-nightly/from_form_value.rs | 1 + .../from_form_value.stderr | 3 - .../tests/ui-fail-nightly/responder-types.rs | 1 + .../responder-types.stderr | 16 +- .../responder.stderr | 0 .../route-attribute-general-syntax.rs | 1 + .../route-attribute-general-syntax.stderr | 3 - .../ui-fail-nightly/route-path-bad-syntax.rs | 1 + .../route-path-bad-syntax.stderr | 3 - .../ui-fail-nightly/route-type-errors.rs | 1 + .../route-type-errors.stderr | 4 - .../tests/ui-fail-nightly/route-warnings.rs | 1 + .../route-warnings.stderr | 7 +- core/codegen/tests/ui-fail-nightly/routes.rs | 1 + .../routes.stderr | 3 - .../ui-fail-nightly/typed-uri-bad-type.rs | 1 + .../typed-uri-bad-type.stderr | 58 +-- .../ui-fail-nightly/typed-uris-bad-params.rs | 1 + .../typed-uris-bad-params.stderr | 9 +- .../typed-uris-invalid-syntax.rs | 1 + .../typed-uris-invalid-syntax.stderr | 3 - .../ui-fail-nightly/update-references.sh | 1 + .../tests/ui-fail-nightly/uri_display.rs | 1 + .../uri_display.stderr | 108 ++-- .../uri_display_type_errors.rs | 1 + .../uri_display_type_errors.stderr | 4 - .../tests/ui-fail-stable/async-entry.rs | 1 + .../tests/ui-fail-stable/async-entry.stderr | 165 ++++++ core/codegen/tests/ui-fail-stable/catch.rs | 1 + .../codegen/tests/ui-fail-stable/catch.stderr | 70 +++ .../tests/ui-fail-stable/catch_type_errors.rs | 1 + .../ui-fail-stable/catch_type_errors.stderr | 37 ++ core/codegen/tests/ui-fail-stable/catchers.rs | 1 + .../tests/ui-fail-stable/catchers.stderr | 19 + .../codegen/tests/ui-fail-stable/from_form.rs | 1 + .../tests/ui-fail-stable/from_form.stderr | 354 +++++++++++++ .../ui-fail-stable/from_form_type_errors.rs | 1 + .../from_form_type_errors.stderr | 11 + .../tests/ui-fail-stable/from_form_value.rs | 1 + .../ui-fail-stable/from_form_value.stderr | 111 ++++ .../tests/ui-fail-stable/responder-types.rs | 1 + .../ui-fail-stable/responder-types.stderr | 56 ++ .../route-attribute-general-syntax.rs | 1 + .../route-attribute-general-syntax.stderr | 206 ++++++++ .../ui-fail-stable/route-path-bad-syntax.rs | 1 + .../route-path-bad-syntax.stderr | 230 ++++++++ .../tests/ui-fail-stable/route-type-errors.rs | 1 + .../ui-fail-stable/route-type-errors.stderr | 67 +++ .../tests/ui-fail-stable/route-warnings.rs | 1 + .../ui-fail-stable/route-warnings.stderr | 5 + core/codegen/tests/ui-fail-stable/routes.rs | 1 + .../tests/ui-fail-stable/routes.stderr | 19 + .../ui-fail-stable/typed-uri-bad-type.rs | 1 + .../ui-fail-stable/typed-uri-bad-type.stderr | 141 +++++ .../ui-fail-stable/typed-uris-bad-params.rs | 1 + .../typed-uris-bad-params.stderr | 313 +++++++++++ .../typed-uris-invalid-syntax.rs | 1 + .../typed-uris-invalid-syntax.stderr | 65 +++ .../tests/ui-fail-stable/update-references.sh | 1 + .../tests/ui-fail-stable/uri_display.rs | 1 + .../tests/ui-fail-stable/uri_display.stderr | 493 ++++++++++++++++++ .../ui-fail-stable/uri_display_type_errors.rs | 1 + .../uri_display_type_errors.stderr | 58 +++ core/codegen/tests/ui-fail.rs | 10 + core/codegen/tests/ui-fail/route-warnings.rs | 4 +- .../tests/ui-fail/update-references.sh | 48 -- 94 files changed, 2687 insertions(+), 484 deletions(-) delete mode 100644 contrib/codegen/tests/compile-test.rs create mode 120000 contrib/codegen/tests/ui-fail-nightly/database-syntax.rs rename contrib/codegen/tests/{ui-fail => ui-fail-nightly}/database-syntax.stderr (53%) create mode 120000 contrib/codegen/tests/ui-fail-nightly/database-types.rs rename contrib/codegen/tests/{ui-fail => ui-fail-nightly}/database-types.stderr (83%) create mode 120000 contrib/codegen/tests/ui-fail-stable/database-syntax.rs create mode 100644 contrib/codegen/tests/ui-fail-stable/database-syntax.stderr create mode 120000 contrib/codegen/tests/ui-fail-stable/database-types.rs create mode 100644 contrib/codegen/tests/ui-fail-stable/database-types.stderr create mode 100644 contrib/codegen/tests/ui-fail.rs delete mode 100755 contrib/codegen/tests/ui-fail/update-references.sh delete mode 100644 core/codegen/tests/compile-test.rs create mode 120000 core/codegen/tests/ui-fail-nightly/async-entry.rs rename core/codegen/tests/{ui-fail => ui-fail-nightly}/async-entry.stderr (96%) create mode 120000 core/codegen/tests/ui-fail-nightly/catch.rs rename core/codegen/tests/{ui-fail => ui-fail-nightly}/catch.stderr (92%) create mode 120000 core/codegen/tests/ui-fail-nightly/catch_type_errors.rs rename core/codegen/tests/{ui-fail => ui-fail-nightly}/catch_type_errors.stderr (90%) create mode 120000 core/codegen/tests/ui-fail-nightly/catchers.rs rename core/codegen/tests/{ui-fail => ui-fail-nightly}/catchers.stderr (93%) create mode 120000 core/codegen/tests/ui-fail-nightly/from_form.rs rename core/codegen/tests/{ui-fail => ui-fail-nightly}/from_form.stderr (99%) create mode 120000 core/codegen/tests/ui-fail-nightly/from_form_type_errors.rs rename core/codegen/tests/{ui-fail => ui-fail-nightly}/from_form_type_errors.stderr (83%) create mode 120000 core/codegen/tests/ui-fail-nightly/from_form_value.rs rename core/codegen/tests/{ui-fail => ui-fail-nightly}/from_form_value.stderr (98%) create mode 120000 core/codegen/tests/ui-fail-nightly/responder-types.rs rename core/codegen/tests/{ui-fail => ui-fail-nightly}/responder-types.stderr (81%) rename core/codegen/tests/{ui-fail => ui-fail-nightly}/responder.stderr (100%) create mode 120000 core/codegen/tests/ui-fail-nightly/route-attribute-general-syntax.rs rename core/codegen/tests/{ui-fail => ui-fail-nightly}/route-attribute-general-syntax.stderr (99%) create mode 120000 core/codegen/tests/ui-fail-nightly/route-path-bad-syntax.rs rename core/codegen/tests/{ui-fail => ui-fail-nightly}/route-path-bad-syntax.stderr (99%) create mode 120000 core/codegen/tests/ui-fail-nightly/route-type-errors.rs rename core/codegen/tests/{ui-fail => ui-fail-nightly}/route-type-errors.stderr (96%) create mode 120000 core/codegen/tests/ui-fail-nightly/route-warnings.rs rename core/codegen/tests/{ui-fail => ui-fail-nightly}/route-warnings.stderr (91%) create mode 120000 core/codegen/tests/ui-fail-nightly/routes.rs rename core/codegen/tests/{ui-fail => ui-fail-nightly}/routes.stderr (92%) create mode 120000 core/codegen/tests/ui-fail-nightly/typed-uri-bad-type.rs rename core/codegen/tests/{ui-fail => ui-fail-nightly}/typed-uri-bad-type.stderr (78%) create mode 120000 core/codegen/tests/ui-fail-nightly/typed-uris-bad-params.rs rename core/codegen/tests/{ui-fail => ui-fail-nightly}/typed-uris-bad-params.stderr (98%) create mode 120000 core/codegen/tests/ui-fail-nightly/typed-uris-invalid-syntax.rs rename core/codegen/tests/{ui-fail => ui-fail-nightly}/typed-uris-invalid-syntax.stderr (98%) create mode 120000 core/codegen/tests/ui-fail-nightly/update-references.sh create mode 120000 core/codegen/tests/ui-fail-nightly/uri_display.rs rename core/codegen/tests/{ui-fail => ui-fail-nightly}/uri_display.stderr (92%) create mode 120000 core/codegen/tests/ui-fail-nightly/uri_display_type_errors.rs rename core/codegen/tests/{ui-fail => ui-fail-nightly}/uri_display_type_errors.stderr (97%) create mode 120000 core/codegen/tests/ui-fail-stable/async-entry.rs create mode 100644 core/codegen/tests/ui-fail-stable/async-entry.stderr create mode 120000 core/codegen/tests/ui-fail-stable/catch.rs create mode 100644 core/codegen/tests/ui-fail-stable/catch.stderr create mode 120000 core/codegen/tests/ui-fail-stable/catch_type_errors.rs create mode 100644 core/codegen/tests/ui-fail-stable/catch_type_errors.stderr create mode 120000 core/codegen/tests/ui-fail-stable/catchers.rs create mode 100644 core/codegen/tests/ui-fail-stable/catchers.stderr create mode 120000 core/codegen/tests/ui-fail-stable/from_form.rs create mode 100644 core/codegen/tests/ui-fail-stable/from_form.stderr create mode 120000 core/codegen/tests/ui-fail-stable/from_form_type_errors.rs create mode 100644 core/codegen/tests/ui-fail-stable/from_form_type_errors.stderr create mode 120000 core/codegen/tests/ui-fail-stable/from_form_value.rs create mode 100644 core/codegen/tests/ui-fail-stable/from_form_value.stderr create mode 120000 core/codegen/tests/ui-fail-stable/responder-types.rs create mode 100644 core/codegen/tests/ui-fail-stable/responder-types.stderr create mode 120000 core/codegen/tests/ui-fail-stable/route-attribute-general-syntax.rs create mode 100644 core/codegen/tests/ui-fail-stable/route-attribute-general-syntax.stderr create mode 120000 core/codegen/tests/ui-fail-stable/route-path-bad-syntax.rs create mode 100644 core/codegen/tests/ui-fail-stable/route-path-bad-syntax.stderr create mode 120000 core/codegen/tests/ui-fail-stable/route-type-errors.rs create mode 100644 core/codegen/tests/ui-fail-stable/route-type-errors.stderr create mode 120000 core/codegen/tests/ui-fail-stable/route-warnings.rs create mode 100644 core/codegen/tests/ui-fail-stable/route-warnings.stderr create mode 120000 core/codegen/tests/ui-fail-stable/routes.rs create mode 100644 core/codegen/tests/ui-fail-stable/routes.stderr create mode 120000 core/codegen/tests/ui-fail-stable/typed-uri-bad-type.rs create mode 100644 core/codegen/tests/ui-fail-stable/typed-uri-bad-type.stderr create mode 120000 core/codegen/tests/ui-fail-stable/typed-uris-bad-params.rs create mode 100644 core/codegen/tests/ui-fail-stable/typed-uris-bad-params.stderr create mode 120000 core/codegen/tests/ui-fail-stable/typed-uris-invalid-syntax.rs create mode 100644 core/codegen/tests/ui-fail-stable/typed-uris-invalid-syntax.stderr create mode 120000 core/codegen/tests/ui-fail-stable/update-references.sh create mode 120000 core/codegen/tests/ui-fail-stable/uri_display.rs create mode 100644 core/codegen/tests/ui-fail-stable/uri_display.stderr create mode 120000 core/codegen/tests/ui-fail-stable/uri_display_type_errors.rs create mode 100644 core/codegen/tests/ui-fail-stable/uri_display_type_errors.stderr create mode 100644 core/codegen/tests/ui-fail.rs delete mode 100755 core/codegen/tests/ui-fail/update-references.sh diff --git a/contrib/codegen/Cargo.toml b/contrib/codegen/Cargo.toml index 4e9f0f5d..3fa48e10 100644 --- a/contrib/codegen/Cargo.toml +++ b/contrib/codegen/Cargo.toml @@ -20,13 +20,14 @@ proc-macro = true [dependencies] quote = "1.0" -devise = { git = "https://github.com/SergioBenitez/Devise.git", rev = "952866f" } +devise = { git = "https://github.com/SergioBenitez/Devise.git", rev = "952866f7" } [build-dependencies] yansi = "0.5" version_check = "0.9.1" [dev-dependencies] -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"] } +trybuild = "1.0" +version_check = "0.9" diff --git a/contrib/codegen/src/database.rs b/contrib/codegen/src/database.rs index 6cad8adc..0ebfd761 100644 --- a/contrib/codegen/src/database.rs +++ b/contrib/codegen/src/database.rs @@ -26,9 +26,7 @@ const NO_GENERIC_STRUCTS: &str = "`database` attribute cannot be applied to stru fn parse_invocation(attr: TokenStream, input: TokenStream) -> Result { let attr_stream2 = crate::proc_macro2::TokenStream::from(attr); - let attr_span = attr_stream2.span(); - let string_lit = crate::syn::parse2::(attr_stream2) - .map_err(|_| attr_span.error("expected string literal"))?; + let string_lit = crate::syn::parse2::(attr_stream2)?; let input = crate::syn::parse::(input).unwrap(); if !input.generics.params.is_empty() { diff --git a/contrib/codegen/tests/compile-test.rs b/contrib/codegen/tests/compile-test.rs deleted file mode 100644 index d0d9cfda..00000000 --- a/contrib/codegen/tests/compile-test.rs +++ /dev/null @@ -1,102 +0,0 @@ -extern crate compiletest_rs as compiletest; - -use std::path::{Path, PathBuf}; -use std::{io, fs::Metadata, time::SystemTime}; - -#[derive(Copy, Clone)] -enum Kind { - #[allow(dead_code)] - Dynamic, - Static -} - -impl Kind { - fn extension(self) -> &'static str { - match self { - #[cfg(windows)] Kind::Dynamic => ".dll", - #[cfg(all(unix, target_os = "macos"))] Kind::Dynamic => ".dylib", - #[cfg(all(unix, not(target_os = "macos")))] Kind::Dynamic => ".so", - Kind::Static => ".rlib" - } - } -} - -fn target_path() -> PathBuf { - #[cfg(debug_assertions)] const ENVIRONMENT: &str = "debug"; - #[cfg(not(debug_assertions))] const ENVIRONMENT: &str = "release"; - - Path::new(env!("CARGO_MANIFEST_DIR")) - .parent().unwrap().parent().unwrap() - .join("target") - .join(ENVIRONMENT) -} - -fn link_flag(flag: &str, lib: &str, rel_path: &[&str]) -> String { - let mut path = target_path(); - for component in rel_path { - path = path.join(component); - } - - format!("{} {}={}", flag, lib, path.display()) -} - -fn best_time_for(metadata: &Metadata) -> SystemTime { - metadata.created() - .or_else(|_| metadata.modified()) - .or_else(|_| metadata.accessed()) - .unwrap_or_else(|_| SystemTime::now()) -} - -fn extern_dep(name: &str, kind: Kind) -> io::Result { - let deps_root = target_path().join("deps"); - let dep_name = format!("lib{}", name); - - let mut dep_path: Option = None; - for entry in deps_root.read_dir().expect("read_dir call failed") { - let entry = match entry { - Ok(entry) => entry, - Err(_) => continue - }; - - let filename = entry.file_name(); - let filename = filename.to_string_lossy(); - let lib_name = filename.split('.').next().unwrap().split('-').next().unwrap(); - - if lib_name == dep_name && filename.ends_with(kind.extension()) { - if let Some(ref mut existing) = dep_path { - if best_time_for(&entry.metadata()?) > best_time_for(&existing.metadata()?) { - *existing = entry.path().into(); - } - } else { - dep_path = Some(entry.path().into()); - } - } - } - - let dep = dep_path.ok_or_else(|| io::Error::from(io::ErrorKind::NotFound))?; - let filename = dep.file_name().ok_or_else(|| io::Error::from(io::ErrorKind::InvalidData))?; - Ok(link_flag("--extern", name, &["deps", &filename.to_string_lossy()])) -} - -fn run_mode(mode: &'static str, path: &'static str) { - let mut config = compiletest::Config::default(); - config.mode = mode.parse().expect("invalid mode"); - config.src_base = format!("tests/{}", path).into(); - config.clean_rmeta(); - - config.target_rustcflags = Some([ - link_flag("-L", "crate", &[]), - link_flag("-L", "dependency", &["deps"]), - extern_dep("rocket_http", Kind::Static).expect("find http dep"), - extern_dep("rocket", Kind::Static).expect("find core dep"), - extern_dep("rocket_contrib", Kind::Static).expect("find contrib dep"), - ].join(" ")); - - compiletest::run_tests(&config); -} - -#[test] -fn compile_test() { - run_mode("ui", "ui-fail"); - run_mode("compile-fail", "ui-fail"); -} diff --git a/contrib/codegen/tests/ui-fail-nightly/database-syntax.rs b/contrib/codegen/tests/ui-fail-nightly/database-syntax.rs new file mode 120000 index 00000000..717e99bd --- /dev/null +++ b/contrib/codegen/tests/ui-fail-nightly/database-syntax.rs @@ -0,0 +1 @@ +../ui-fail/database-syntax.rs \ No newline at end of file diff --git a/contrib/codegen/tests/ui-fail/database-syntax.stderr b/contrib/codegen/tests/ui-fail-nightly/database-syntax.stderr similarity index 53% rename from contrib/codegen/tests/ui-fail/database-syntax.stderr rename to contrib/codegen/tests/ui-fail-nightly/database-syntax.stderr index 90bbb6ba..53260419 100644 --- a/contrib/codegen/tests/ui-fail/database-syntax.stderr +++ b/contrib/codegen/tests/ui-fail-nightly/database-syntax.stderr @@ -1,60 +1,57 @@ -error: expected string literal - --> $DIR/database-syntax.rs:5:1 +error: unexpected end of input, expected literal + --> $DIR/database-syntax.rs:6:1 | -5 | #[database] +6 | #[database] | ^^^^^^^^^^^ | = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) error: expected string literal - --> $DIR/database-syntax.rs:9:12 - | -9 | #[database(1)] - | ^ + --> $DIR/database-syntax.rs:10:12 + | +10 | #[database(1)] + | ^ error: expected string literal - --> $DIR/database-syntax.rs:13:12 + --> $DIR/database-syntax.rs:14:12 | -13 | #[database(123)] +14 | #[database(123)] | ^^^ -error: expected string literal - --> $DIR/database-syntax.rs:17:12 +error: unexpected token + --> $DIR/database-syntax.rs:18:20 | -17 | #[database("hello" "hi")] - | ^^^^^^^^^^^^ +18 | #[database("hello" "hi")] + | ^^^^ error: `database` attribute can only be used on structs - --> $DIR/database-syntax.rs:22:1 + --> $DIR/database-syntax.rs:23:1 | -22 | enum Foo { } +23 | enum Foo { } | ^^^^^^^^^^^^^ error: `database` attribute can only be applied to structs with exactly one unnamed field - --> $DIR/database-syntax.rs:26:11 + --> $DIR/database-syntax.rs:27:11 | -26 | struct Bar(diesel::SqliteConnection, diesel::SqliteConnection); +27 | struct Bar(diesel::SqliteConnection, diesel::SqliteConnection); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: example: `struct MyDatabase(diesel::SqliteConnection);` error: `database` attribute can only be used on structs - --> $DIR/database-syntax.rs:30:1 + --> $DIR/database-syntax.rs:31:1 | -30 | union Baz { } +31 | union Baz { } | ^^^^^^^^^^^^^^ error: `database` attribute cannot be applied to structs with generics - --> $DIR/database-syntax.rs:34:9 + --> $DIR/database-syntax.rs:35:9 | -34 | struct E<'r>(&'r str); +35 | struct E<'r>(&'r str); | ^^^^ error: `database` attribute cannot be applied to structs with generics - --> $DIR/database-syntax.rs:38:9 + --> $DIR/database-syntax.rs:39:9 | -38 | struct F(T); +39 | struct F(T); | ^^^ - -error: aborting due to 9 previous errors - diff --git a/contrib/codegen/tests/ui-fail-nightly/database-types.rs b/contrib/codegen/tests/ui-fail-nightly/database-types.rs new file mode 120000 index 00000000..98c58fba --- /dev/null +++ b/contrib/codegen/tests/ui-fail-nightly/database-types.rs @@ -0,0 +1 @@ +../ui-fail/database-types.rs \ No newline at end of file diff --git a/contrib/codegen/tests/ui-fail/database-types.stderr b/contrib/codegen/tests/ui-fail-nightly/database-types.stderr similarity index 83% rename from contrib/codegen/tests/ui-fail/database-types.stderr rename to contrib/codegen/tests/ui-fail-nightly/database-types.stderr index 29c55825..10c9ae24 100644 --- a/contrib/codegen/tests/ui-fail/database-types.stderr +++ b/contrib/codegen/tests/ui-fail-nightly/database-types.stderr @@ -9,7 +9,3 @@ error[E0277]: the trait bound `std::vec::Vec: rocket_contrib::databases::Po | 11 | struct B(Vec); | ^^^^^^^^ the trait `rocket_contrib::databases::Poolable` is not implemented for `std::vec::Vec` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/contrib/codegen/tests/ui-fail-stable/database-syntax.rs b/contrib/codegen/tests/ui-fail-stable/database-syntax.rs new file mode 120000 index 00000000..717e99bd --- /dev/null +++ b/contrib/codegen/tests/ui-fail-stable/database-syntax.rs @@ -0,0 +1 @@ +../ui-fail/database-syntax.rs \ No newline at end of file diff --git a/contrib/codegen/tests/ui-fail-stable/database-syntax.stderr b/contrib/codegen/tests/ui-fail-stable/database-syntax.stderr new file mode 100644 index 00000000..3a45ed79 --- /dev/null +++ b/contrib/codegen/tests/ui-fail-stable/database-syntax.stderr @@ -0,0 +1,56 @@ +error: unexpected end of input, expected literal + --> $DIR/database-syntax.rs:6:1 + | +6 | #[database] + | ^^^^^^^^^^^ + | + = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected string literal + --> $DIR/database-syntax.rs:10:12 + | +10 | #[database(1)] + | ^ + +error: expected string literal + --> $DIR/database-syntax.rs:14:12 + | +14 | #[database(123)] + | ^^^ + +error: unexpected token + --> $DIR/database-syntax.rs:18:20 + | +18 | #[database("hello" "hi")] + | ^^^^ + +error: `database` attribute can only be used on structs + --> $DIR/database-syntax.rs:23:1 + | +23 | enum Foo { } + | ^^^^ + +error: `database` attribute can only be applied to structs with exactly one unnamed field + --- help: example: `struct MyDatabase(diesel::SqliteConnection);` + --> $DIR/database-syntax.rs:27:11 + | +27 | struct Bar(diesel::SqliteConnection, diesel::SqliteConnection); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: `database` attribute can only be used on structs + --> $DIR/database-syntax.rs:31:1 + | +31 | union Baz { } + | ^^^^^ + +error: `database` attribute cannot be applied to structs with generics + --> $DIR/database-syntax.rs:35:9 + | +35 | struct E<'r>(&'r str); + | ^ + +error: `database` attribute cannot be applied to structs with generics + --> $DIR/database-syntax.rs:39:9 + | +39 | struct F(T); + | ^ diff --git a/contrib/codegen/tests/ui-fail-stable/database-types.rs b/contrib/codegen/tests/ui-fail-stable/database-types.rs new file mode 120000 index 00000000..98c58fba --- /dev/null +++ b/contrib/codegen/tests/ui-fail-stable/database-types.rs @@ -0,0 +1 @@ +../ui-fail/database-types.rs \ No newline at end of file diff --git a/contrib/codegen/tests/ui-fail-stable/database-types.stderr b/contrib/codegen/tests/ui-fail-stable/database-types.stderr new file mode 100644 index 00000000..cae26974 --- /dev/null +++ b/contrib/codegen/tests/ui-fail-stable/database-types.stderr @@ -0,0 +1,11 @@ +error[E0277]: the trait bound `Unknown: rocket_contrib::databases::Poolable` is not satisfied + --> $DIR/database-types.rs:7:10 + | +7 | struct A(Unknown); + | ^^^^^^^ the trait `rocket_contrib::databases::Poolable` is not implemented for `Unknown` + +error[E0277]: the trait bound `std::vec::Vec: rocket_contrib::databases::Poolable` is not satisfied + --> $DIR/database-types.rs:11:10 + | +11 | struct B(Vec); + | ^^^ the trait `rocket_contrib::databases::Poolable` is not implemented for `std::vec::Vec` diff --git a/contrib/codegen/tests/ui-fail.rs b/contrib/codegen/tests/ui-fail.rs new file mode 100644 index 00000000..1cd5552a --- /dev/null +++ b/contrib/codegen/tests/ui-fail.rs @@ -0,0 +1,10 @@ +#[test] +fn ui() { + let path = match version_check::is_feature_flaggable() { + Some(true) => "ui-fail-nightly", + _ => "ui-fail-stable" + }; + + let t = trybuild::TestCases::new(); + t.compile_fail(format!("tests/{}/*.rs", path)); +} diff --git a/contrib/codegen/tests/ui-fail/database-syntax.rs b/contrib/codegen/tests/ui-fail/database-syntax.rs index 39b164a8..8d7e2123 100644 --- a/contrib/codegen/tests/ui-fail/database-syntax.rs +++ b/contrib/codegen/tests/ui-fail/database-syntax.rs @@ -1,5 +1,6 @@ #[macro_use] extern crate rocket_contrib; +#[allow(unused_imports)] use rocket_contrib::databases::diesel; #[database] diff --git a/contrib/codegen/tests/ui-fail/update-references.sh b/contrib/codegen/tests/ui-fail/update-references.sh deleted file mode 100755 index da17d7fa..00000000 --- a/contrib/codegen/tests/ui-fail/update-references.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright 2015 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -# A script to update the references for particular tests. The idea is -# that you do a run, which will generate files in the build directory -# containing the (normalized) actual output of the compiler. This -# script will then copy that output and replace the "expected output" -# files. You can then commit the changes. -# -# If you find yourself manually editing a foo.stderr file, you're -# doing it wrong. - -if [[ "$1" == "--help" || "$1" == "-h" || "$1" == "" || "$2" == "" ]]; then - echo "usage: $0 " - echo "" - echo "For example:" - echo " $0 ../../../build/x86_64-apple-darwin/test/ui *.rs */*.rs" -fi - -MYDIR=$(dirname $0) - -BUILD_DIR="$1" -shift - -shopt -s nullglob - -while [[ "$1" != "" ]]; do - for EXT in "stderr" "fixed"; do - for OUT_NAME in $BUILD_DIR/${1%.rs}.*$EXT; do - OUT_DIR=`dirname "$1"` - OUT_BASE=`basename "$OUT_NAME"` - if ! (diff $OUT_NAME $MYDIR/$OUT_DIR/$OUT_BASE >& /dev/null); then - echo updating $MYDIR/$OUT_DIR/$OUT_BASE - cp $OUT_NAME $MYDIR/$OUT_DIR - fi - done - done - shift -done diff --git a/core/codegen/Cargo.toml b/core/codegen/Cargo.toml index e93f0ce6..e32395a5 100644 --- a/core/codegen/Cargo.toml +++ b/core/codegen/Cargo.toml @@ -19,7 +19,7 @@ proc-macro = true indexmap = "1.0" quote = "1.0" rocket_http = { version = "0.5.0-dev", path = "../http/" } -devise = { git = "https://github.com/SergioBenitez/Devise.git", rev = "952866f" } +devise = { git = "https://github.com/SergioBenitez/Devise.git", rev = "952866f7" } glob = "0.3" [build-dependencies] @@ -28,4 +28,5 @@ version_check = "0.9.1" [dev-dependencies] rocket = { version = "0.5.0-dev", path = "../lib" } -compiletest_rs = "0.5" +version_check = "0.9" +trybuild = "1.0" diff --git a/core/codegen/tests/compile-test.rs b/core/codegen/tests/compile-test.rs deleted file mode 100644 index 816dc3e7..00000000 --- a/core/codegen/tests/compile-test.rs +++ /dev/null @@ -1,102 +0,0 @@ -extern crate compiletest_rs as compiletest; - -use std::path::{Path, PathBuf}; -use std::{io, fs::Metadata, time::SystemTime}; - -#[derive(Copy, Clone)] -enum Kind { - #[allow(dead_code)] - Dynamic, - Static -} - -impl Kind { - fn extension(self) -> &'static str { - match self { - #[cfg(windows)] Kind::Dynamic => ".dll", - #[cfg(all(unix, target_os = "macos"))] Kind::Dynamic => ".dylib", - #[cfg(all(unix, not(target_os = "macos")))] Kind::Dynamic => ".so", - Kind::Static => ".rlib" - } - } -} - -fn target_path() -> PathBuf { - #[cfg(debug_assertions)] const ENVIRONMENT: &str = "debug"; - #[cfg(not(debug_assertions))] const ENVIRONMENT: &str = "release"; - - Path::new(env!("CARGO_MANIFEST_DIR")) - .parent().unwrap().parent().unwrap() - .join("target") - .join(ENVIRONMENT) -} - -fn link_flag(flag: &str, lib: &str, rel_path: &[&str]) -> String { - let mut path = target_path(); - for component in rel_path { - path = path.join(component); - } - - format!("{} {}={}", flag, lib, path.display()) -} - -fn best_time_for(metadata: &Metadata) -> SystemTime { - metadata.created() - .or_else(|_| metadata.modified()) - .or_else(|_| metadata.accessed()) - .unwrap_or_else(|_| SystemTime::now()) -} - -fn extern_dep(name: &str, kind: Kind) -> io::Result { - let deps_root = target_path().join("deps"); - let dep_name = format!("lib{}", name); - - let mut dep_path: Option = None; - for entry in deps_root.read_dir().expect("read_dir call failed") { - let entry = match entry { - Ok(entry) => entry, - Err(_) => continue - }; - - let filename = entry.file_name(); - let filename = filename.to_string_lossy(); - let lib_name = filename.split('.').next().unwrap().split('-').next().unwrap(); - - if lib_name == dep_name && filename.ends_with(kind.extension()) { - if let Some(ref mut existing) = dep_path { - if best_time_for(&entry.metadata()?) > best_time_for(&existing.metadata()?) { - *existing = entry.path().into(); - } - } else { - dep_path = Some(entry.path().into()); - } - } - } - - let dep = dep_path.ok_or_else(|| io::Error::from(io::ErrorKind::NotFound))?; - let filename = dep.file_name().ok_or_else(|| io::Error::from(io::ErrorKind::InvalidData))?; - Ok(link_flag("--extern", name, &["deps", &filename.to_string_lossy()])) -} - -fn run_mode(mode: &'static str, path: &'static str) { - let mut config = compiletest::Config::default(); - config.mode = mode.parse().expect("invalid mode"); - config.src_base = format!("tests/{}", path).into(); - config.clean_rmeta(); - - config.target_rustcflags = Some([ - String::from("--edition=2018"), - link_flag("-L", "crate", &[]), - link_flag("-L", "dependency", &["deps"]), - extern_dep("rocket_http", Kind::Static).expect("find http dep"), - extern_dep("rocket", Kind::Static).expect("find core dep"), - ].join(" ")); - - compiletest::run_tests(&config); -} - -#[test] -fn compile_test() { - run_mode("ui", "ui-fail"); - run_mode("compile-fail", "ui-fail"); -} diff --git a/core/codegen/tests/ui-fail-nightly/async-entry.rs b/core/codegen/tests/ui-fail-nightly/async-entry.rs new file mode 120000 index 00000000..7df19d9a --- /dev/null +++ b/core/codegen/tests/ui-fail-nightly/async-entry.rs @@ -0,0 +1 @@ +../ui-fail/async-entry.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail/async-entry.stderr b/core/codegen/tests/ui-fail-nightly/async-entry.stderr similarity index 96% rename from core/codegen/tests/ui-fail/async-entry.stderr rename to core/codegen/tests/ui-fail-nightly/async-entry.stderr index c4c4bb06..6a2a4775 100644 --- a/core/codegen/tests/ui-fail/async-entry.stderr +++ b/core/codegen/tests/ui-fail-nightly/async-entry.stderr @@ -155,8 +155,3 @@ error[E0277]: `main` has invalid return type `rocket::Rocket` | ^^^^^^^^^^^^^^ `main` can only return types that implement `std::process::Termination` | = help: consider using `()`, or a `Result` - -error: aborting due to 13 previous errors; 1 warning emitted - -Some errors have detailed explanations: E0277, E0308, E0728. -For more information about an error, try `rustc --explain E0277`. diff --git a/core/codegen/tests/ui-fail-nightly/catch.rs b/core/codegen/tests/ui-fail-nightly/catch.rs new file mode 120000 index 00000000..055ab4b4 --- /dev/null +++ b/core/codegen/tests/ui-fail-nightly/catch.rs @@ -0,0 +1 @@ +../ui-fail/catch.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail/catch.stderr b/core/codegen/tests/ui-fail-nightly/catch.stderr similarity index 92% rename from core/codegen/tests/ui-fail/catch.stderr rename to core/codegen/tests/ui-fail-nightly/catch.stderr index fdae8a59..4e99155b 100644 --- a/core/codegen/tests/ui-fail/catch.stderr +++ b/core/codegen/tests/ui-fail-nightly/catch.stderr @@ -70,5 +70,10 @@ error: invalid number of arguments: must be zero or one | = help: catchers may optionally take an argument of type `&Request` -error: aborting due to 9 previous errors - +warning: unused import: `rocket::Request` + --> $DIR/catch.rs:3:5 + | +3 | use rocket::Request; + | ^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` on by default diff --git a/core/codegen/tests/ui-fail-nightly/catch_type_errors.rs b/core/codegen/tests/ui-fail-nightly/catch_type_errors.rs new file mode 120000 index 00000000..84a8fa1d --- /dev/null +++ b/core/codegen/tests/ui-fail-nightly/catch_type_errors.rs @@ -0,0 +1 @@ +../ui-fail/catch_type_errors.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail/catch_type_errors.stderr b/core/codegen/tests/ui-fail-nightly/catch_type_errors.stderr similarity index 90% rename from core/codegen/tests/ui-fail/catch_type_errors.stderr rename to core/codegen/tests/ui-fail-nightly/catch_type_errors.stderr index 774ae7bd..4e51feb5 100644 --- a/core/codegen/tests/ui-fail/catch_type_errors.stderr +++ b/core/codegen/tests/ui-fail-nightly/catch_type_errors.stderr @@ -35,8 +35,3 @@ error[E0277]: the trait bound `usize: rocket::response::Responder<'_, '_>` is no | ^^^^^ the trait `rocket::response::Responder<'_, '_>` is not implemented for `usize` | = note: required by `rocket::response::Responder::respond_to` - -error: aborting due to 5 previous errors - -Some errors have detailed explanations: E0277, E0308. -For more information about an error, try `rustc --explain E0277`. diff --git a/core/codegen/tests/ui-fail-nightly/catchers.rs b/core/codegen/tests/ui-fail-nightly/catchers.rs new file mode 120000 index 00000000..14bc8885 --- /dev/null +++ b/core/codegen/tests/ui-fail-nightly/catchers.rs @@ -0,0 +1 @@ +../ui-fail/catchers.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail/catchers.stderr b/core/codegen/tests/ui-fail-nightly/catchers.stderr similarity index 93% rename from core/codegen/tests/ui-fail/catchers.stderr rename to core/codegen/tests/ui-fail-nightly/catchers.stderr index 0e294c4f..388da528 100644 --- a/core/codegen/tests/ui-fail/catchers.stderr +++ b/core/codegen/tests/ui-fail-nightly/catchers.stderr @@ -17,6 +17,3 @@ error: unexpected end of input, expected identifier | ^^^^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 3 previous errors - diff --git a/core/codegen/tests/ui-fail-nightly/from_form.rs b/core/codegen/tests/ui-fail-nightly/from_form.rs new file mode 120000 index 00000000..67286534 --- /dev/null +++ b/core/codegen/tests/ui-fail-nightly/from_form.rs @@ -0,0 +1 @@ +../ui-fail/from_form.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail/from_form.stderr b/core/codegen/tests/ui-fail-nightly/from_form.stderr similarity index 99% rename from core/codegen/tests/ui-fail/from_form.stderr rename to core/codegen/tests/ui-fail-nightly/from_form.stderr index f81a4755..eef28aa3 100644 --- a/core/codegen/tests/ui-fail/from_form.stderr +++ b/core/codegen/tests/ui-fail-nightly/from_form.stderr @@ -325,6 +325,3 @@ note: error occurred while deriving `FromForm` 161 | #[derive(FromForm)] | ^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 24 previous errors - diff --git a/core/codegen/tests/ui-fail-nightly/from_form_type_errors.rs b/core/codegen/tests/ui-fail-nightly/from_form_type_errors.rs new file mode 120000 index 00000000..4a2abd28 --- /dev/null +++ b/core/codegen/tests/ui-fail-nightly/from_form_type_errors.rs @@ -0,0 +1 @@ +../ui-fail/from_form_type_errors.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail/from_form_type_errors.stderr b/core/codegen/tests/ui-fail-nightly/from_form_type_errors.stderr similarity index 83% rename from core/codegen/tests/ui-fail/from_form_type_errors.stderr rename to core/codegen/tests/ui-fail-nightly/from_form_type_errors.stderr index fe3d6123..bb938546 100644 --- a/core/codegen/tests/ui-fail/from_form_type_errors.stderr +++ b/core/codegen/tests/ui-fail-nightly/from_form_type_errors.stderr @@ -9,7 +9,3 @@ error[E0277]: the trait bound `Foo: rocket::request::FromFormValue<'_>` i | 15 | field: Foo, | ^^^^^^^^^^^^^^^^^ the trait `rocket::request::FromFormValue<'_>` is not implemented for `Foo` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/core/codegen/tests/ui-fail-nightly/from_form_value.rs b/core/codegen/tests/ui-fail-nightly/from_form_value.rs new file mode 120000 index 00000000..e48f57bb --- /dev/null +++ b/core/codegen/tests/ui-fail-nightly/from_form_value.rs @@ -0,0 +1 @@ +../ui-fail/from_form_value.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail/from_form_value.stderr b/core/codegen/tests/ui-fail-nightly/from_form_value.stderr similarity index 98% rename from core/codegen/tests/ui-fail/from_form_value.stderr rename to core/codegen/tests/ui-fail-nightly/from_form_value.stderr index d5fb24f9..cd9bfb04 100644 --- a/core/codegen/tests/ui-fail/from_form_value.stderr +++ b/core/codegen/tests/ui-fail-nightly/from_form_value.stderr @@ -104,6 +104,3 @@ note: error occurred while deriving `FromFormValue` 40 | #[derive(FromFormValue)] | ^^^^^^^^^^^^^ = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 8 previous errors - diff --git a/core/codegen/tests/ui-fail-nightly/responder-types.rs b/core/codegen/tests/ui-fail-nightly/responder-types.rs new file mode 120000 index 00000000..fa586f67 --- /dev/null +++ b/core/codegen/tests/ui-fail-nightly/responder-types.rs @@ -0,0 +1 @@ +../ui-fail/responder-types.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail/responder-types.stderr b/core/codegen/tests/ui-fail-nightly/responder-types.stderr similarity index 81% rename from core/codegen/tests/ui-fail/responder-types.stderr rename to core/codegen/tests/ui-fail-nightly/responder-types.stderr index 4cc5e3fb..6d292730 100644 --- a/core/codegen/tests/ui-fail/responder-types.stderr +++ b/core/codegen/tests/ui-fail-nightly/responder-types.stderr @@ -13,8 +13,8 @@ error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From` | ^^^^^^^^^ the trait `std::convert::From` is not implemented for `rocket::http::Header<'_>` | = help: the following implementations were found: - rocket::http::Header<'static> as $TRAIT - rocket::http::Header<'static> as $TRAIT + as std::convert::From<&rocket::http::Cookie<'_>>> + as std::convert::From>> = 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 @@ -32,8 +32,8 @@ error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From` | ^^^^^^^^^ the trait `std::convert::From` is not implemented for `rocket::http::Header<'_>` | = help: the following implementations were found: - rocket::http::Header<'static> as $TRAIT - rocket::http::Header<'static> as $TRAIT + as std::convert::From<&rocket::http::Cookie<'_>>> + as std::convert::From>> = note: required because of the requirements on the impl of `std::convert::Into>` for `u8` error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From` is not satisfied @@ -43,8 +43,8 @@ error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From` is not implemented for `rocket::http::Header<'_>` | = help: the following implementations were found: - rocket::http::Header<'static> as $TRAIT - rocket::http::Header<'static> as $TRAIT + as std::convert::From<&rocket::http::Cookie<'_>>> + as std::convert::From>> = 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 @@ -54,7 +54,3 @@ error[E0277]: the trait bound `usize: rocket::response::Responder<'_, '_>` is no | ^^^^^ 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/responder.stderr b/core/codegen/tests/ui-fail-nightly/responder.stderr similarity index 100% rename from core/codegen/tests/ui-fail/responder.stderr rename to core/codegen/tests/ui-fail-nightly/responder.stderr diff --git a/core/codegen/tests/ui-fail-nightly/route-attribute-general-syntax.rs b/core/codegen/tests/ui-fail-nightly/route-attribute-general-syntax.rs new file mode 120000 index 00000000..aadf3b31 --- /dev/null +++ b/core/codegen/tests/ui-fail-nightly/route-attribute-general-syntax.rs @@ -0,0 +1 @@ +../ui-fail/route-attribute-general-syntax.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail/route-attribute-general-syntax.stderr b/core/codegen/tests/ui-fail-nightly/route-attribute-general-syntax.stderr similarity index 99% rename from core/codegen/tests/ui-fail/route-attribute-general-syntax.stderr rename to core/codegen/tests/ui-fail-nightly/route-attribute-general-syntax.stderr index ca93f49f..f4ffde58 100644 --- a/core/codegen/tests/ui-fail/route-attribute-general-syntax.stderr +++ b/core/codegen/tests/ui-fail-nightly/route-attribute-general-syntax.stderr @@ -214,6 +214,3 @@ error: expected identifier, found integer literal | ^^^ | = help: method must be one of: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS` - -error: aborting due to 32 previous errors - diff --git a/core/codegen/tests/ui-fail-nightly/route-path-bad-syntax.rs b/core/codegen/tests/ui-fail-nightly/route-path-bad-syntax.rs new file mode 120000 index 00000000..8433a4e4 --- /dev/null +++ b/core/codegen/tests/ui-fail-nightly/route-path-bad-syntax.rs @@ -0,0 +1 @@ +../ui-fail/route-path-bad-syntax.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail/route-path-bad-syntax.stderr b/core/codegen/tests/ui-fail-nightly/route-path-bad-syntax.stderr similarity index 99% rename from core/codegen/tests/ui-fail/route-path-bad-syntax.stderr rename to core/codegen/tests/ui-fail-nightly/route-path-bad-syntax.stderr index c6114dfd..c0a6dcc2 100644 --- a/core/codegen/tests/ui-fail/route-path-bad-syntax.stderr +++ b/core/codegen/tests/ui-fail-nightly/route-path-bad-syntax.stderr @@ -261,6 +261,3 @@ error: malformed parameter or identifier | = help: parameters must be of the form '' = help: identifiers cannot contain '<' or '>' - -error: aborting due to 30 previous errors - diff --git a/core/codegen/tests/ui-fail-nightly/route-type-errors.rs b/core/codegen/tests/ui-fail-nightly/route-type-errors.rs new file mode 120000 index 00000000..78d87d74 --- /dev/null +++ b/core/codegen/tests/ui-fail-nightly/route-type-errors.rs @@ -0,0 +1 @@ +../ui-fail/route-type-errors.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail/route-type-errors.stderr b/core/codegen/tests/ui-fail-nightly/route-type-errors.stderr similarity index 96% rename from core/codegen/tests/ui-fail/route-type-errors.stderr rename to core/codegen/tests/ui-fail-nightly/route-type-errors.stderr index 58e360a5..958a61bd 100644 --- a/core/codegen/tests/ui-fail/route-type-errors.stderr +++ b/core/codegen/tests/ui-fail-nightly/route-type-errors.stderr @@ -59,7 +59,3 @@ error[E0277]: the trait bound `Q: rocket::request::FromParam<'_>` is not satisfi | 26 | fn f6(a: Q, foo: Q, good: usize, bar: Q) {} | ^^^^^^ the trait `rocket::request::FromParam<'_>` is not implemented for `Q` - -error: aborting due to 10 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/core/codegen/tests/ui-fail-nightly/route-warnings.rs b/core/codegen/tests/ui-fail-nightly/route-warnings.rs new file mode 120000 index 00000000..41489b6c --- /dev/null +++ b/core/codegen/tests/ui-fail-nightly/route-warnings.rs @@ -0,0 +1 @@ +../ui-fail/route-warnings.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail/route-warnings.stderr b/core/codegen/tests/ui-fail-nightly/route-warnings.stderr similarity index 91% rename from core/codegen/tests/ui-fail/route-warnings.stderr rename to core/codegen/tests/ui-fail-nightly/route-warnings.stderr index 7e415563..6e864351 100644 --- a/core/codegen/tests/ui-fail/route-warnings.stderr +++ b/core/codegen/tests/ui-fail-nightly/route-warnings.stderr @@ -42,5 +42,8 @@ note: 'HEAD' does not typically support payloads | ^^^^ = note: this warning originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) -warning: 5 warnings emitted - +error: checking for warnings! + --> $DIR/route-warnings.rs:25:5 + | +25 | compile_error!("checking for warnings!") + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/core/codegen/tests/ui-fail-nightly/routes.rs b/core/codegen/tests/ui-fail-nightly/routes.rs new file mode 120000 index 00000000..cf8c68b5 --- /dev/null +++ b/core/codegen/tests/ui-fail-nightly/routes.rs @@ -0,0 +1 @@ +../ui-fail/routes.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail/routes.stderr b/core/codegen/tests/ui-fail-nightly/routes.stderr similarity index 92% rename from core/codegen/tests/ui-fail/routes.stderr rename to core/codegen/tests/ui-fail-nightly/routes.stderr index 9ffd7f9c..cb39b641 100644 --- a/core/codegen/tests/ui-fail/routes.stderr +++ b/core/codegen/tests/ui-fail-nightly/routes.stderr @@ -17,6 +17,3 @@ error: unexpected end of input, expected identifier | ^^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 3 previous errors - diff --git a/core/codegen/tests/ui-fail-nightly/typed-uri-bad-type.rs b/core/codegen/tests/ui-fail-nightly/typed-uri-bad-type.rs new file mode 120000 index 00000000..ee45a56c --- /dev/null +++ b/core/codegen/tests/ui-fail-nightly/typed-uri-bad-type.rs @@ -0,0 +1 @@ +../ui-fail/typed-uri-bad-type.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail/typed-uri-bad-type.stderr b/core/codegen/tests/ui-fail-nightly/typed-uri-bad-type.stderr similarity index 78% rename from core/codegen/tests/ui-fail/typed-uri-bad-type.stderr rename to core/codegen/tests/ui-fail-nightly/typed-uri-bad-type.stderr index 9612d3c2..60176759 100644 --- a/core/codegen/tests/ui-fail/typed-uri-bad-type.stderr +++ b/core/codegen/tests/ui-fail-nightly/typed-uri-bad-type.stderr @@ -5,9 +5,9 @@ error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam` is not implemented for `usize` | = help: the following implementations were found: - usize as $TRAIT - usize as $TRAIT - usize as $TRAIT + > + > + > = note: required by `rocket::http::uri::FromUriParam::from_uri_param` error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam` is not satisfied @@ -17,9 +17,9 @@ error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam` is not implemented for `usize` | = help: the following implementations were found: - usize as $TRAIT - usize as $TRAIT - usize as $TRAIT + > + > + > = note: required by `rocket::http::uri::FromUriParam::from_uri_param` error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam` is not satisfied @@ -29,9 +29,9 @@ error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam` is not implemented for `usize` | = help: the following implementations were found: - usize as $TRAIT - usize as $TRAIT - usize as $TRAIT + > + > + > = note: required by `rocket::http::uri::FromUriParam::from_uri_param` error[E0277]: the trait bound `S: rocket::http::uri::FromUriParam` is not satisfied @@ -47,9 +47,9 @@ error[E0277]: the trait bound `i32: rocket::http::uri::FromUriParam>` is not implemented for `i32` | = help: the following implementations were found: - i32 as $TRAIT - i32 as $TRAIT - i32 as $TRAIT + > + > + > = note: required because of the requirements on the impl of `rocket::http::uri::FromUriParam>` for `std::option::Option` error[E0277]: the trait bound `std::string::String: rocket::http::uri::FromUriParam>` is not satisfied @@ -59,11 +59,11 @@ error[E0277]: the trait bound `std::string::String: rocket::http::uri::FromUriPa | ^^^^^^^^^^^^^^^^ the trait `rocket::http::uri::FromUriParam>` is not implemented for `std::string::String` | = help: the following implementations were found: - std::string::String as $TRAIT - std::string::String as $TRAIT - std::string::String as $TRAIT - std::string::String as $TRAIT - and $N others + > + > + > + > + and 2 others = note: required because of the requirements on the impl of `rocket::http::uri::FromUriParam>` for `std::result::Result` error[E0277]: the trait bound `isize: rocket::http::uri::FromUriParam` is not satisfied @@ -73,9 +73,9 @@ error[E0277]: the trait bound `isize: rocket::http::uri::FromUriParam` is not implemented for `isize` | = help: the following implementations were found: - isize as $TRAIT - isize as $TRAIT - isize as $TRAIT + > + > + > = note: required by `rocket::http::uri::FromUriParam::from_uri_param` error[E0277]: the trait bound `isize: rocket::http::uri::FromUriParam` is not satisfied @@ -85,9 +85,9 @@ error[E0277]: the trait bound `isize: rocket::http::uri::FromUriParam` is not implemented for `isize` | = help: the following implementations were found: - isize as $TRAIT - isize as $TRAIT - isize as $TRAIT + > + > + > = note: required by `rocket::http::uri::FromUriParam::from_uri_param` error[E0277]: the trait bound `S: rocket::http::uri::FromUriParam` is not satisfied @@ -110,8 +110,8 @@ error[E0277]: the trait bound `S: rocket::http::uri::Ignorable>() { } | ------------ required by this bound in `rocket::http::uri::assert_ignorable` @@ -126,8 +126,8 @@ error[E0277]: the trait bound `usize: rocket::http::uri::Ignorable>() { } | ------------ required by this bound in `rocket::http::uri::assert_ignorable` @@ -139,7 +139,3 @@ error[E0277]: the trait bound `S: rocket::http::uri::FromUriParam` is not implemented for `S` - -error: aborting due to 13 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/core/codegen/tests/ui-fail-nightly/typed-uris-bad-params.rs b/core/codegen/tests/ui-fail-nightly/typed-uris-bad-params.rs new file mode 120000 index 00000000..40288709 --- /dev/null +++ b/core/codegen/tests/ui-fail-nightly/typed-uris-bad-params.rs @@ -0,0 +1 @@ +../ui-fail/typed-uris-bad-params.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail/typed-uris-bad-params.stderr b/core/codegen/tests/ui-fail-nightly/typed-uris-bad-params.stderr similarity index 98% rename from core/codegen/tests/ui-fail/typed-uris-bad-params.stderr rename to core/codegen/tests/ui-fail-nightly/typed-uris-bad-params.stderr index ba3bdb50..72ef9ebb 100644 --- a/core/codegen/tests/ui-fail/typed-uris-bad-params.stderr +++ b/core/codegen/tests/ui-fail-nightly/typed-uris-bad-params.stderr @@ -237,5 +237,10 @@ error: `has_one` route uri expects 1 parameter but 0 were supplied | = note: expected parameter: id: i32 -error: aborting due to 21 previous errors - +warning: unused import: `std::fmt` + --> $DIR/typed-uris-bad-params.rs:3:5 + | +3 | use std::fmt; + | ^^^^^^^^ + | + = note: `#[warn(unused_imports)]` on by default diff --git a/core/codegen/tests/ui-fail-nightly/typed-uris-invalid-syntax.rs b/core/codegen/tests/ui-fail-nightly/typed-uris-invalid-syntax.rs new file mode 120000 index 00000000..f43a7bda --- /dev/null +++ b/core/codegen/tests/ui-fail-nightly/typed-uris-invalid-syntax.rs @@ -0,0 +1 @@ +../ui-fail/typed-uris-invalid-syntax.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail/typed-uris-invalid-syntax.stderr b/core/codegen/tests/ui-fail-nightly/typed-uris-invalid-syntax.stderr similarity index 98% rename from core/codegen/tests/ui-fail/typed-uris-invalid-syntax.stderr rename to core/codegen/tests/ui-fail-nightly/typed-uris-invalid-syntax.stderr index 035952af..843899d1 100644 --- a/core/codegen/tests/ui-fail/typed-uris-invalid-syntax.stderr +++ b/core/codegen/tests/ui-fail-nightly/typed-uris-invalid-syntax.stderr @@ -63,6 +63,3 @@ error: unexpected end of input, expected expression | ^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 10 previous errors - diff --git a/core/codegen/tests/ui-fail-nightly/update-references.sh b/core/codegen/tests/ui-fail-nightly/update-references.sh new file mode 120000 index 00000000..8b851748 --- /dev/null +++ b/core/codegen/tests/ui-fail-nightly/update-references.sh @@ -0,0 +1 @@ +../ui-fail/update-references.sh \ No newline at end of file diff --git a/core/codegen/tests/ui-fail-nightly/uri_display.rs b/core/codegen/tests/ui-fail-nightly/uri_display.rs new file mode 120000 index 00000000..62cfb002 --- /dev/null +++ b/core/codegen/tests/ui-fail-nightly/uri_display.rs @@ -0,0 +1 @@ +../ui-fail/uri_display.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail/uri_display.stderr b/core/codegen/tests/ui-fail-nightly/uri_display.stderr similarity index 92% rename from core/codegen/tests/ui-fail/uri_display.stderr rename to core/codegen/tests/ui-fail-nightly/uri_display.stderr index a6348be0..9f2b5466 100644 --- a/core/codegen/tests/ui-fail/uri_display.stderr +++ b/core/codegen/tests/ui-fail-nightly/uri_display.stderr @@ -136,8 +136,8 @@ error[E0277]: the trait bound `Foo1: rocket::http::uri::UriDisplay` is not implemented for `Foo1` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -149,8 +149,8 @@ error[E0277]: the trait bound `Foo1: rocket::http::uri::UriDisplay` is not implemented for `Foo1` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -163,8 +163,8 @@ error[E0277]: the trait bound `Foo1: rocket::http::uri::UriDisplay` is not implemented for `Foo1` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -177,8 +177,8 @@ error[E0277]: the trait bound `Foo2: rocket::http::uri::UriDisplay` is not implemented for `Foo2` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -190,8 +190,8 @@ error[E0277]: the trait bound `Foo2: rocket::http::uri::UriDisplay` is not implemented for `Foo2` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -204,8 +204,8 @@ error[E0277]: the trait bound `Foo2: rocket::http::uri::UriDisplay` is not implemented for `Foo2` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -218,8 +218,8 @@ error[E0277]: the trait bound `Foo3: rocket::http::uri::UriDisplay` is not implemented for `Foo3` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -231,8 +231,8 @@ error[E0277]: the trait bound `Foo3: rocket::http::uri::UriDisplay` is not implemented for `Foo3` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -245,8 +245,8 @@ error[E0277]: the trait bound `Foo3: rocket::http::uri::UriDisplay` is not implemented for `Foo3` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -259,8 +259,8 @@ error[E0277]: the trait bound `Foo4: rocket::http::uri::UriDisplay` is not implemented for `Foo4` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -272,8 +272,8 @@ error[E0277]: the trait bound `Foo4: rocket::http::uri::UriDisplay` is not implemented for `Foo4` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -286,8 +286,8 @@ error[E0277]: the trait bound `Foo4: rocket::http::uri::UriDisplay` is not implemented for `Foo4` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -300,8 +300,8 @@ error[E0277]: the trait bound `Foo5: rocket::http::uri::UriDisplay` is not implemented for `Foo5` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -313,8 +313,8 @@ error[E0277]: the trait bound `Foo5: rocket::http::uri::UriDisplay` is not implemented for `Foo5` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -327,8 +327,8 @@ error[E0277]: the trait bound `Foo5: rocket::http::uri::UriDisplay` is not implemented for `Foo5` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -341,8 +341,8 @@ error[E0277]: the trait bound `Foo6: rocket::http::uri::UriDisplay` is not implemented for `Foo6` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -354,8 +354,8 @@ error[E0277]: the trait bound `Foo6: rocket::http::uri::UriDisplay` is not implemented for `Foo6` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -368,8 +368,8 @@ error[E0277]: the trait bound `Foo6: rocket::http::uri::UriDisplay` is not implemented for `Foo6` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -382,8 +382,8 @@ error[E0277]: the trait bound `Foo7: rocket::http::uri::UriDisplay` is not implemented for `Foo7` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -395,8 +395,8 @@ error[E0277]: the trait bound `Foo7: rocket::http::uri::UriDisplay` is not implemented for `Foo7` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -409,8 +409,8 @@ error[E0277]: the trait bound `Foo8: rocket::http::uri::UriDisplay` is not implemented for `Foo8` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -422,8 +422,8 @@ error[E0277]: the trait bound `Foo8: rocket::http::uri::UriDisplay` is not implemented for `Foo8` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -436,8 +436,8 @@ error[E0277]: the trait bound `Foo9: rocket::http::uri::UriDisplay` is not implemented for `Foo9` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -449,8 +449,8 @@ error[E0277]: the trait bound `Foo9: rocket::http::uri::UriDisplay` is not implemented for `Foo9` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -463,8 +463,8 @@ error[E0277]: the trait bound `Foo10: rocket::http::uri::UriDisplay` is not implemented for `Foo10` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` @@ -476,15 +476,11 @@ error[E0277]: the trait bound `Foo10: rocket::http::uri::UriDisplay` is not implemented for `Foo10` - | - ::: $ROCKET/core/http/src/uri/from_uri_param.rs:195:18 + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 | 195 | type Target: UriDisplay

; | ------------- required by this bound in `rocket::http::uri::FromUriParam` | = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo10` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 36 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/core/codegen/tests/ui-fail-nightly/uri_display_type_errors.rs b/core/codegen/tests/ui-fail-nightly/uri_display_type_errors.rs new file mode 120000 index 00000000..d17ef8e5 --- /dev/null +++ b/core/codegen/tests/ui-fail-nightly/uri_display_type_errors.rs @@ -0,0 +1 @@ +../ui-fail/uri_display_type_errors.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail/uri_display_type_errors.stderr b/core/codegen/tests/ui-fail-nightly/uri_display_type_errors.stderr similarity index 97% rename from core/codegen/tests/ui-fail/uri_display_type_errors.stderr rename to core/codegen/tests/ui-fail-nightly/uri_display_type_errors.stderr index af6c53f9..559ae716 100644 --- a/core/codegen/tests/ui-fail/uri_display_type_errors.stderr +++ b/core/codegen/tests/ui-fail-nightly/uri_display_type_errors.stderr @@ -56,7 +56,3 @@ error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` is not implemented for `BadType` | = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&BadType` - -error: aborting due to 7 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/core/codegen/tests/ui-fail-stable/async-entry.rs b/core/codegen/tests/ui-fail-stable/async-entry.rs new file mode 120000 index 00000000..7df19d9a --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/async-entry.rs @@ -0,0 +1 @@ +../ui-fail/async-entry.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail-stable/async-entry.stderr b/core/codegen/tests/ui-fail-stable/async-entry.stderr new file mode 100644 index 00000000..9001c2db --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/async-entry.stderr @@ -0,0 +1,165 @@ +error: attribute can only be applied to `async` functions + --> $DIR/async-entry.rs:6:5 + | +6 | #[rocket::main] + | ^^^^^^^^^^^^^^^ + | + = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: [note] this function must be `async` + --> $DIR/async-entry.rs:7:5 + | +7 | fn foo() { } + | ^^ + +error: [warning] attribute is typically applied to `main` function + --> $DIR/async-entry.rs:12:5 + | +12 | #[rocket::main] + | ^^^^^^^^^^^^^^^ + | + = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: [note] this function is not `main` + --> $DIR/async-entry.rs:13:5 + | +13 | async fn foo() { } + | ^^^^^ + +error: attribute can only be applied to `async` functions + --> $DIR/async-entry.rs:18:5 + | +18 | #[rocket::main] + | ^^^^^^^^^^^^^^^ + | + = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: [note] this function must be `async` + --> $DIR/async-entry.rs:19:5 + | +19 | fn main() { + | ^^ + +error: attribute cannot be applied to `main` function + --- note: this attribute generates a `main` function + --> $DIR/async-entry.rs:55:5 + | +55 | #[rocket::launch] + | ^^^^^^^^^^^^^^^^^ + | + = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: [note] this function cannot be `main` + --> $DIR/async-entry.rs:56:5 + | +56 | fn main() -> rocket::Rocket { + | ^^ + +error: attribute can only be applied to functions that return a value + --> $DIR/async-entry.rs:63:5 + | +63 | #[rocket::launch] + | ^^^^^^^^^^^^^^^^^ + | + = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: [note] this function must return a value + --> $DIR/async-entry.rs:64:5 + | +64 | async fn rocket() { + | ^^^^^ + +error: attribute can only be applied to functions that return a value + --> $DIR/async-entry.rs:72:5 + | +72 | #[rocket::launch] + | ^^^^^^^^^^^^^^^^^ + | + = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: [note] this function must return a value + --> $DIR/async-entry.rs:73:5 + | +73 | fn rocket() { + | ^^ + +error: attribute cannot be applied to `main` function + --- note: this attribute generates a `main` function + --> $DIR/async-entry.rs:89:5 + | +89 | #[rocket::launch] + | ^^^^^^^^^^^^^^^^^ + | + = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: [note] this function cannot be `main` + --> $DIR/async-entry.rs:90:5 + | +90 | fn main() -> &'static str { + | ^^ + +error: attribute cannot be applied to `main` function + --- note: this attribute generates a `main` function + --> $DIR/async-entry.rs:98:5 + | +98 | #[rocket::launch] + | ^^^^^^^^^^^^^^^^^ + | + = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: [note] this function cannot be `main` + --> $DIR/async-entry.rs:99:5 + | +99 | async fn main() -> rocket::Rocket { + | ^^^^^ + +error[E0728]: `await` is only allowed inside `async` functions and blocks + --> $DIR/async-entry.rs:82:17 + | +81 | fn rocket() -> rocket::Rocket { + | ------ this is not `async` +82 | let _ = rocket::ignite().launch().await; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ only allowed inside `async` functions and blocks + +error[E0308]: mismatched types + --> $DIR/async-entry.rs:40:9 + | +40 | rocket::ignite() + | ^^^^^^^^^^^^^^^^ expected struct `std::string::String`, found struct `rocket::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` + +error[E0308]: mismatched types + --> $DIR/async-entry.rs:27:21 + | +27 | async fn main() { + | ^ expected `()` because of default return type + | _____________________| + | | +28 | | //~^ ERROR mismatched types +29 | | rocket::ignite() +30 | | } + | | ^- help: try adding a semicolon: `;` + | |_____| + | expected `()`, found struct `rocket::rocket::Rocket` + +error[E0308]: mismatched types + --> $DIR/async-entry.rs:37:26 + | +37 | async fn rocket() -> String { + | ^^^^^^ + | | + | expected struct `rocket::rocket::Rocket`, found struct `std::string::String` + | expected due to this + +error[E0277]: `main` has invalid return type `rocket::rocket::Rocket` + --> $DIR/async-entry.rs:106:20 + | +106 | async fn main() -> rocket::Rocket { + | ^^^^^^^^^^^^^^ `main` can only return types that implement `std::process::Termination` + | + = help: consider using `()`, or a `Result` diff --git a/core/codegen/tests/ui-fail-stable/catch.rs b/core/codegen/tests/ui-fail-stable/catch.rs new file mode 120000 index 00000000..055ab4b4 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/catch.rs @@ -0,0 +1 @@ +../ui-fail/catch.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail-stable/catch.stderr b/core/codegen/tests/ui-fail-stable/catch.stderr new file mode 100644 index 00000000..f7781bc9 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/catch.stderr @@ -0,0 +1,70 @@ +error: expected `fn` + --- help: `#[catch]` can only be used on functions + --> $DIR/catch.rs:6:1 + | +6 | struct Catcher(String); + | ^^^^^^ + +error: expected `fn` + --- help: `#[catch]` can only be used on functions + --> $DIR/catch.rs:11:7 + | +11 | const CATCH: &str = "Catcher"; + | ^^^^^ + +error: invalid value: expected unsigned integer literal + --- help: `#[catch]` expects a single status integer, e.g.: #[catch(404)] + --> $DIR/catch.rs:15:9 + | +15 | #[catch("404")] //~ ERROR expected unsigned integer literal + | ^^^^^ + +error: unexpected keyed parameter: expected literal or identifier + --- help: `#[catch]` expects a single status integer, e.g.: #[catch(404)] + --> $DIR/catch.rs:19:9 + | +19 | #[catch(code = "404")] //~ ERROR unexpected keyed parameter + | ^^^^ + +error: unexpected keyed parameter: expected literal or identifier + --- help: `#[catch]` expects a single status integer, e.g.: #[catch(404)] + --> $DIR/catch.rs:23:9 + | +23 | #[catch(code = 404)] //~ ERROR unexpected keyed parameter + | ^^^^ + +error: status must be in range [100, 599] + --- help: `#[catch]` expects a single status integer, e.g.: #[catch(404)] + --> $DIR/catch.rs:27:9 + | +27 | #[catch(99)] //~ ERROR in range [100, 599] + | ^^ + +error: status must be in range [100, 599] + --- help: `#[catch]` expects a single status integer, e.g.: #[catch(404)] + --> $DIR/catch.rs:31:9 + | +31 | #[catch(600)] //~ ERROR in range [100, 599] + | ^^^ + +error: unexpected attribute parameter: `message` + --- help: `#[catch]` expects a single status integer, e.g.: #[catch(404)] + --> $DIR/catch.rs:35:14 + | +35 | #[catch(400, message = "foo")] //~ ERROR unexpected attribute parameter: `message` + | ^^^^^^^ + +error: invalid number of arguments: must be zero or one + --- help: catchers may optionally take an argument of type `&Request` + --> $DIR/catch.rs:40:7 + | +40 | fn f3(_request: &Request, other: bool) { + | ^^^^^^^^ + +warning: unused import: `rocket::Request` + --> $DIR/catch.rs:3:5 + | +3 | use rocket::Request; + | ^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` on by default diff --git a/core/codegen/tests/ui-fail-stable/catch_type_errors.rs b/core/codegen/tests/ui-fail-stable/catch_type_errors.rs new file mode 120000 index 00000000..84a8fa1d --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/catch_type_errors.rs @@ -0,0 +1 @@ +../ui-fail/catch_type_errors.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail-stable/catch_type_errors.stderr b/core/codegen/tests/ui-fail-stable/catch_type_errors.stderr new file mode 100644 index 00000000..f1f5d387 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/catch_type_errors.stderr @@ -0,0 +1,37 @@ +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` + | + = note: required by `rocket::response::Responder::respond_to` + +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` + | + = note: required by `rocket::response::Responder::respond_to` + +error[E0308]: mismatched types + --> $DIR/catch_type_errors.rs:18:7 + | +18 | fn f3(_request: bool) -> usize { + | ^^^^^^^^ expected `bool`, found `&rocket::Request<'_>` + +error[E0277]: the trait bound `usize: rocket::response::Responder<'_, '_>` is not satisfied + --> $DIR/catch_type_errors.rs:18:26 + | +18 | 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:25:12 + | +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-stable/catchers.rs b/core/codegen/tests/ui-fail-stable/catchers.rs new file mode 120000 index 00000000..14bc8885 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/catchers.rs @@ -0,0 +1 @@ +../ui-fail/catchers.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail-stable/catchers.stderr b/core/codegen/tests/ui-fail-stable/catchers.stderr new file mode 100644 index 00000000..388da528 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/catchers.stderr @@ -0,0 +1,19 @@ +error: expected `,` + --> $DIR/catchers.rs:4:25 + | +4 | let _ = catchers![a b]; //~ ERROR expected + | ^ + +error: expected identifier + --> $DIR/catchers.rs:6:26 + | +6 | let _ = catchers![a::, ]; //~ ERROR expected identifier + | ^ + +error: unexpected end of input, expected identifier + --> $DIR/catchers.rs:7:13 + | +7 | let _ = catchers![a::]; //~ ERROR expected identifier + | ^^^^^^^^^^^^^^ + | + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/core/codegen/tests/ui-fail-stable/from_form.rs b/core/codegen/tests/ui-fail-stable/from_form.rs new file mode 120000 index 00000000..67286534 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/from_form.rs @@ -0,0 +1 @@ +../ui-fail/from_form.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail-stable/from_form.stderr b/core/codegen/tests/ui-fail-stable/from_form.stderr new file mode 100644 index 00000000..87992d11 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/from_form.stderr @@ -0,0 +1,354 @@ +error: enums are not supported + --> $DIR/from_form.rs:6:1 + | +6 | enum Thing { } + | ^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:5:10 + | +5 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: tuple structs are not supported + --> $DIR/from_form.rs:10:1 + | +10 | struct Foo1; + | ^^^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:9:10 + | +9 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: at least one field is required + --> $DIR/from_form.rs:14:1 + | +14 | struct Foo2 { } + | ^^^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:13:10 + | +13 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: tuple structs are not supported + --> $DIR/from_form.rs:18:1 + | +18 | struct Foo3(usize); + | ^^^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:17:10 + | +17 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: only one lifetime is supported + --> $DIR/from_form.rs:22:20 + | +22 | struct NextTodoTask<'f, 'a> { + | ^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:21:10 + | +21 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid form field name + --> $DIR/from_form.rs:32:20 + | +32 | #[form(field = "isindex")] + | ^^^^^^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:30:10 + | +30 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: duplicate field name + --> $DIR/from_form.rs:41:5 + | +41 | foo: usize, + | ^^^ + +error: [note] previous definition here + --> $DIR/from_form.rs:39:20 + | +39 | #[form(field = "foo")] + | ^^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:37:10 + | +37 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: duplicate field name + --> $DIR/from_form.rs:49:20 + | +49 | #[form(field = "hello")] + | ^^^^^^^ + +error: [note] previous definition here + --> $DIR/from_form.rs:47:20 + | +47 | #[form(field = "hello")] + | ^^^^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:45:10 + | +45 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: duplicate field name + --> $DIR/from_form.rs:57:20 + | +57 | #[form(field = "first")] + | ^^^^^^^ + +error: [note] previous definition here + --> $DIR/from_form.rs:56:5 + | +56 | first: String, + | ^^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:54:10 + | +54 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: duplicate attribute parameter: field + --> $DIR/from_form.rs:64:28 + | +64 | #[form(field = "blah", field = "bloo")] + | ^^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:62:10 + | +62 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: malformed attribute: expected list + --- help: expected syntax: #[form(key = value, ..)] + --> $DIR/from_form.rs:71:7 + | +71 | #[form] + | ^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:69:10 + | +69 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected key/value pair + --> $DIR/from_form.rs:78:12 + | +78 | #[form("blah")] + | ^^^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:76:10 + | +76 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected key/value pair + --> $DIR/from_form.rs:85:12 + | +85 | #[form(123)] + | ^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:83:10 + | +83 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: unexpected attribute parameter: `beep` + --> $DIR/from_form.rs:92:12 + | +92 | #[form(beep = "bop")] + | ^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:90:10 + | +90 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: duplicate invocation of `form` attribute + --> $DIR/from_form.rs:100:5 + | +100 | #[form(field = "bleh")] + | ^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:97:10 + | +97 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid value: expected string literal + --> $DIR/from_form.rs:107:20 + | +107 | #[form(field = true)] + | ^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:105:10 + | +105 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected literal or key/value pair + --> $DIR/from_form.rs:114:12 + | +114 | #[form(field)] + | ^^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:112:10 + | +112 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid value: expected string literal + --> $DIR/from_form.rs:121:20 + | +121 | #[form(field = 123)] + | ^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:119:10 + | +119 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid form field name + --> $DIR/from_form.rs:128:20 + | +128 | #[form(field = "hello&world")] + | ^^^^^^^^^^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:126:10 + | +126 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid form field name + --> $DIR/from_form.rs:135:20 + | +135 | #[form(field = "!@#$%^&*()_")] + | ^^^^^^^^^^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:133:10 + | +133 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid form field name + --> $DIR/from_form.rs:142:20 + | +142 | #[form(field = "?")] + | ^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:140:10 + | +140 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid form field name + --> $DIR/from_form.rs:149:20 + | +149 | #[form(field = "")] + | ^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:147:10 + | +147 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid form field name + --> $DIR/from_form.rs:156:20 + | +156 | #[form(field = "a&b")] + | ^^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:154:10 + | +154 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid form field name + --> $DIR/from_form.rs:163:20 + | +163 | #[form(field = "a=")] + | ^^^^ + +error: [note] error occurred while deriving `FromForm` + --> $DIR/from_form.rs:161:10 + | +161 | #[derive(FromForm)] + | ^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/core/codegen/tests/ui-fail-stable/from_form_type_errors.rs b/core/codegen/tests/ui-fail-stable/from_form_type_errors.rs new file mode 120000 index 00000000..4a2abd28 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/from_form_type_errors.rs @@ -0,0 +1 @@ +../ui-fail/from_form_type_errors.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail-stable/from_form_type_errors.stderr b/core/codegen/tests/ui-fail-stable/from_form_type_errors.stderr new file mode 100644 index 00000000..6e80d104 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/from_form_type_errors.stderr @@ -0,0 +1,11 @@ +error[E0277]: the trait bound `Unknown: rocket::request::FromFormValue<'_>` is not satisfied + --> $DIR/from_form_type_errors.rs:7:5 + | +7 | field: Unknown, + | ^^^^^ the trait `rocket::request::FromFormValue<'_>` is not implemented for `Unknown` + +error[E0277]: the trait bound `Foo: rocket::request::FromFormValue<'_>` is not satisfied + --> $DIR/from_form_type_errors.rs:15:5 + | +15 | field: Foo, + | ^^^^^ the trait `rocket::request::FromFormValue<'_>` is not implemented for `Foo` diff --git a/core/codegen/tests/ui-fail-stable/from_form_value.rs b/core/codegen/tests/ui-fail-stable/from_form_value.rs new file mode 120000 index 00000000..e48f57bb --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/from_form_value.rs @@ -0,0 +1 @@ +../ui-fail/from_form_value.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail-stable/from_form_value.stderr b/core/codegen/tests/ui-fail-stable/from_form_value.stderr new file mode 100644 index 00000000..b4eef63a --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/from_form_value.stderr @@ -0,0 +1,111 @@ +error: tuple structs are not supported + --> $DIR/from_form_value.rs:4:1 + | +4 | struct Foo1; + | ^^^^^^ + +error: [note] error occurred while deriving `FromFormValue` + --> $DIR/from_form_value.rs:3:10 + | +3 | #[derive(FromFormValue)] + | ^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: tuple structs are not supported + --> $DIR/from_form_value.rs:8:1 + | +8 | struct Foo2(usize); + | ^^^^^^ + +error: [note] error occurred while deriving `FromFormValue` + --> $DIR/from_form_value.rs:7:10 + | +7 | #[derive(FromFormValue)] + | ^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: named structs are not supported + --> $DIR/from_form_value.rs:12:1 + | +12 | struct Foo3 { + | ^^^^^^ + +error: [note] error occurred while deriving `FromFormValue` + --> $DIR/from_form_value.rs:11:10 + | +11 | #[derive(FromFormValue)] + | ^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: variants cannot have fields + --> $DIR/from_form_value.rs:19:5 + | +19 | A(usize), + | ^ + +error: [note] error occurred while deriving `FromFormValue` + --> $DIR/from_form_value.rs:17:10 + | +17 | #[derive(FromFormValue)] + | ^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: enum must have at least one field + --> $DIR/from_form_value.rs:24:1 + | +24 | enum Foo5 { } + | ^^^^ + +error: [note] error occurred while deriving `FromFormValue` + --> $DIR/from_form_value.rs:23:10 + | +23 | #[derive(FromFormValue)] + | ^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: type generics are not supported + --> $DIR/from_form_value.rs:28:11 + | +28 | enum Foo6 { + | ^ + +error: [note] error occurred while deriving `FromFormValue` + --> $DIR/from_form_value.rs:27:10 + | +27 | #[derive(FromFormValue)] + | ^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid value: expected string literal + --> $DIR/from_form_value.rs:35:20 + | +35 | #[form(value = 123)] + | ^^^ + +error: [note] error occurred while deriving `FromFormValue` + --> $DIR/from_form_value.rs:33:10 + | +33 | #[derive(FromFormValue)] + | ^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected literal or key/value pair + --> $DIR/from_form_value.rs:42:12 + | +42 | #[form(value)] + | ^^^^^ + +error: [note] error occurred while deriving `FromFormValue` + --> $DIR/from_form_value.rs:40:10 + | +40 | #[derive(FromFormValue)] + | ^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/core/codegen/tests/ui-fail-stable/responder-types.rs b/core/codegen/tests/ui-fail-stable/responder-types.rs new file mode 120000 index 00000000..fa586f67 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/responder-types.rs @@ -0,0 +1 @@ +../ui-fail/responder-types.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail-stable/responder-types.stderr b/core/codegen/tests/ui-fail-stable/responder-types.stderr new file mode 100644 index 00000000..df37ef81 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/responder-types.stderr @@ -0,0 +1,56 @@ +error[E0277]: the trait bound `u8: rocket::response::Responder<'_, '_>` is not satisfied + --> $DIR/responder-types.rs:9:5 + | +9 | 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` is not satisfied + --> $DIR/responder-types.rs:16:5 + | +16 | other: u8, + | ^^^^^ the trait `std::convert::From` is not implemented for `rocket::http::Header<'_>` + | + = help: the following implementations were found: + as std::convert::From<&rocket::http::Cookie<'_>>> + as std::convert::From>> + = 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 + --> $DIR/responder-types.rs:22:5 + | +22 | 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` is not satisfied + --> $DIR/responder-types.rs:24:5 + | +24 | other: u8, + | ^^^^^ the trait `std::convert::From` is not implemented for `rocket::http::Header<'_>` + | + = help: the following implementations were found: + as std::convert::From<&rocket::http::Cookie<'_>>> + as std::convert::From>> + = note: required because of the requirements on the impl of `std::convert::Into>` for `u8` + +error[E0277]: the trait bound `rocket::http::Header<'_>: std::convert::From` is not satisfied + --> $DIR/responder-types.rs:32:5 + | +32 | then: String, + | ^^^^ the trait `std::convert::From` is not implemented for `rocket::http::Header<'_>` + | + = help: the following implementations were found: + as std::convert::From<&rocket::http::Cookie<'_>>> + as std::convert::From>> + = 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:37:13 + | +37 | 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` diff --git a/core/codegen/tests/ui-fail-stable/route-attribute-general-syntax.rs b/core/codegen/tests/ui-fail-stable/route-attribute-general-syntax.rs new file mode 120000 index 00000000..aadf3b31 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/route-attribute-general-syntax.rs @@ -0,0 +1 @@ +../ui-fail/route-attribute-general-syntax.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail-stable/route-attribute-general-syntax.stderr b/core/codegen/tests/ui-fail-stable/route-attribute-general-syntax.stderr new file mode 100644 index 00000000..1350efe9 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/route-attribute-general-syntax.stderr @@ -0,0 +1,206 @@ +error: missing expected parameter: `path` + --> $DIR/route-attribute-general-syntax.rs:5:1 + | +5 | #[get()] //~ ERROR missing expected parameter + | ^^^^^^^^ + | + = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected `fn` + --- help: #[get] can only be used on functions + --> $DIR/route-attribute-general-syntax.rs:11:1 + | +11 | struct S; + | ^^^^^^ + +error: expected `fn` + --- help: #[get] can only be used on functions + --> $DIR/route-attribute-general-syntax.rs:16:1 + | +16 | enum A { } + | ^^^^ + +error: expected `fn` + --- help: #[get] can only be used on functions + --> $DIR/route-attribute-general-syntax.rs:21:1 + | +21 | trait Foo { } + | ^^^^^ + +error: expected `fn` + --- help: #[get] can only be used on functions + --> $DIR/route-attribute-general-syntax.rs:26:1 + | +26 | impl S { } + | ^^^^ + +error: expected key/value pair + --> $DIR/route-attribute-general-syntax.rs:32:12 + | +32 | #[get("/", 123)] //~ ERROR expected + | ^^^ + +error: expected key/value pair + --> $DIR/route-attribute-general-syntax.rs:35:12 + | +35 | #[get("/", "/")] //~ ERROR expected + | ^^^ + +error: unexpected keyed parameter: expected literal or identifier + --> $DIR/route-attribute-general-syntax.rs:38:7 + | +38 | #[get(data = "", "/")] //~ ERROR unexpected keyed parameter + | ^^^^ + +error: unexpected attribute parameter: `unknown` + --> $DIR/route-attribute-general-syntax.rs:41:12 + | +41 | #[get("/", unknown = "foo")] //~ ERROR unexpected + | ^^^^^^^ + +error: malformed attribute + --- help: expected syntax: #[get(key = value, ..)] + --> $DIR/route-attribute-general-syntax.rs:44:1 + | +44 | #[get("/", ...)] //~ ERROR malformed + | ^^^^^^^^^^^^^^^^ + | + = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: handler arguments cannot be ignored + --- help: all handler arguments must be of the form: `ident: Type` + --> $DIR/route-attribute-general-syntax.rs:51:7 + | +51 | fn c1(_: usize) {} //~ ERROR cannot be ignored + | ^ + +error: invalid value: expected string literal + --> $DIR/route-attribute-general-syntax.rs:56:7 + | +56 | #[get(100)] //~ ERROR expected string + | ^^^ + +error: invalid value: expected string literal + --> $DIR/route-attribute-general-syntax.rs:59:7 + | +59 | #[get('/')] //~ ERROR expected string + | ^^^ + +error: invalid value: expected integer literal + --> $DIR/route-attribute-general-syntax.rs:62:19 + | +62 | #[get("/", rank = "1")] //~ ERROR expected integer + | ^^^ + +error: invalid value: expected integer literal + --> $DIR/route-attribute-general-syntax.rs:65:19 + | +65 | #[get("/", rank = '1')] //~ ERROR expected integer + | ^^^ + +error: invalid or unknown media type + --> $DIR/route-attribute-general-syntax.rs:70:21 + | +70 | #[get("/", format = "applicationx-custom")] //~ ERROR invalid or unknown media type + | ^^^^^^^^^^^^^^^^^^^^^ + +error: invalid or unknown media type + --> $DIR/route-attribute-general-syntax.rs:73:21 + | +73 | #[get("/", format = "")] //~ ERROR invalid or unknown media type + | ^^ + +error: invalid or unknown media type + --> $DIR/route-attribute-general-syntax.rs:76:21 + | +76 | #[get("/", format = "//")] //~ ERROR invalid or unknown media type + | ^^^^ + +error: invalid or unknown media type + --> $DIR/route-attribute-general-syntax.rs:79:21 + | +79 | #[get("/", format = "/")] //~ ERROR invalid or unknown media type + | ^^^ + +error: invalid or unknown media type + --> $DIR/route-attribute-general-syntax.rs:82:21 + | +82 | #[get("/", format = "a/")] //~ ERROR invalid or unknown media type + | ^^^^ + +error: invalid or unknown media type + --> $DIR/route-attribute-general-syntax.rs:85:21 + | +85 | #[get("/", format = "/a")] //~ ERROR invalid or unknown media type + | ^^^^ + +error: invalid or unknown media type + --> $DIR/route-attribute-general-syntax.rs:88:21 + | +88 | #[get("/", format = "/a/")] //~ ERROR invalid or unknown media type + | ^^^^^ + +error: invalid or unknown media type + --> $DIR/route-attribute-general-syntax.rs:91:21 + | +91 | #[get("/", format = "a/b/")] //~ ERROR invalid or unknown media type + | ^^^^^^ + +error: invalid or unknown media type + --> $DIR/route-attribute-general-syntax.rs:94:21 + | +94 | #[get("/", format = "unknown")] //~ ERROR unknown media type + | ^^^^^^^^^ + +error: invalid value: expected string literal + --> $DIR/route-attribute-general-syntax.rs:97:21 + | +97 | #[get("/", format = 12)] //~ ERROR expected string + | ^^ + +error: invalid value: expected string literal + --> $DIR/route-attribute-general-syntax.rs:100:21 + | +100 | #[get("/", format = 'j')] //~ ERROR expected string + | ^^^ + +error: invalid or unknown media type + --> $DIR/route-attribute-general-syntax.rs:103:21 + | +103 | #[get("/", format = "text//foo")] //~ ERROR invalid or unknown media type + | ^^^^^^^^^^^ + +error: invalid HTTP method for route handlers + --- help: method must be one of: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS` + --> $DIR/route-attribute-general-syntax.rs:108:9 + | +108 | #[route(CONNECT, "/")] //~ ERROR invalid HTTP method for route + | ^^^^^^^ + +error: invalid HTTP method + --- help: method must be one of: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS` + --> $DIR/route-attribute-general-syntax.rs:112:9 + | +112 | #[route(FIX, "/")] //~ ERROR invalid HTTP method + | ^^^ + +error: expected identifier, found string literal + --- help: method must be one of: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS` + --> $DIR/route-attribute-general-syntax.rs:116:9 + | +116 | #[route("hi", "/")] //~ ERROR expected identifier + | ^^^^ + +error: expected identifier, found string literal + --- help: method must be one of: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS` + --> $DIR/route-attribute-general-syntax.rs:120:9 + | +120 | #[route("GET", "/")] //~ ERROR expected identifier + | ^^^^^ + +error: expected identifier, found integer literal + --- help: method must be one of: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS` + --> $DIR/route-attribute-general-syntax.rs:124:9 + | +124 | #[route(120, "/")] //~ ERROR expected identifier + | ^^^ diff --git a/core/codegen/tests/ui-fail-stable/route-path-bad-syntax.rs b/core/codegen/tests/ui-fail-stable/route-path-bad-syntax.rs new file mode 120000 index 00000000..8433a4e4 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/route-path-bad-syntax.rs @@ -0,0 +1 @@ +../ui-fail/route-path-bad-syntax.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail-stable/route-path-bad-syntax.stderr b/core/codegen/tests/ui-fail-stable/route-path-bad-syntax.stderr new file mode 100644 index 00000000..4a771fa1 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/route-path-bad-syntax.stderr @@ -0,0 +1,230 @@ +error: invalid path URI: expected token / but found a at index 0 + --- help: expected path in origin form: "/path/" + --> $DIR/route-path-bad-syntax.rs:5:7 + | +5 | #[get("a")] //~ ERROR invalid path URI + | ^^^ + +error: invalid path URI: expected token / but none was found at index 0 + --- help: expected path in origin form: "/path/" + --> $DIR/route-path-bad-syntax.rs:9:7 + | +9 | #[get("")] //~ ERROR invalid path URI + | ^^ + +error: invalid path URI: expected token / but found a at index 0 + --- help: expected path in origin form: "/path/" + --> $DIR/route-path-bad-syntax.rs:13:7 + | +13 | #[get("a/b/c")] //~ ERROR invalid path URI + | ^^^^^^^ + +error: paths cannot contain empty segments + --- note: expected '/a/b', found '/a///b' + --> $DIR/route-path-bad-syntax.rs:17:7 + | +17 | #[get("/a///b")] //~ ERROR empty segments + | ^^^^^^^^ + +error: query cannot contain empty segments + --> $DIR/route-path-bad-syntax.rs:21:7 + | +21 | #[get("/?bat&&")] //~ ERROR empty segments + | ^^^^^^^^^ + +error: query cannot contain empty segments + --> $DIR/route-path-bad-syntax.rs:24:7 + | +24 | #[get("/?bat&&")] //~ ERROR empty segments + | ^^^^^^^^^ + +error: paths cannot contain empty segments + --- note: expected '/a/b', found '/a/b//' + --> $DIR/route-path-bad-syntax.rs:27:7 + | +27 | #[get("/a/b//")] //~ ERROR empty segments + | ^^^^^^^^ + +error: invalid path URI: expected EOF but found # at index 3 + --- help: expected path in origin form: "/path/" + --> $DIR/route-path-bad-syntax.rs:33:7 + | +33 | #[get("/!@#$%^&*()")] //~ ERROR invalid path URI + | ^^^^^^^^^^^^^ + +error: component contains invalid URI characters + --- note: components cannot contain reserved characters + --- help: reserved characters include: '%', '+', '&', etc. + --> $DIR/route-path-bad-syntax.rs:37:7 + | +37 | #[get("/a%20b")] //~ ERROR invalid URI characters + | ^^^^^^^^ + +error: component contains invalid URI characters + --- note: components cannot contain reserved characters + --- help: reserved characters include: '%', '+', '&', etc. + --> $DIR/route-path-bad-syntax.rs:42:7 + | +42 | #[get("/a?a%20b")] //~ ERROR invalid URI characters + | ^^^^^^^^^^ + +error: component contains invalid URI characters + --- note: components cannot contain reserved characters + --- help: reserved characters include: '%', '+', '&', etc. + --> $DIR/route-path-bad-syntax.rs:47:7 + | +47 | #[get("/a?a+b")] //~ ERROR invalid URI characters + | ^^^^^^^^ + +error: unused dynamic parameter + --> $DIR/route-path-bad-syntax.rs:54:7 + | +54 | #[get("/")] //~ ERROR unused dynamic parameter + | ^^^^^^^^^ + +error: [note] expected argument named `name` here + --> $DIR/route-path-bad-syntax.rs:55:7 + | +55 | fn h0(_name: usize) {} //~ NOTE expected argument named `name` here + | ^^^^^ + +error: unused dynamic parameter + --> $DIR/route-path-bad-syntax.rs:57:7 + | +57 | #[get("/a?")] //~ ERROR unused dynamic parameter + | ^^^^^^^^ + +error: [note] expected argument named `r` here + --> $DIR/route-path-bad-syntax.rs:58:1 + | +58 | fn h1() {} //~ NOTE expected argument named `r` here + | ^^ + +error: unused dynamic parameter + --> $DIR/route-path-bad-syntax.rs:60:21 + | +60 | #[post("/a", data = "")] //~ ERROR unused dynamic parameter + | ^^^^^^^^ + +error: [note] expected argument named `test` here + --> $DIR/route-path-bad-syntax.rs:61:1 + | +61 | fn h2() {} //~ NOTE expected argument named `test` here + | ^^ + +error: unused dynamic parameter + --> $DIR/route-path-bad-syntax.rs:63:7 + | +63 | #[get("/<_r>")] //~ ERROR unused dynamic parameter + | ^^^^^^^ + +error: [note] expected argument named `_r` here + --> $DIR/route-path-bad-syntax.rs:64:1 + | +64 | fn h3() {} //~ NOTE expected argument named `_r` here + | ^^ + +error: unused dynamic parameter + --> $DIR/route-path-bad-syntax.rs:66:7 + | +66 | #[get("/<_r>/")] //~ ERROR unused dynamic parameter + | ^^^^^^^^^^^ + +error: [note] expected argument named `b` here + --> $DIR/route-path-bad-syntax.rs:68:1 + | +68 | fn h4() {} //~ NOTE expected argument named `_r` here + | ^^ + +error: `foo_.` is not a valid identifier + --- help: parameter names must be valid identifiers + --> $DIR/route-path-bad-syntax.rs:73:7 + | +73 | #[get("/")] //~ ERROR `foo_.` is not a valid identifier + | ^^^^^^^^^^ + +error: `foo*` is not a valid identifier + --- help: parameter names must be valid identifiers + --> $DIR/route-path-bad-syntax.rs:77:7 + | +77 | #[get("/")] //~ ERROR `foo*` is not a valid identifier + | ^^^^^^^^^ + +error: `!` is not a valid identifier + --- help: parameter names must be valid identifiers + --> $DIR/route-path-bad-syntax.rs:81:7 + | +81 | #[get("/")] //~ ERROR `!` is not a valid identifier + | ^^^^^^ + +error: `name>: $DIR/route-path-bad-syntax.rs:85:7 + | +85 | #[get("/:")] //~ ERROR `name>:' + --> $DIR/route-path-bad-syntax.rs:91:19 + | +91 | #[get("/", data = "foo")] //~ ERROR malformed parameter + | ^^^^^ + +error: malformed parameter + --- help: parameter must be of the form '' + --> $DIR/route-path-bad-syntax.rs:95:19 + | +95 | #[get("/", data = "")] //~ ERROR malformed parameter + | ^^^^^^^^^ + +error: parameter is missing a closing bracket + --- help: did you mean ''? + --> $DIR/route-path-bad-syntax.rs:99:19 + | +99 | #[get("/", data = " $DIR/route-path-bad-syntax.rs:103:19 + | +103 | #[get("/", data = "")] //~ ERROR `test ` is not a valid identifier + | ^^^^^^^^^ + +error: parameters must be named + --- help: use a name such as `_guard` or `_param` + --> $DIR/route-path-bad-syntax.rs:109:7 + | +109 | #[get("/<_>")] //~ ERROR must be named + | ^^^^^^ + +error: parameter names cannot be empty + --> $DIR/route-path-bad-syntax.rs:114:7 + | +114 | #[get("/<>")] //~ ERROR cannot be empty + | ^^^^^ + +error: malformed parameter or identifier + --- help: parameters must be of the form '' + --- help: identifiers cannot contain '<' or '>' + --> $DIR/route-path-bad-syntax.rs:117:7 + | +117 | #[get("/<")] //~ ERROR malformed parameter + | ^^^^^^^^ + +error: malformed parameter or identifier + --- help: parameters must be of the form '' + --- help: identifiers cannot contain '<' or '>' + --> $DIR/route-path-bad-syntax.rs:122:7 + | +122 | #[get("/<<<<")] //~ ERROR malformed parameter + | ^^^^^^^^^^^ + +error: malformed parameter or identifier + --- help: parameters must be of the form '' + --- help: identifiers cannot contain '<' or '>' + --> $DIR/route-path-bad-syntax.rs:127:7 + | +127 | #[get("/<>name><")] //~ ERROR malformed parameter + | ^^^^^^^^^^^ diff --git a/core/codegen/tests/ui-fail-stable/route-type-errors.rs b/core/codegen/tests/ui-fail-stable/route-type-errors.rs new file mode 120000 index 00000000..78d87d74 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/route-type-errors.rs @@ -0,0 +1 @@ +../ui-fail/route-type-errors.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail-stable/route-type-errors.stderr b/core/codegen/tests/ui-fail-stable/route-type-errors.stderr new file mode 100644 index 00000000..da6e9e8f --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/route-type-errors.stderr @@ -0,0 +1,67 @@ +error[E0277]: the trait bound `Q: rocket::request::FromParam<'_>` is not satisfied + --> $DIR/route-type-errors.rs:6:12 + | +6 | fn f0(foo: Q) {} //~ ERROR FromParam + | ^ the trait `rocket::request::FromParam<'_>` is not implemented for `Q` + +error[E0277]: the trait bound `Q: rocket::request::FromSegments<'_>` is not satisfied + --> $DIR/route-type-errors.rs:9:12 + | +9 | fn f1(foo: Q) {} //~ ERROR FromSegments + | ^ the trait `rocket::request::FromSegments<'_>` is not implemented for `Q` + +error[E0277]: the trait bound `Q: rocket::request::FromFormValue<'_>` is not satisfied + --> $DIR/route-type-errors.rs:12:12 + | +12 | fn f2(foo: Q) {} //~ ERROR FromFormValue + | ^ the trait `rocket::request::FromFormValue<'_>` is not implemented for `Q` + +error[E0277]: the trait bound `Q: rocket::request::FromFormValue<'_>` is not satisfied + --> $DIR/route-type-errors.rs:12:7 + | +12 | fn f2(foo: Q) {} //~ ERROR FromFormValue + | ^^^^^^ the trait `rocket::request::FromFormValue<'_>` is not implemented for `Q` + +error[E0277]: the trait bound `Q: rocket::request::FromQuery<'_>` is not satisfied + --> $DIR/route-type-errors.rs:15:12 + | +15 | fn f3(foo: Q) {} //~ ERROR FromQuery + | ^ the trait `rocket::request::FromQuery<'_>` is not implemented for `Q` + +error[E0277]: the trait bound `Q: rocket::data::FromData` is not satisfied + --> $DIR/route-type-errors.rs:18:12 + | +18 | fn f4(foo: Q) {} //~ ERROR FromData + | ^ the trait `rocket::data::FromData` is not implemented for `Q` + | + = note: required because of the requirements on the impl of `rocket::data::FromTransformedData<'_>` for `Q` + +error[E0277]: the trait bound `Q: rocket::request::FromRequest<'_, '_>` is not satisfied + --> $DIR/route-type-errors.rs:21:10 + | +21 | fn f5(a: Q, foo: Q) {} + | ^ the trait `rocket::request::FromRequest<'_, '_>` is not implemented for `Q` + +error[E0277]: the trait bound `Q: rocket::request::FromParam<'_>` is not satisfied + --> $DIR/route-type-errors.rs:21:18 + | +21 | fn f5(a: Q, foo: Q) {} + | ^ the trait `rocket::request::FromParam<'_>` is not implemented for `Q` + +error[E0277]: the trait bound `Q: rocket::request::FromRequest<'_, '_>` is not satisfied + --> $DIR/route-type-errors.rs:26:10 + | +26 | fn f6(a: Q, foo: Q, good: usize, bar: Q) {} + | ^ the trait `rocket::request::FromRequest<'_, '_>` is not implemented for `Q` + +error[E0277]: the trait bound `Q: rocket::request::FromParam<'_>` is not satisfied + --> $DIR/route-type-errors.rs:26:18 + | +26 | fn f6(a: Q, foo: Q, good: usize, bar: Q) {} + | ^ the trait `rocket::request::FromParam<'_>` is not implemented for `Q` + +error[E0277]: the trait bound `Q: rocket::request::FromParam<'_>` is not satisfied + --> $DIR/route-type-errors.rs:26:39 + | +26 | fn f6(a: Q, foo: Q, good: usize, bar: Q) {} + | ^ the trait `rocket::request::FromParam<'_>` is not implemented for `Q` diff --git a/core/codegen/tests/ui-fail-stable/route-warnings.rs b/core/codegen/tests/ui-fail-stable/route-warnings.rs new file mode 120000 index 00000000..41489b6c --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/route-warnings.rs @@ -0,0 +1 @@ +../ui-fail/route-warnings.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail-stable/route-warnings.stderr b/core/codegen/tests/ui-fail-stable/route-warnings.stderr new file mode 100644 index 00000000..4b3e10fd --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/route-warnings.stderr @@ -0,0 +1,5 @@ +error: checking for warnings! + --> $DIR/route-warnings.rs:25:5 + | +25 | compile_error!("checking for warnings!") + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/core/codegen/tests/ui-fail-stable/routes.rs b/core/codegen/tests/ui-fail-stable/routes.rs new file mode 120000 index 00000000..cf8c68b5 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/routes.rs @@ -0,0 +1 @@ +../ui-fail/routes.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail-stable/routes.stderr b/core/codegen/tests/ui-fail-stable/routes.stderr new file mode 100644 index 00000000..cb39b641 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/routes.stderr @@ -0,0 +1,19 @@ +error: expected `,` + --> $DIR/routes.rs:4:23 + | +4 | let _ = routes![a b]; //~ ERROR expected `,` + | ^ + +error: expected identifier + --> $DIR/routes.rs:6:24 + | +6 | let _ = routes![a::, ]; //~ ERROR expected identifier + | ^ + +error: unexpected end of input, expected identifier + --> $DIR/routes.rs:7:13 + | +7 | let _ = routes![a::]; //~ ERROR expected identifier + | ^^^^^^^^^^^^ + | + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/core/codegen/tests/ui-fail-stable/typed-uri-bad-type.rs b/core/codegen/tests/ui-fail-stable/typed-uri-bad-type.rs new file mode 120000 index 00000000..ee45a56c --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/typed-uri-bad-type.rs @@ -0,0 +1 @@ +../ui-fail/typed-uri-bad-type.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail-stable/typed-uri-bad-type.stderr b/core/codegen/tests/ui-fail-stable/typed-uri-bad-type.stderr new file mode 100644 index 00000000..98fcfb07 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/typed-uri-bad-type.stderr @@ -0,0 +1,141 @@ +error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam` is not satisfied + --> $DIR/typed-uri-bad-type.rs:48:23 + | +48 | uri!(simple: id = "hi"); + | ^^^^ the trait `rocket::http::uri::FromUriParam` is not implemented for `usize` + | + = help: the following implementations were found: + > + > + > + = note: required by `rocket::http::uri::FromUriParam::from_uri_param` + +error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam` is not satisfied + --> $DIR/typed-uri-bad-type.rs:51:18 + | +51 | uri!(simple: "hello"); + | ^^^^^^^ the trait `rocket::http::uri::FromUriParam` is not implemented for `usize` + | + = help: the following implementations were found: + > + > + > + = note: required by `rocket::http::uri::FromUriParam::from_uri_param` + +error[E0277]: the trait bound `usize: rocket::http::uri::FromUriParam` is not satisfied + --> $DIR/typed-uri-bad-type.rs:54:23 + | +54 | uri!(simple: id = 239239i64); + | ^^^^^^^^^ the trait `rocket::http::uri::FromUriParam` is not implemented for `usize` + | + = help: the following implementations were found: + > + > + > + = note: required by `rocket::http::uri::FromUriParam::from_uri_param` + +error[E0277]: the trait bound `S: rocket::http::uri::FromUriParam` is not satisfied + --> $DIR/typed-uri-bad-type.rs:57:31 + | +57 | uri!(not_uri_display: 10, S); + | ^ the trait `rocket::http::uri::FromUriParam` is not implemented for `S` + +error[E0277]: the trait bound `i32: rocket::http::uri::FromUriParam>` is not satisfied + --> $DIR/typed-uri-bad-type.rs:63:26 + | +63 | uri!(optionals: id = Some(10), name = Ok("bob".into())); + | ^^^^ the trait `rocket::http::uri::FromUriParam>` is not implemented for `i32` + | + = help: the following implementations were found: + > + > + > + = note: required because of the requirements on the impl of `rocket::http::uri::FromUriParam>` for `std::option::Option` + +error[E0277]: the trait bound `std::string::String: rocket::http::uri::FromUriParam>` is not satisfied + --> $DIR/typed-uri-bad-type.rs:63:43 + | +63 | uri!(optionals: id = Some(10), name = Ok("bob".into())); + | ^^ the trait `rocket::http::uri::FromUriParam>` is not implemented for `std::string::String` + | + = help: the following implementations were found: + > + > + > + > + and 2 others + = note: required because of the requirements on the impl of `rocket::http::uri::FromUriParam>` for `std::result::Result` + +error[E0277]: the trait bound `isize: rocket::http::uri::FromUriParam` is not satisfied + --> $DIR/typed-uri-bad-type.rs:67:20 + | +67 | uri!(simple_q: "hi"); + | ^^^^ the trait `rocket::http::uri::FromUriParam` is not implemented for `isize` + | + = help: the following implementations were found: + > + > + > + = note: required by `rocket::http::uri::FromUriParam::from_uri_param` + +error[E0277]: the trait bound `isize: rocket::http::uri::FromUriParam` is not satisfied + --> $DIR/typed-uri-bad-type.rs:70:25 + | +70 | uri!(simple_q: id = "hi"); + | ^^^^ the trait `rocket::http::uri::FromUriParam` is not implemented for `isize` + | + = help: the following implementations were found: + > + > + > + = note: required by `rocket::http::uri::FromUriParam::from_uri_param` + +error[E0277]: the trait bound `S: rocket::http::uri::FromUriParam` is not satisfied + --> $DIR/typed-uri-bad-type.rs:73:24 + | +73 | uri!(other_q: 100, S); + | ^ the trait `rocket::http::uri::FromUriParam` is not implemented for `S` + +error[E0277]: the trait bound `S: rocket::http::uri::FromUriParam` is not satisfied + --> $DIR/typed-uri-bad-type.rs:76:26 + | +76 | uri!(other_q: rest = S, id = 100); + | ^ the trait `rocket::http::uri::FromUriParam` is not implemented for `S` + +error[E0277]: the trait bound `S: rocket::http::uri::Ignorable` is not satisfied + --> $DIR/typed-uri-bad-type.rs:40:29 + | +40 | fn other_q(id: usize, rest: S) { } + | ^ the trait `rocket::http::uri::Ignorable` is not implemented for `S` +... +79 | uri!(other_q: rest = _, id = 100); + | ---------------------------------- in this macro invocation + | + ::: $WORKSPACE/core/http/src/uri/uri_display.rs:465:40 + | +465 | pub fn assert_ignorable>() { } + | ------------ required by this bound in `rocket::http::uri::assert_ignorable` + | + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `usize: rocket::http::uri::Ignorable` is not satisfied + --> $DIR/typed-uri-bad-type.rs:40:16 + | +40 | fn other_q(id: usize, rest: S) { } + | ^^^^^ the trait `rocket::http::uri::Ignorable` is not implemented for `usize` +... +81 | uri!(other_q: rest = S, id = _); + | -------------------------------- in this macro invocation + | + ::: $WORKSPACE/core/http/src/uri/uri_display.rs:465:40 + | +465 | pub fn assert_ignorable>() { } + | ------------ required by this bound in `rocket::http::uri::assert_ignorable` + | + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `S: rocket::http::uri::FromUriParam` is not satisfied + --> $DIR/typed-uri-bad-type.rs:81:26 + | +81 | uri!(other_q: rest = S, id = _); + | ^ the trait `rocket::http::uri::FromUriParam` is not implemented for `S` diff --git a/core/codegen/tests/ui-fail-stable/typed-uris-bad-params.rs b/core/codegen/tests/ui-fail-stable/typed-uris-bad-params.rs new file mode 120000 index 00000000..40288709 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/typed-uris-bad-params.rs @@ -0,0 +1 @@ +../ui-fail/typed-uris-bad-params.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail-stable/typed-uris-bad-params.stderr b/core/codegen/tests/ui-fail-stable/typed-uris-bad-params.stderr new file mode 100644 index 00000000..6c36fd08 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/typed-uris-bad-params.stderr @@ -0,0 +1,313 @@ +error: path parameters cannot be ignored + --> $DIR/typed-uris-bad-params.rs:77:37 + | +77 | uri!(optionals: id = 10, name = _); + | ^ + +error: path parameters cannot be ignored + --> $DIR/typed-uris-bad-params.rs:74:26 + | +74 | uri!(optionals: id = _, name = "bob".into()); + | ^ + +error: macro expansion ignores token `compile_error` and any following + --> $DIR/typed-uris-bad-params.rs:70:29 + | +13 | #[post("/?")] + | ------------------------ help: you might be missing a semicolon here: `;` + | | + | caused by the macro expansion here +... +70 | uri!(has_two: id = 100, cookies = "hi"); //~ ERROR invalid parameters + | ^^^^^^^ + | + = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context + +error: invalid parameters for `has_two` route uri + --- note: uri parameters are: id: i32, name: String + --- help: missing parameter: `name` + --> $DIR/typed-uris-bad-params.rs:70:19 + | +70 | uri!(has_two: id = 100, cookies = "hi"); //~ ERROR invalid parameters + | ^^ + +error: macro expansion ignores token `compile_error` and any following + --> $DIR/typed-uris-bad-params.rs:65:19 + | +13 | #[post("/?")] + | ------------------------ help: you might be missing a semicolon here: `;` + | | + | caused by the macro expansion here +... +65 | uri!(has_two: cookies = "hi", id = 100, id = 10, id = 10); //~ ERROR invalid parameters + | ^^^^^^^ + | + = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context + +error: invalid parameters for `has_two` route uri + --- note: uri parameters are: id: i32, name: String + --- help: missing parameter: `name` + --> $DIR/typed-uris-bad-params.rs:65:19 + | +65 | uri!(has_two: cookies = "hi", id = 100, id = 10, id = 10); //~ ERROR invalid parameters + | ^^^^^^^ + +error: invalid parameters for `has_two` route uri + --- note: uri parameters are: id: i32, name: String + --- help: missing parameter: `id` + --> $DIR/typed-uris-bad-params.rs:62:19 + | +62 | uri!(has_two: name = "hi"); //~ ERROR invalid parameters + | ^^^^ + +error: macro expansion ignores token `compile_error` and any following + --> $DIR/typed-uris-bad-params.rs:58:29 + | +13 | #[post("/?")] + | ------------------------ help: you might be missing a semicolon here: `;` + | | + | caused by the macro expansion here +... +58 | uri!(has_two: id = 100, id = 100, ); //~ ERROR invalid parameters + | ^^ + | + = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context + +error: invalid parameters for `has_two` route uri + --- note: uri parameters are: id: i32, name: String + --- help: missing parameter: `name` + --> $DIR/typed-uris-bad-params.rs:58:19 + | +58 | uri!(has_two: id = 100, id = 100, ); //~ ERROR invalid parameters + | ^^ + +error: macro expansion ignores token `compile_error` and any following + --> $DIR/typed-uris-bad-params.rs:55:37 + | +10 | #[post("/")] + | ----------------- help: you might be missing a semicolon here: `;` + | | + | caused by the macro expansion here +... +55 | uri!(has_one_guarded: id = 100, cookies = "hi"); //~ ERROR invalid parameters + | ^^^^^^^ + | + = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context + +error: invalid parameters for `has_one_guarded` route uri + --- note: uri parameters are: id: i32 + --> $DIR/typed-uris-bad-params.rs:55:27 + | +55 | uri!(has_one_guarded: id = 100, cookies = "hi"); //~ ERROR invalid parameters + | ^^ + +error: macro expansion ignores token `compile_error` and any following + --> $DIR/typed-uris-bad-params.rs:52:27 + | +10 | #[post("/")] + | ----------------- help: you might be missing a semicolon here: `;` + | | + | caused by the macro expansion here +... +52 | uri!(has_one_guarded: cookies = "hi", id = 100); //~ ERROR invalid parameters + | ^^^^^^^ + | + = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context + +error: invalid parameters for `has_one_guarded` route uri + --- note: uri parameters are: id: i32 + --> $DIR/typed-uris-bad-params.rs:52:27 + | +52 | uri!(has_one_guarded: cookies = "hi", id = 100); //~ ERROR invalid parameters + | ^^^^^^^ + +error: macro expansion ignores token `compile_error` and any following + --> $DIR/typed-uris-bad-params.rs:48:19 + | +7 | #[post("/")] + | ----------------- help: you might be missing a semicolon here: `;` + | | + | caused by the macro expansion here +... +48 | uri!(has_one: name = "hi"); //~ ERROR invalid parameters + | ^^^^ + | + = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context + +error: invalid parameters for `has_one` route uri + --- note: uri parameters are: id: i32 + --- help: missing parameter: `id` + --> $DIR/typed-uris-bad-params.rs:48:19 + | +48 | uri!(has_one: name = "hi"); //~ ERROR invalid parameters + | ^^^^ + +error: macro expansion ignores token `compile_error` and any following + --> $DIR/typed-uris-bad-params.rs:45:29 + | +7 | #[post("/")] + | ----------------- help: you might be missing a semicolon here: `;` + | | + | caused by the macro expansion here +... +45 | uri!(has_one: id = 100, id = 100, ); //~ ERROR invalid parameters + | ^^ + | + = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context + +error: invalid parameters for `has_one` route uri + --- note: uri parameters are: id: i32 + --> $DIR/typed-uris-bad-params.rs:45:19 + | +45 | uri!(has_one: id = 100, id = 100, ); //~ ERROR invalid parameters + | ^^ + +error: macro expansion ignores token `compile_error` and any following + --> $DIR/typed-uris-bad-params.rs:42:29 + | +7 | #[post("/")] + | ----------------- help: you might be missing a semicolon here: `;` + | | + | caused by the macro expansion here +... +42 | uri!(has_one: id = 100, id = 100); //~ ERROR invalid parameters + | ^^ + | + = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context + +error: invalid parameters for `has_one` route uri + --- note: uri parameters are: id: i32 + --> $DIR/typed-uris-bad-params.rs:42:19 + | +42 | uri!(has_one: id = 100, id = 100); //~ ERROR invalid parameters + | ^^ + +error: macro expansion ignores token `compile_error` and any following + --> $DIR/typed-uris-bad-params.rs:38:19 + | +7 | #[post("/")] + | ----------------- help: you might be missing a semicolon here: `;` + | | + | caused by the macro expansion here +... +38 | uri!(has_one: name = 100, age = 50, id = 100, id = 50); //~ ERROR invalid parameters + | ^^^^ + | + = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context + +error: invalid parameters for `has_one` route uri + --- note: uri parameters are: id: i32 + --> $DIR/typed-uris-bad-params.rs:38:19 + | +38 | uri!(has_one: name = 100, age = 50, id = 100, id = 50); //~ ERROR invalid parameters + | ^^^^ + +error: macro expansion ignores token `compile_error` and any following + --> $DIR/typed-uris-bad-params.rs:35:19 + | +7 | #[post("/")] + | ----------------- help: you might be missing a semicolon here: `;` + | | + | caused by the macro expansion here +... +35 | uri!(has_one: name = 100, age = 50, id = 100); //~ ERROR invalid parameters + | ^^^^ + | + = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context + +error: invalid parameters for `has_one` route uri + --- note: uri parameters are: id: i32 + --> $DIR/typed-uris-bad-params.rs:35:19 + | +35 | uri!(has_one: name = 100, age = 50, id = 100); //~ ERROR invalid parameters + | ^^^^ + +error: macro expansion ignores token `compile_error` and any following + --> $DIR/typed-uris-bad-params.rs:32:19 + | +7 | #[post("/")] + | ----------------- help: you might be missing a semicolon here: `;` + | | + | caused by the macro expansion here +... +32 | uri!(has_one: name = 100, id = 100); //~ ERROR invalid parameters + | ^^^^ + | + = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context + +error: invalid parameters for `has_one` route uri + --- note: uri parameters are: id: i32 + --> $DIR/typed-uris-bad-params.rs:32:19 + | +32 | uri!(has_one: name = 100, id = 100); //~ ERROR invalid parameters + | ^^^^ + +error: macro expansion ignores token `compile_error` and any following + --> $DIR/typed-uris-bad-params.rs:29:29 + | +7 | #[post("/")] + | ----------------- help: you might be missing a semicolon here: `;` + | | + | caused by the macro expansion here +... +29 | uri!(has_one: id = 100, name = "hi"); //~ ERROR invalid parameters + | ^^^^ + | + = note: the usage of `rocket::rocket_internal_uri!` is likely invalid in expression context + +error: invalid parameters for `has_one` route uri + --- note: uri parameters are: id: i32 + --> $DIR/typed-uris-bad-params.rs:29:19 + | +29 | uri!(has_one: id = 100, name = "hi"); //~ ERROR invalid parameters + | ^^ + +error: `has_two` route uri expects 2 parameters but 1 was supplied + --- note: expected parameters: id: i32, name: String + --> $DIR/typed-uris-bad-params.rs:27:19 + | +27 | uri!(has_two: 10); //~ ERROR expects 2 parameters but 1 + | ^^ + +error: `has_two` route uri expects 2 parameters but 3 were supplied + --- note: expected parameters: id: i32, name: String + --> $DIR/typed-uris-bad-params.rs:26:19 + | +26 | uri!(has_two: 10, "hi", "there"); //~ ERROR expects 2 parameters but 3 + | ^^ + +error: `has_one_guarded` route uri expects 1 parameter but 2 were supplied + --- note: expected parameter: id: i32 + --> $DIR/typed-uris-bad-params.rs:24:27 + | +24 | uri!(has_one_guarded: "hi", 100); //~ ERROR expects 1 parameter but 2 + | ^^^^ + +error: `has_one` route uri expects 1 parameter but 2 were supplied + --- note: expected parameter: id: i32 + --> $DIR/typed-uris-bad-params.rs:23:19 + | +23 | uri!(has_one: "Hello", 23, ); //~ ERROR expects 1 parameter but 2 + | ^^^^^^^ + +error: `has_one` route uri expects 1 parameter but 2 were supplied + --- note: expected parameter: id: i32 + --> $DIR/typed-uris-bad-params.rs:22:19 + | +22 | uri!(has_one: 1, 23); //~ ERROR expects 1 parameter but 2 + | ^ + +error: `has_one` route uri expects 1 parameter but 0 were supplied + --- note: expected parameter: id: i32 + --> $DIR/typed-uris-bad-params.rs:20:10 + | +20 | uri!(has_one); //~ ERROR expects 1 parameter but 0 + | ^^^^^^^ + +warning: unused import: `std::fmt` + --> $DIR/typed-uris-bad-params.rs:3:5 + | +3 | use std::fmt; + | ^^^^^^^^ + | + = note: `#[warn(unused_imports)]` on by default diff --git a/core/codegen/tests/ui-fail-stable/typed-uris-invalid-syntax.rs b/core/codegen/tests/ui-fail-stable/typed-uris-invalid-syntax.rs new file mode 120000 index 00000000..f43a7bda --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/typed-uris-invalid-syntax.rs @@ -0,0 +1 @@ +../ui-fail/typed-uris-invalid-syntax.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail-stable/typed-uris-invalid-syntax.stderr b/core/codegen/tests/ui-fail-stable/typed-uris-invalid-syntax.stderr new file mode 100644 index 00000000..699c156b --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/typed-uris-invalid-syntax.stderr @@ -0,0 +1,65 @@ +error: named and unnamed parameters cannot be mixed + --> $DIR/typed-uris-invalid-syntax.rs:7:18 + | +7 | uri!(simple: id = 100, "Hello"); //~ ERROR named and unnamed + | ^^ + +error: named and unnamed parameters cannot be mixed + --> $DIR/typed-uris-invalid-syntax.rs:8:18 + | +8 | uri!(simple: "Hello", id = 100); //~ ERROR named and unnamed + | ^^^^^^^ + +error: expected `:` + --> $DIR/typed-uris-invalid-syntax.rs:9:16 + | +9 | uri!(simple,); //~ ERROR expected `:` + | ^ + +error: expected argument list after `:` + --> $DIR/typed-uris-invalid-syntax.rs:10:16 + | +10 | uri!(simple:); //~ ERROR argument list + | ^ + +error: unexpected end of input: expected ',' followed by route path + --> $DIR/typed-uris-invalid-syntax.rs:11:10 + | +11 | uri!("/mount"); //~ ERROR route path + | ^^^^^^^^ + +error: unexpected end of input, expected identifier + --> $DIR/typed-uris-invalid-syntax.rs:12:5 + | +12 | uri!("/mount",); //~ ERROR expected identifier + | ^^^^^^^^^^^^^^^^ + | + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid mount point; mount points must be static, absolute URIs: `/example` + --> $DIR/typed-uris-invalid-syntax.rs:13:10 + | +13 | uri!("mount", simple); //~ invalid mount point + | ^^^^^^^ + +error: invalid mount point; mount points must be static, absolute URIs: `/example` + --> $DIR/typed-uris-invalid-syntax.rs:14:10 + | +14 | uri!("/mount/", simple); //~ invalid mount point + | ^^^^^^^^^^^^^ + +error: unexpected end of input, call to `uri!` cannot be empty + --> $DIR/typed-uris-invalid-syntax.rs:15:5 + | +15 | uri!(); //~ unexpected end of input + | ^^^^^^^ + | + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: unexpected end of input, expected expression + --> $DIR/typed-uris-invalid-syntax.rs:16:5 + | +16 | uri!(simple: id = ); //~ expected expression + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/core/codegen/tests/ui-fail-stable/update-references.sh b/core/codegen/tests/ui-fail-stable/update-references.sh new file mode 120000 index 00000000..8b851748 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/update-references.sh @@ -0,0 +1 @@ +../ui-fail/update-references.sh \ No newline at end of file diff --git a/core/codegen/tests/ui-fail-stable/uri_display.rs b/core/codegen/tests/ui-fail-stable/uri_display.rs new file mode 120000 index 00000000..62cfb002 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/uri_display.rs @@ -0,0 +1 @@ +../ui-fail/uri_display.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail-stable/uri_display.stderr b/core/codegen/tests/ui-fail-stable/uri_display.stderr new file mode 100644 index 00000000..2bb20691 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/uri_display.stderr @@ -0,0 +1,493 @@ +error: fieldless structs or variants are not supported + --> $DIR/uri_display.rs:9:1 + | +9 | struct Foo1; + | ^^^^^^ + +error: [note] error occurred while deriving `UriDisplay` + --> $DIR/uri_display.rs:5:10 + | +5 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: fieldless structs or variants are not supported + --> $DIR/uri_display.rs:16:1 + | +16 | struct Foo2(); + | ^^^^^^ + +error: [note] error occurred while deriving `UriDisplay` + --> $DIR/uri_display.rs:12:10 + | +12 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: empty enums are not supported + --> $DIR/uri_display.rs:23:1 + | +23 | enum Foo3 { } + | ^^^^ + +error: [note] error occurred while deriving `UriDisplay` + --> $DIR/uri_display.rs:19:10 + | +19 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: fieldless structs or variants are not supported + --> $DIR/uri_display.rs:31:5 + | +31 | Variant, + | ^^^^^^^ + +error: [note] error occurred while deriving `UriDisplay` + --> $DIR/uri_display.rs:26:10 + | +26 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: tuple structs or variants must have exactly one field + --> $DIR/uri_display.rs:39:13 + | +39 | struct Foo5(String, String); + | ^^^^^^ + +error: [note] error occurred while deriving `UriDisplay` + --> $DIR/uri_display.rs:35:10 + | +35 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid value: expected string literal + --> $DIR/uri_display.rs:47:20 + | +47 | #[form(field = 123)] + | ^^^ + +error: [note] error occurred while deriving `UriDisplay` + --> $DIR/uri_display.rs:42:10 + | +42 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: struct must have exactly one field + --> $DIR/uri_display.rs:55:13 + | +55 | struct Foo7(String, usize); + | ^^^^^^ + +error: [note] error occurred while deriving `UriDisplay` + --> $DIR/uri_display.rs:52:10 + | +52 | #[derive(UriDisplayPath)] + | ^^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: struct must have exactly one field + --> $DIR/uri_display.rs:61:1 + | +61 | struct Foo8; + | ^^^^^^ + +error: [note] error occurred while deriving `UriDisplay` + --> $DIR/uri_display.rs:58:10 + | +58 | #[derive(UriDisplayPath)] + | ^^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: enums are not supported + --> $DIR/uri_display.rs:67:1 + | +67 | enum Foo9 { } + | ^^^^ + +error: [note] error occurred while deriving `UriDisplay` + --> $DIR/uri_display.rs:64:10 + | +64 | #[derive(UriDisplayPath)] + | ^^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: named structs are not supported + --> $DIR/uri_display.rs:73:1 + | +73 | struct Foo10 { + | ^^^^^^ + +error: [note] error occurred while deriving `UriDisplay` + --> $DIR/uri_display.rs:70:10 + | +70 | #[derive(UriDisplayPath)] + | ^^^^^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo1: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:5:10 + | +5 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo1` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo1: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:5:10 + | +5 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo1` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo1` + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo1: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:5:10 + | +5 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo1` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&mut Foo1` + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo2: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:12:10 + | +12 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo2` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo2: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:12:10 + | +12 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo2` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo2` + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo2: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:12:10 + | +12 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo2` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&mut Foo2` + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo3: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:19:10 + | +19 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo3` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo3: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:19:10 + | +19 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo3` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo3` + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo3: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:19:10 + | +19 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo3` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&mut Foo3` + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo4: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:26:10 + | +26 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo4` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo4: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:26:10 + | +26 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo4` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo4` + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo4: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:26:10 + | +26 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo4` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&mut Foo4` + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo5: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:35:10 + | +35 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo5` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo5: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:35:10 + | +35 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo5` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo5` + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo5: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:35:10 + | +35 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo5` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&mut Foo5` + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo6: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:42:10 + | +42 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo6` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo6: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:42:10 + | +42 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo6` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo6` + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo6: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:42:10 + | +42 | #[derive(UriDisplayQuery)] + | ^^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo6` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&mut Foo6` + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo7: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:52:10 + | +52 | #[derive(UriDisplayPath)] + | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo7` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo7: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:52:10 + | +52 | #[derive(UriDisplayPath)] + | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo7` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo7` + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo8: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:58:10 + | +58 | #[derive(UriDisplayPath)] + | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo8` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo8: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:58:10 + | +58 | #[derive(UriDisplayPath)] + | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo8` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo8` + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo9: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:64:10 + | +64 | #[derive(UriDisplayPath)] + | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo9` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo9: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:64:10 + | +64 | #[derive(UriDisplayPath)] + | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo9` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo9` + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo10: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:70:10 + | +70 | #[derive(UriDisplayPath)] + | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo10` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `Foo10: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display.rs:70:10 + | +70 | #[derive(UriDisplayPath)] + | ^^^^^^^^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `Foo10` + | + ::: $WORKSPACE/core/http/src/uri/from_uri_param.rs:195:18 + | +195 | type Target: UriDisplay

; + | ------------- required by this bound in `rocket::http::uri::FromUriParam` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&Foo10` + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/core/codegen/tests/ui-fail-stable/uri_display_type_errors.rs b/core/codegen/tests/ui-fail-stable/uri_display_type_errors.rs new file mode 120000 index 00000000..d17ef8e5 --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/uri_display_type_errors.rs @@ -0,0 +1 @@ +../ui-fail/uri_display_type_errors.rs \ No newline at end of file diff --git a/core/codegen/tests/ui-fail-stable/uri_display_type_errors.stderr b/core/codegen/tests/ui-fail-stable/uri_display_type_errors.stderr new file mode 100644 index 00000000..2029cdda --- /dev/null +++ b/core/codegen/tests/ui-fail-stable/uri_display_type_errors.stderr @@ -0,0 +1,58 @@ +error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display_type_errors.rs:6:13 + | +6 | struct Bar1(BadType); + | ^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `BadType` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&BadType` + +error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display_type_errors.rs:11:5 + | +11 | field: BadType, + | ^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `BadType` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&BadType` + +error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display_type_errors.rs:18:5 + | +18 | bad: BadType, + | ^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `BadType` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&BadType` + +error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display_type_errors.rs:24:11 + | +24 | Inner(BadType), + | ^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `BadType` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&BadType` + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&&BadType` + +error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display_type_errors.rs:31:9 + | +31 | field: BadType, + | ^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `BadType` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&BadType` + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&&BadType` + +error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display_type_errors.rs:40:9 + | +40 | other: BadType, + | ^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `BadType` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&BadType` + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&&BadType` + +error[E0277]: the trait bound `BadType: rocket::http::uri::UriDisplay` is not satisfied + --> $DIR/uri_display_type_errors.rs:46:12 + | +46 | struct Baz(BadType); + | ^^^^^^^ the trait `rocket::http::uri::UriDisplay` is not implemented for `BadType` + | + = note: required because of the requirements on the impl of `rocket::http::uri::UriDisplay` for `&BadType` diff --git a/core/codegen/tests/ui-fail.rs b/core/codegen/tests/ui-fail.rs new file mode 100644 index 00000000..1cd5552a --- /dev/null +++ b/core/codegen/tests/ui-fail.rs @@ -0,0 +1,10 @@ +#[test] +fn ui() { + let path = match version_check::is_feature_flaggable() { + Some(true) => "ui-fail-nightly", + _ => "ui-fail-stable" + }; + + let t = trybuild::TestCases::new(); + t.compile_fail(format!("tests/{}/*.rs", path)); +} diff --git a/core/codegen/tests/ui-fail/route-warnings.rs b/core/codegen/tests/ui-fail/route-warnings.rs index c2265ac0..4f90976b 100644 --- a/core/codegen/tests/ui-fail/route-warnings.rs +++ b/core/codegen/tests/ui-fail/route-warnings.rs @@ -21,4 +21,6 @@ fn g0(_foo: rocket::Data) {} #[head("/", data = "<_foo>")] //~ WARNING used with non-payload-supporting method fn g1(_foo: rocket::Data) {} -fn main() { } +fn main() { + compile_error!("checking for warnings!") +} diff --git a/core/codegen/tests/ui-fail/update-references.sh b/core/codegen/tests/ui-fail/update-references.sh deleted file mode 100755 index da17d7fa..00000000 --- a/core/codegen/tests/ui-fail/update-references.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright 2015 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -# A script to update the references for particular tests. The idea is -# that you do a run, which will generate files in the build directory -# containing the (normalized) actual output of the compiler. This -# script will then copy that output and replace the "expected output" -# files. You can then commit the changes. -# -# If you find yourself manually editing a foo.stderr file, you're -# doing it wrong. - -if [[ "$1" == "--help" || "$1" == "-h" || "$1" == "" || "$2" == "" ]]; then - echo "usage: $0 " - echo "" - echo "For example:" - echo " $0 ../../../build/x86_64-apple-darwin/test/ui *.rs */*.rs" -fi - -MYDIR=$(dirname $0) - -BUILD_DIR="$1" -shift - -shopt -s nullglob - -while [[ "$1" != "" ]]; do - for EXT in "stderr" "fixed"; do - for OUT_NAME in $BUILD_DIR/${1%.rs}.*$EXT; do - OUT_DIR=`dirname "$1"` - OUT_BASE=`basename "$OUT_NAME"` - if ! (diff $OUT_NAME $MYDIR/$OUT_DIR/$OUT_BASE >& /dev/null); then - echo updating $MYDIR/$OUT_DIR/$OUT_BASE - cp $OUT_NAME $MYDIR/$OUT_DIR - fi - done - done - shift -done