Skip to content

Instantly share code, notes, and snippets.

@mysteriouspants
Created January 12, 2017 06:04
Show Gist options
  • Save mysteriouspants/c98da2e32a08530683b36616918c7fb3 to your computer and use it in GitHub Desktop.
Save mysteriouspants/c98da2e32a08530683b36616918c7fb3 to your computer and use it in GitHub Desktop.
➜ oxi master ✗ cargo build
Compiling oxi v0.1.0 (file:///Users/xpm/Dropbox/Code/oxi)
error[E0530]: match bindings cannot shadow statics
--> src/main.rs:58:10
|
20 | use new::{new, new_command, NEW_COMMAND_NAME};
| ---------------- a static `NEW_COMMAND_NAME` is imported here
...
58 | Some(NEW_COMMAND_NAME) => { new(&context); }
| ^^^^^^^^^^^^^^^^ cannot be named the same as a static
error[E0530]: match bindings cannot shadow statics
--> src/main.rs:59:10
|
19 | use build::{build, build_command, BUILD_COMMAND_NAME};
| ------------------ a static `BUILD_COMMAND_NAME` is imported here
...
59 | Some(BUILD_COMMAND_NAME) => { build(&context); }
| ^^^^^^^^^^^^^^^^^^ cannot be named the same as a static
error[E0530]: match bindings cannot shadow statics
--> src/main.rs:60:10
|
21 | use serve::{serve, serve_command, SERVE_COMMAND_NAME};
| ------------------ a static `SERVE_COMMAND_NAME` is imported here
...
60 | Some(SERVE_COMMAND_NAME) => { serve(&context); }
| ^^^^^^^^^^^^^^^^^^ cannot be named the same as a static
error: aborting due to 3 previous errors
error: Could not compile `oxi`.
To learn more, run the command again with --verbose.
use build::{build, BUILD_COMMAND_NAME};
use new::{new, NEW_COMMAND_NAME};
use serve::{serve, SERVE_COMMAND_NAME};
// ..
match context.args.subcommand_name() {
Some(NEW_COMMAND_NAME) => { new(&context); }
Some(BUILD_COMMAND_NAME) => { build(&context); }
Some(SERVE_COMMAND_NAME) => { serve(&context); }
_ => { error!(context.log, "this code should be unreachable"); }
}
// build.rs
pub static BUILD_COMMAND_NAME: &'static str = "build";
// new.rs
pub static NEW_COMMAND_NAME: &'static str = "new";
// serve.rs
pub static SERVE_COMMAND_NAME: &'static str = "serve";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment