You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When encountering an (expected) error in route codegen with a mismatched path variable and function argument, the compiler error mesage includes terminal color escape codes as literal text, making the error message difficult to read.
Test Case
use rocket::{get, routes};#[get("/hello/<name>")]fnhello(other:&str) -> String{format!("Hello, {other}!")}#[rocket::launch]fnrocket() -> rocket::Rocket<rocket::Build>{
rocket::build().mount("/",routes![hello])}
Log Output
❯ ROCKET_LOG_LEVEL=debug cargo build
Compiling rocketroutetest v0.1.0 (/Users/robjwells/Desktop/rocketroutetest)
error: unused parameter
--> src/main.rs:3:7
|
3 |#[get("/hello/<name>")]| ^^^^^^^^^^^^^^^
error: ␛[1;34m[␛[0m␛[1;32mnote␛[0m␛[1;34m] ␛[0m␛[1;39mexpected argument named `name` here␛[0m
--> src/main.rs:4:9
|
4 | fn hello(other: &str) -> String {
| ^^^^^^^^^^^^^
error[E0422]: cannot find struct, variant or union type`hello`in this scope
--> src/main.rs:10:40
|
10 |rocket::build().mount("/", routes![hello])
| ^^^^^ not found in this scope
For more information about this error, try `rustc --explain E0422`.
error: could not compile `rocketroutetest` (bin "rocketroutetest") due to 3 previous errors
the10thWiz
added
bug
Deviation from the specification or expected behavior
deficiency
Something doesn't work as well as it could
upstream
An unresolvable issue: an upstream dependency bug
and removed
triage
A bug report being investigated
bug
Deviation from the specification or expected behavior
deficiency
Something doesn't work as well as it could
labels
Jan 20, 2025
This looks like a fairly straight forward issue with proc-macro2-diagnostics. It's using yansi internally (outside of rocket) to add color the compile timeout output.
This appears to be related to the compiler version, since running on nightly solves this issue. I've reported this issue upstream (SergioBenitez/proc-macro2-diagnostics#11).
Rocket Version
0.5.1
Operating System
macOS 12.7.6
Rust Toolchain Version
rustc 1.84.0 (9fc6b4312 2025-01-07)
What happened?
When encountering an (expected) error in route codegen with a mismatched path variable and function argument, the compiler error mesage includes terminal color escape codes as literal text, making the error message difficult to read.
Test Case
Log Output
Additional Context
The source of the message is here:
Rocket/core/codegen/src/attribute/route/parse.rs
Lines 118 to 119 in f53611f
This isn't affected by
ROCKET_CLI_COLORS
. There is norocket.toml
in the project. I don't have RUST_LOG or anything similar set in my shell env.System Checks
rustc
toolchain.The text was updated successfully, but these errors were encountered: