Rocket/core/codegen/tests/ui-fail-stable/route-attribute-general-syntax.stderr
Sergio Benitez 64e46b7107 Introduce sentinels: auto-discovered launch abort.
Sentinels resolve a long-standing usability and functional correctness
issue in Rocket: starting an application with guards and/or responders
that depend on state that isn't available. The canonical example is the
'State' guard. Prior to this commit, an application with routes that
queried unmanaged state via 'State' would fail at runtime. With this
commit, the application refuses to launch with a detailed error message.

The 'Sentinel' docs explains it as:

    A sentinel, automatically run on ignition, can trigger a launch
    abort should an instance fail to meet arbitrary conditions. Every
    type that appears in a mounted route's type signature is eligible to
    be a sentinel. Of these, those that implement 'Sentinel' have their
    'abort()' method invoked automatically, immediately after ignition,
    once for each unique type. Sentinels inspect the finalized instance
    of 'Rocket' and can trigger a launch abort by returning 'true'.

The following types are now sentinels:

  * 'contrib::databases::Connection' (any '#[database]' type)
  * 'contrib::templates::Metadata'
  * 'contrib::templates::Template'
  * 'core::State'

The following are "specialized" sentinels, which allow sentinel
discovery even through type aliases:

  * 'Option<T>', 'Debug<T>' if 'T: Sentinel'
  * 'Result<T, E>', 'Either<T, E>' if 'T: Sentinel', 'E: Sentinel'

Closes #464.
2021-04-16 01:44:53 -07:00

204 lines
5.4 KiB
Plaintext

error: missing expected parameter: `uri`
--> $DIR/route-attribute-general-syntax.rs:4:1
|
4 | #[get()]
| ^^^^^^^^
|
= 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:9:1
|
9 | struct S;
| ^^^^^^
error: expected `fn`
--- help: #[get] can only be used on functions
--> $DIR/route-attribute-general-syntax.rs:12:1
|
12 | enum A { }
| ^^^^
error: expected `fn`
--- help: #[get] can only be used on functions
--> $DIR/route-attribute-general-syntax.rs:15:1
|
15 | trait Foo { }
| ^^^^^
error: expected `fn`
--- help: #[get] can only be used on functions
--> $DIR/route-attribute-general-syntax.rs:18:1
|
18 | impl S { }
| ^^^^
error: expected key/value `key = value`
--> $DIR/route-attribute-general-syntax.rs:21:12
|
21 | #[get("/", 123)]
| ^^^
error: expected key/value `key = value`
--> $DIR/route-attribute-general-syntax.rs:24:12
|
24 | #[get("/", "/")]
| ^^^
error: unexpected keyed parameter: expected literal or identifier
--> $DIR/route-attribute-general-syntax.rs:27:7
|
27 | #[get(data = "<foo>", "/")]
| ^^^^
error: unexpected attribute parameter: `unknown`
--> $DIR/route-attribute-general-syntax.rs:30:12
|
30 | #[get("/", unknown = "foo")]
| ^^^^^^^
error: expected key/value `key = value`
--> $DIR/route-attribute-general-syntax.rs:33:12
|
33 | #[get("/", ...)]
| ^^^
error: handler arguments must be named
--- help: to name an ignored handler argument, use `_name`
--> $DIR/route-attribute-general-syntax.rs:39:7
|
39 | fn c1(_: usize) {}
| ^
error: invalid value: expected string literal
--> $DIR/route-attribute-general-syntax.rs:43:7
|
43 | #[get(100)]
| ^^^
error: invalid value: expected string literal
--> $DIR/route-attribute-general-syntax.rs:46:7
|
46 | #[get('/')]
| ^^^
error: invalid value: expected integer literal
--> $DIR/route-attribute-general-syntax.rs:49:19
|
49 | #[get("/", rank = "1")]
| ^^^
error: invalid value: expected integer literal
--> $DIR/route-attribute-general-syntax.rs:52:19
|
52 | #[get("/", rank = '1')]
| ^^^
error: invalid or unknown media type
--> $DIR/route-attribute-general-syntax.rs:57:21
|
57 | #[get("/", format = "applicationx-custom")]
| ^^^^^^^^^^^^^^^^^^^^^
error: invalid or unknown media type
--> $DIR/route-attribute-general-syntax.rs:60:21
|
60 | #[get("/", format = "")]
| ^^
error: invalid or unknown media type
--> $DIR/route-attribute-general-syntax.rs:63:21
|
63 | #[get("/", format = "//")]
| ^^^^
error: invalid or unknown media type
--> $DIR/route-attribute-general-syntax.rs:66:21
|
66 | #[get("/", format = "/")]
| ^^^
error: invalid or unknown media type
--> $DIR/route-attribute-general-syntax.rs:69:21
|
69 | #[get("/", format = "a/")]
| ^^^^
error: invalid or unknown media type
--> $DIR/route-attribute-general-syntax.rs:72:21
|
72 | #[get("/", format = "/a")]
| ^^^^
error: invalid or unknown media type
--> $DIR/route-attribute-general-syntax.rs:75:21
|
75 | #[get("/", format = "/a/")]
| ^^^^^
error: invalid or unknown media type
--> $DIR/route-attribute-general-syntax.rs:78:21
|
78 | #[get("/", format = "a/b/")]
| ^^^^^^
error: invalid or unknown media type
--> $DIR/route-attribute-general-syntax.rs:81:21
|
81 | #[get("/", format = "unknown")]
| ^^^^^^^^^
error: invalid value: expected string literal
--> $DIR/route-attribute-general-syntax.rs:84:21
|
84 | #[get("/", format = 12)]
| ^^
error: invalid value: expected string literal
--> $DIR/route-attribute-general-syntax.rs:87:21
|
87 | #[get("/", format = 'j')]
| ^^^
error: invalid or unknown media type
--> $DIR/route-attribute-general-syntax.rs:90:21
|
90 | #[get("/", format = "text//foo")]
| ^^^^^^^^^^^
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:95:9
|
95 | #[route(CONNECT, "/")]
| ^^^^^^^
error: invalid HTTP method
--- help: method must be one of: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS`
--> $DIR/route-attribute-general-syntax.rs:98:9
|
98 | #[route(FIX, "/")]
| ^^^
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:101:9
|
101 | #[route("hi", "/")]
| ^^^^
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:104:9
|
104 | #[route("GET", "/")]
| ^^^^^
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:107:9
|
107 | #[route(120, "/")]
| ^^^