Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

external_subcommand: error[E0425]: cannot find value other in this scope #447

Closed
d-e-s-o opened this issue Nov 29, 2020 · 1 comment · Fixed by #448 or tbillington/kondo#34
Closed

Comments

@d-e-s-o
Copy link

d-e-s-o commented Nov 29, 2020

I have the same sample program as over in #424:

use structopt::StructOpt;

macro_rules! Command {
  ( $name:ident, [
    #[$meta:meta] $var:ident($inner:ty)
  ] ) => {
    #[derive(Debug, PartialEq, structopt::StructOpt)]
    enum $name {
      #[$meta] $var($inner),
    }
  };
}

Command! {GitCmd, [
  #[structopt(external_subcommand)]
  Ext(Vec<String>)
]}

fn main() {
  assert_eq!(
    GitCmd::from_iter(&["test", "git", "status"]),
    GitCmd::Ext(vec!["git".to_string(), "status".to_string()]),
  );
}

Now it fails to compile with:

error[E0425]: cannot find value `other` in this scope
  --> src/main.rs:16:11
   |
16 |   Ext(Vec<String>)
   |           ^^^^^^ not found in this scope

Seems to be yet another span issue. Also related is 0852b91, which changes the error from something along the lines of

error: The type must be either `Vec<String>` or `Vec<OsString>` to be used with `external_subcommand`.
   --> main.rs:25:18
    |
25  |             $var$(($inner))?,
    |                    ^^^^^^
    |

to the above. I am using Rust 1.48. I am absolutely positive it worked with earlier Rust versions at some point (in fact, I still have the logs of a successful CI run with 1.42.0), but I can't try with all other Rust versions right now. I experimented with structopt 0.3.17 to 0.3.20, all exhibit either of the issues mentioned above (so the combination of structopt 0.3.17 with structopt-derive 0.4.10 and Rust 1.42.0 is/was known good)

CreepySkeleton added a commit that referenced this issue Nov 30, 2020
@CreepySkeleton CreepySkeleton mentioned this issue Nov 30, 2020
CreepySkeleton added a commit that referenced this issue Nov 30, 2020
@d-e-s-o
Copy link
Author

d-e-s-o commented Dec 1, 2020

Thanks for the quick turn around and for adding a test!

d-e-s-o added a commit to d-e-s-o/nitrocli that referenced this issue Dec 1, 2020
This change updates the structopt crate to version 0.3.21. We need this
version as it fixes a compilation error [0] when using the
external_subcommand enum variant annotation provided by the crate with
certain versions of Rust.

[0]: TeXitoi/structopt#447
d-e-s-o added a commit to d-e-s-o/nitrocli that referenced this issue Jan 10, 2021
This change updates the structopt crate to version 0.3.21. We need this
version as it fixes a compilation error [0] when using the
external_subcommand enum variant annotation provided by the crate with
certain versions of Rust.

[0]: TeXitoi/structopt#447
d-e-s-o added a commit to d-e-s-o/nitrocli that referenced this issue Jan 11, 2021
This change updates the structopt crate to version 0.3.21. We need this
version as it fixes a compilation error [0] when using the
external_subcommand enum variant annotation provided by the crate with
certain versions of Rust.

[0]: TeXitoi/structopt#447
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant