rwf2 / Rocket

A web framework for Rust.
https://rocket.rs
Other
24.17k stars 1.55k forks source link

debug!("Received request: {:#?}", hyp_req); #2662

Closed zlei9 closed 9 months ago

zlei9 commented 9 months ago

I‘m run the sample of hello on v0,5, it shows:

warning: an associated function with this name may be added to the standard library in the future
  --> D:\rust\Rocket\core\lib\src\server.rs:76:5
   |
76 |     debug!("Received request: {:#?}", hyp_req);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior!
   = note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919>
   = help: call with fully qualified syntax `new(...)` to keep using the current method
   = note: `#[warn(unstable_name_collisions)]` on by default
   = note: this warning originates in the macro `$crate::__private_api::format_args` which comes from the expansion of the macro `debug` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0061]: this function takes 1 argument but 0 arguments were supplied
  --> D:\rust\Rocket\core\lib\src\server.rs:76:5
   |
76 |     debug!("Received request: {:#?}", hyp_req);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ an argument of type `UnsafeArg` is missing
   |
note: associated function defined here
  --> C:\Users\ZLEI\.cargo\registry\src\github.com-1ecc6299db9ec823\yansi-1.0.0-rc.1\src\paint.rs:56:8
   |
56 |     fn new(self) -> Painted<Self> where Self: Sized {
   |        ^^^
   = note: this error originates in the macro `$crate::__private_api::format_args` which comes from the expansion of the macro `debug` (in Nightly builds, run with -Z macro-backtrace for more info)
help: provide the argument
  --> C:\Users\ZLEI\.cargo\registry\src\github.com-1ecc6299db9ec823\log-0.4.20\src\macros.rs:51:62
   |
51 |                 $crate::__private_api::format_args!($($arg)+)(/* UnsafeArg */),
   |                                                              +++++++++++++++++

error[E0308]: mismatched types
  --> D:\rust\Rocket\core\lib\src\server.rs:76:5
   |
76 |     debug!("Received request: {:#?}", hyp_req);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `UnsafeArg`, found struct `Painted`
   |
   = note: expected struct `UnsafeArg`
              found struct `Painted<UnsafeArg>`
   = note: this error originates in the macro `$crate::__private_api::format_args` which comes from the expansion of the macro `debug` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: an associated function with this name may be added to the standard library in the future
   --> D:\rust\Rocket\core\lib\src\server.rs:163:9
    |
163 |         debug!("sending response: {:#?}", hyp_response);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior!
    = note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919>
    = help: call with fully qualified syntax `new(...)` to keep using the current method
    = note: this warning originates in the macro `$crate::__private_api::format_args` which comes from the expansion of the macro `debug` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0061]: this function takes 1 argument but 0 arguments were supplied
   --> D:\rust\Rocket\core\lib\src\server.rs:163:9
    |
163 |         debug!("sending response: {:#?}", hyp_response);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ an argument of type `UnsafeArg` is missing
    |
note: associated function defined here
   --> C:\Users\ZLEI\.cargo\registry\src\github.com-1ecc6299db9ec823\yansi-1.0.0-rc.1\src\paint.rs:56:8
    |
56  |     fn new(self) -> Painted<Self> where Self: Sized {
    |        ^^^
    = note: this error originates in the macro `$crate::__private_api::format_args` which comes from the expansion of the macro `debug` (in Nightly builds, run with -Z macro-backtrace for more info)
help: provide the argument
   --> |C:\Users\ZLEI\.cargo\registry\src\github.com-1ecc6299db9ec823\log-0.4.20\src\macros.rs:51:62
    |
51  |                 $crate::__private_api::format_args!($($arg)+)(/* UnsafeArg */),
    |                                                              +++++++++++++++++

error[E0308]: mismatched types
   --> D:\rust\Rocket\core\lib\src\server.rs:163:9
    |
163 |         debug!("sending response: {:#?}", hyp_response);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `UnsafeArg`, found struct `Painted`
    |
    = note: expected struct `UnsafeArg`
               found struct `Painted<UnsafeArg>`
    = note: this error originates in the macro `$crate::__private_api::format_args` which comes from the expansion of the macro `debug` (in Nightly builds, run with -Z macro-backtrace for more info)

Some errors have detailed explanations: E0061, E0308.
For more information about an error, try `rustc --explain E0061`.
warning: `rocket` (lib) generated 2 warnings
error: could not compile `rocket` due to 4 previous errors; 2 warnings emitted
SergioBenitez commented 9 months ago

Can you provide all of the information requested by the issue template?

In particular, your compiler version. I believe this is some sort of bug in some rustc. Updating your compiler will probably resolve it.

SergioBenitez commented 9 months ago

The CI also confirms that this is not an issue on any of the recent stable or nightly releases. Closing.

LanderN commented 9 months ago

I have the same issue trying to compile an application using rocket in a buildroot package (for embedded linux). We're currently on buildroot 2023.02.7, which ships rust 1.67.1 (see https://github.com/buildroot/buildroot/blob/2023.02.8/package/rust-bin/rust-bin.mk). In this context it is not always trivial to bump rustc.

SergioBenitez commented 9 months ago

I'll see if there's something we can do to circumvent the rustc issue. In any case, this would be a change in figment, not Rocket.