Skip to content

Can't use reexported function with same name as file in route!. Is this intended? #1801

Discussion options

You must be logged in to vote

No, it's not intentional. But I'm also not sure if it's too easily avoidable.

The problem does have to do with the name clash:

I have a function health_check in src/routes/health_check.rs and reexport it in src/routes/mod.rs/ with pub use health_check::*;.

At this point you would have a module, routes, with these items in it: mod health_check;, fn health_check, and struct health_check. (struct health_check was generated by rocket). But because that struct has the same name as the module health_check, pub use health_check::*; does not reexport it. You can see this behavior in this playground example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=2ba98a811cf614dd…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@arctic-alpaca
Comment options

Answer selected by arctic-alpaca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants