tower-web icon indicating copy to clipboard operation
tower-web copied to clipboard

impl_web only allowed once (per module?)

Open shepmaster opened this issue 7 years ago • 1 comments

error[E0428]: the name `ProcMacroHack` is defined multiple times
   --> src/tower_web_server.rs:29:1
    |
29  | / impl_web! {
30  | |     impl Assets {
31  | |         /// @get("/")
32  | |         /// @content_type("text/plain")
...   |
129 | |     }
130 | | }
    | |_^ `ProcMacroHack` redefined here
...
133 | / impl_web! {
134 | |     impl Sandbox {
135 | |         /// @get("/compile")
136 | |         /// @content_type("text/plain")
...   |
140 | |     }
141 | | }
    | |_- previous definition of the type `ProcMacroHack` here
    |
    = note: `ProcMacroHack` must be defined only once in the type namespace of this module
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

shepmaster avatar Jul 29 '18 01:07 shepmaster

Yes, this is a limitation and will go away once attr macros hit stable.

You can work around by putting multiple impl blocks in a single `impl_web! macro.

carllerche avatar Jul 29 '18 03:07 carllerche