Skip to content

Unable to write documentation for similar ending routes #1373

@Kaiden42

Description

@Kaiden42

Hello, I'm trying to write some documentation for my project and noticed, that I'm unable to write documentation for routes that have a similar ending. For example: /user/add and /survey/add. Both routes are in different modules.

  • Rocket version: Master branch
  • Rust version: rustc 1.46.0-nightly (346aec9b0 2020-07-11)
  • Os: Linux Mint 20 Cinnamon Edition (beta)

Here is a small working example of my code:

#![feature(proc_macro_hygiene, decl_macro)]

#[macro_use] extern crate rocket;
use tokio::runtime;

mod survey {
    #[get("/survey/add")]
    pub fn add() {

    }
}

mod user {
    #[get("/user/add")]
    pub fn add() {

    }
}

fn main() {
    let mut rb = runtime::Builder::new()
        .basic_scheduler().enable_all().build().unwrap();

    rb.block_on(rocket::ignite()
        .mount("/", routes![survey::add, user::add])
        .launch()).unwrap();
}

Everything works fine until I start to add some documentation like this:

    ...

    /// Route to add a survey.
    #[get("/survey/add")]
    pub fn add() {

    ...

    /// Route to add a user.
    #[get("/user/add")]
    pub fn add() {

    ...

I'm able to document the first route but after the second one I get the following error message from the compiler:

error[E0428]: the name `rocket_uri_macro_add9134641248968336068` is defined multiple times
  --> src/main.rs:16:5
   |
8  |     #[get("/survey/add")]
   |     --------------------- previous definition of the macro `rocket_uri_macro_add9134641248968336068` here
...
16 |     #[get("/user/add")]
   |     ^^^^^^^^^^^^^^^^^^^ `rocket_uri_macro_add9134641248968336068` redefined here
   |
   = note: `rocket_uri_macro_add9134641248968336068` must be defined only once in the macro namespace of this module
   = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)

This only happens if the routes end similarly. It should be possible to document routes of this type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    deficiencySomething doesn't work as well as it couldupstreamAn unresolvable issue: an upstream dependency bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions