Skip to content
This repository has been archived by the owner on Aug 23, 2022. It is now read-only.

Lifetime parameters on functions cause thunderclap attribute to panic #23

Open
Pzixel opened this issue Jun 22, 2018 · 2 comments
Open
Labels
bug Something isn't working

Comments

@Pzixel
Copy link

Pzixel commented Jun 22, 2018

For example, it's not clear how to run app with more than one parameter:

/// App
#[thunderclap]
impl App {
    /// run
    fn run<'a, 'b>(token: &'a str, listening_address: &'b str) {
        println!("Hello {}, my address is {}", token, listening_address);
    }
}
error[E0599]: no function or associated item named `run` found for type `clap::App<'_, '_>` in the current scope
  --> src\main.rs:28:1
   |
28 | #[thunderclap]
   | ^^^^^^^^^^^^^^ function or associated item not found in `clap::App<'_, '_>`

error: aborting due to previous error
@spacekookie
Copy link
Collaborator

Hey, you don't need to specify the lifetime parameters on that function. If you look at the thor example you'll see that the hello function takes a name: &str but because it is never returned from that function the lifetime is very clear.

I'll rename this issue because this is a bug in how thunder parses user code and I think it can't handle lifetime parameters on functions and there should be at least some sort of error message that is more helpful to the user.

@spacekookie spacekookie added the bug Something isn't working label Jun 22, 2018
@spacekookie spacekookie changed the title Add more examples Lifetime parameters on functions cause thunderclap attribute to panic Jun 22, 2018
@Pzixel
Copy link
Author

Pzixel commented Jun 22, 2018

@spacekookie i thought you cannot not specify lifetime parameters because they lifetimes cannot be elised. Sorry, the error message misled me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants