mirror of
https://github.com/rwf2/Rocket.git
synced 2025-02-26 10:32:08 +00:00
This commit complete the migration to 'tracing' for all logging. Below is a summary of all relevant commits, including this one: Log improvements: - All log (trace) messages are structured which means they contain fields that can formatted by any subscriber. - Logging can be disabled entirely by disabling the default `trace` feature. - Routes and catchers now contain location (file/line) information. - Two log format kinds: pretty and compact via ROCKET_LOG_FORMAT - Coloring is not disabled globally. Thus applications can color even if Rocket is configured not to. - Rocket is more conservative about 'warn' and 'error' messages, reserving those log levels for messages useful in production. - Errors from guards logged by codegen now use the 'Display' implementation of those errors when one exists. - Secrets are never logged, even when directly asked for. New features: - Many Rocket types know how to trace themselves via a new `Trace` trait. - `Either` types can now be used in `uri!()` calls. - A `RequestIdLayer` tags all requests with a unique ID. Breaking changes to configuration: - `Config::log_level` is of type `Option<Level>`. `None` disables tracing. - `log_level` now uses the traditional log level names: "off", "error", "warn", "info", "debug", "trace", or 0-5. This replace the Rocket-specific "normal", "debug", "critical". - A new option, `log_format`, which is either `compact` or `pretty`, determines how Rocket's tracing subscriber log trace messages. Breaking changes: - Hidden `rocket::Either` is now publicly available at `rocket::either::Either`. - `rocket::Error` no longer panics when dropped. - `main` generated by `#[launch]` returns an `ExitCode`. - `FromParam` `Err` now always returns the actual error as opposed to the string that failed to parse. To recover the original string, use `Either<T, &str>`, where `T: FromParam`, as a parameter guard. - Many types that implemented `Display` now instead implement `Trace`. - `Error::pretty_print()` was removed. Use `Error::trace()` via `Trace` impl. Internal improvements: - Made more space in CI machines for tasks. - Cleaned up testbench code using `inventory`. Resolves #21.
182 lines
6.3 KiB
Plaintext
182 lines
6.3 KiB
Plaintext
error: attribute can only be applied to `async` functions
|
|
--> tests/ui-fail-nightly/async-entry.rs:4:5
|
|
|
|
|
4 | #[rocket::main]
|
|
| ^^^^^^^^^^^^^^^
|
|
|
|
|
note: this function must be `async`
|
|
--> tests/ui-fail-nightly/async-entry.rs:5:5
|
|
|
|
|
5 | fn foo() { }
|
|
| ^^^^^^^^
|
|
= note: this error originates in the attribute macro `rocket::main` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
warning: attribute is typically applied to `main` function
|
|
--> tests/ui-fail-nightly/async-entry.rs:10:5
|
|
|
|
|
10 | #[rocket::main]
|
|
| ^^^^^^^^^^^^^^^
|
|
|
|
|
note: this function is not `main`
|
|
--> tests/ui-fail-nightly/async-entry.rs:11:14
|
|
|
|
|
11 | async fn foo() { }
|
|
| ^^^
|
|
= note: apply `#[suppress(arbitrary_main)]` before the item to suppress this lint
|
|
= note: this warning originates in the attribute macro `rocket::main` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: attribute can only be applied to `async` functions
|
|
--> tests/ui-fail-nightly/async-entry.rs:16:5
|
|
|
|
|
16 | #[rocket::main]
|
|
| ^^^^^^^^^^^^^^^
|
|
|
|
|
note: this function must be `async`
|
|
--> tests/ui-fail-nightly/async-entry.rs:17:5
|
|
|
|
|
17 | fn main() {
|
|
| ^^^^^^^^^
|
|
= note: this error originates in the attribute macro `rocket::main` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: attribute cannot be applied to `main` function
|
|
--> tests/ui-fail-nightly/async-entry.rs:49:5
|
|
|
|
|
49 | #[rocket::launch]
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: this attribute generates a `main` function
|
|
note: this function cannot be `main`
|
|
--> tests/ui-fail-nightly/async-entry.rs:50:8
|
|
|
|
|
50 | fn main() -> rocket::Rocket<rocket::Build> {
|
|
| ^^^^
|
|
= note: this error originates in the attribute macro `rocket::launch` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: attribute can only be applied to functions that return a value
|
|
--> tests/ui-fail-nightly/async-entry.rs:56:5
|
|
|
|
|
56 | #[rocket::launch]
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
|
note: this function must return a value
|
|
--> tests/ui-fail-nightly/async-entry.rs:57:5
|
|
|
|
|
57 | async fn rocket() {
|
|
| ^^^^^^^^^^^^^^^^^
|
|
= note: this error originates in the attribute macro `rocket::launch` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: attribute can only be applied to functions that return a value
|
|
--> tests/ui-fail-nightly/async-entry.rs:64:5
|
|
|
|
|
64 | #[rocket::launch]
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
|
note: this function must return a value
|
|
--> tests/ui-fail-nightly/async-entry.rs:65:5
|
|
|
|
|
65 | fn rocket() {
|
|
| ^^^^^^^^^^^
|
|
= note: this error originates in the attribute macro `rocket::launch` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: attribute cannot be applied to `main` function
|
|
--> tests/ui-fail-nightly/async-entry.rs:79:5
|
|
|
|
|
79 | #[rocket::launch]
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: this attribute generates a `main` function
|
|
note: this function cannot be `main`
|
|
--> tests/ui-fail-nightly/async-entry.rs:80:8
|
|
|
|
|
80 | fn main() -> &'static str {
|
|
| ^^^^
|
|
= note: this error originates in the attribute macro `rocket::launch` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: attribute cannot be applied to `main` function
|
|
--> tests/ui-fail-nightly/async-entry.rs:87:5
|
|
|
|
|
87 | #[rocket::launch]
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: this attribute generates a `main` function
|
|
note: this function cannot be `main`
|
|
--> tests/ui-fail-nightly/async-entry.rs:88:14
|
|
|
|
|
88 | async fn main() -> _ {
|
|
| ^^^^
|
|
= note: this error originates in the attribute macro `rocket::launch` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error[E0728]: `await` is only allowed inside `async` functions and blocks
|
|
--> tests/ui-fail-nightly/async-entry.rs:73:42
|
|
|
|
|
72 | fn rocket() -> _ {
|
|
| ---------------- this is not `async`
|
|
73 | let _ = rocket::build().launch().await;
|
|
| ^^^^^ only allowed inside `async` functions and blocks
|
|
|
|
error[E0277]: `main` has invalid return type `Rocket<Build>`
|
|
--> tests/ui-fail-nightly/async-entry.rs:94:20
|
|
|
|
|
94 | async fn main() -> rocket::Rocket<rocket::Build> {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `main` can only return types that implement `Termination`
|
|
|
|
|
= help: consider using `()`, or a `Result`
|
|
|
|
error[E0308]: mismatched types
|
|
--> tests/ui-fail-nightly/async-entry.rs:35:9
|
|
|
|
|
33 | async fn rocket() -> String {
|
|
| ------ expected `std::string::String` because of return type
|
|
34 | let _ = rocket::build().launch().await;
|
|
35 | rocket::build()
|
|
| ^^^^^^^^^^^^^^^ expected `String`, found `Rocket<Build>`
|
|
|
|
|
= note: expected struct `std::string::String`
|
|
found struct `Rocket<Build>`
|
|
|
|
error[E0308]: mismatched types
|
|
--> tests/ui-fail-nightly/async-entry.rs:44:9
|
|
|
|
|
42 | async fn rocket() -> _ {
|
|
| - expected `Rocket<Build>` because of return type
|
|
43 | let _ = rocket::build().launch().await;
|
|
44 | "hi".to_string()
|
|
| ^^^^^^^^^^^^^^^^ expected `Rocket<Build>`, found `String`
|
|
|
|
|
= note: expected struct `Rocket<Build>`
|
|
found struct `std::string::String`
|
|
|
|
error[E0308]: mismatched types
|
|
--> tests/ui-fail-nightly/async-entry.rs:24:21
|
|
|
|
|
24 | async fn main() {
|
|
| ____________________-^
|
|
| | |
|
|
| | expected `()` because of default return type
|
|
25 | | rocket::build()
|
|
26 | | }
|
|
| | ^- help: consider using a semicolon here: `;`
|
|
| |_____|
|
|
| expected `()`, found `Rocket<Build>`
|
|
|
|
|
= note: expected unit type `()`
|
|
found struct `Rocket<Build>`
|
|
|
|
error[E0308]: mismatched types
|
|
--> tests/ui-fail-nightly/async-entry.rs:35:9
|
|
|
|
|
35 | rocket::build()
|
|
| ^^^^^^^^^^^^^^^ expected `String`, found `Rocket<Build>`
|
|
|
|
|
= note: expected struct `std::string::String`
|
|
found struct `Rocket<Build>`
|
|
|
|
error[E0308]: mismatched types
|
|
--> tests/ui-fail-nightly/async-entry.rs:44:9
|
|
|
|
|
44 | "hi".to_string()
|
|
| ^^^^^^^^^^^^^^^^ expected `Rocket<Build>`, found `String`
|
|
|
|
|
= note: expected struct `Rocket<Build>`
|
|
found struct `std::string::String`
|