You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 29, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 29, 2022. It is now read-only.
You could use getopts if you like - I would personally just manually check for --version and start using getopts if/when command line options get more complicated
error[E0053]: method `early_callback` has an incompatible type for trait
--> src/build.rs:524:13
|
524 | / fn early_callback(&mut self,
525 | | matches: &getopts::Matches,
526 | | sopts: &config::Options,
527 | | cfg: &ast::CrateConfig,
... |
531 | | self.default_calls.early_callback(matches, sopts, cfg, descriptions, output)
532 | | }
| |_____________^ expected struct `getopts::Matches`, found a different struct `getopts::Matches`
|
= note: expected type `fn(&mut build::BuildQueue::rustc::RlsRustcCalls, &getopts::Matches, &build::rustc::session::config::Options, &std::collections::HashSet<(build::syntax::ast::Symbol, std::option::Option<build::syntax::ast::Symbol>)>, &build::errors::registry::Registry, build::rustc::session::config::ErrorOutputType) -> build::rustc_driver::Compilation` (struct `getopts::Matches`)
found type `fn(&mut build::BuildQueue::rustc::RlsRustcCalls, &getopts::Matches, &build::rustc::session::config::Options, &std::collections::HashSet<(build::syntax::ast::Symbol, std::option::Option<build::syntax::ast::Symbol>)>, &build::errors::registry::Registry, build::rustc::session::config::ErrorOutputType) -> build::rustc_driver::Compilation` (struct `getopts::Matches`)
note: Perhaps two different versions of crate `getopts` are being used?
--> src/build.rs:524:13
|
524 | / fn early_callback(&mut self,
525 | | matches: &getopts::Matches,
526 | | sopts: &config::Options,
527 | | cfg: &ast::CrateConfig,
... |
531 | | self.default_calls.early_callback(matches, sopts, cfg, descriptions, output)
532 | | }
| |_____________^
error[E0053]: method `no_input` has an incompatible type for trait
--> src/build.rs:534:13
|
534 | / fn no_input(&mut self,
535 | | matches: &getopts::Matches,
536 | | sopts: &config::Options,
537 | | cfg: &ast::CrateConfig,
... |
542 | | self.default_calls.no_input(matches, sopts, cfg, odir, ofile, descriptions)
543 | | }
| |_____________^ expected struct `getopts::Matches`, found a different struct `getopts::Matches`
|
= note: expected type `fn(&mut build::BuildQueue::rustc::RlsRustcCalls, &getopts::Matches, &build::rustc::session::config::Options, &std::collections::HashSet<(build::syntax::ast::Symbol, std::option::Option<build::syntax::ast::Symbol>)>, &std::option::Option<std::path::PathBuf>, &std::option::Option<std::path::PathBuf>, &build::errors::registry::Registry) -> std::option::Option<(build::rustc::session::config::Input, std::option::Option<std::path::PathBuf>)>` (struct `getopts::Matches`)
found type `fn(&mut build::BuildQueue::rustc::RlsRustcCalls, &getopts::Matches, &build::rustc::session::config::Options, &std::collections::HashSet<(build::syntax::ast::Symbol, std::option::Option<build::syntax::ast::Symbol>)>, &std::option::Option<std::path::PathBuf>, &std::option::Option<std::path::PathBuf>, &build::errors::registry::Registry) -> std::option::Option<(build::rustc::session::config::Input, std::option::Option<std::path::PathBuf>)>` (struct `getopts::Matches`)
note: Perhaps two different versions of crate `getopts` are being used?
--> src/build.rs:534:13
|
534 | / fn no_input(&mut self,
535 | | matches: &getopts::Matches,
536 | | sopts: &config::Options,
537 | | cfg: &ast::CrateConfig,
... |
542 | | self.default_calls.no_input(matches, sopts, cfg, odir, ofile, descriptions)
543 | | }
| |_____________^
error[E0053]: method `late_callback` has an incompatible type for trait
--> src/build.rs:545:13
|
545 | / fn late_callback(&mut self,
546 | | matches: &getopts::Matches,
547 | | sess: &Session,
548 | | input: &Input,
... |
552 | | self.default_calls.late_callback(matches, sess, input, odir, ofile)
553 | | }
| |_____________^ expected struct `getopts::Matches`, found a different struct `getopts::Matches`
|
= note: expected type `fn(&mut build::BuildQueue::rustc::RlsRustcCalls, &getopts::Matches, &build::rustc::session::Session, &build::rustc::session::config::Input, &std::option::Option<std::path::PathBuf>, &std::option::Option<std::path::PathBuf>) -> build::rustc_driver::Compilation` (struct `getopts::Matches`)
found type `fn(&mut build::BuildQueue::rustc::RlsRustcCalls, &getopts::Matches, &build::rustc::session::Session, &build::rustc::session::config::Input, &std::option::Option<std::path::PathBuf>, &std::option::Option<std::path::PathBuf>) -> build::rustc_driver::Compilation` (struct `getopts::Matches`)
note: Perhaps two different versions of crate `getopts` are being used?
--> src/build.rs:545:13
|
545 | / fn late_callback(&mut self,
546 | | matches: &getopts::Matches,
547 | | sess: &Session,
548 | | input: &Input,
... |
552 | | self.default_calls.late_callback(matches, sess, input, odir, ofile)
553 | | }
| |_____________^
error[E0053]: method `build_controller` has an incompatible type for trait
--> src/build.rs:555:13
|
555 | / fn build_controller(&mut self,
556 | | sess: &Session,
557 | | matches: &getopts::Matches)
558 | | -> CompileController<'a> {
... |
575 | | result
576 | | }
| |_____________^ expected struct `getopts::Matches`, found a different struct `getopts::Matches`
|
= note: expected type `fn(&mut build::BuildQueue::rustc::RlsRustcCalls, &build::rustc::session::Session, &getopts::Matches) -> build::rustc_driver::driver::CompileController<'a>` (struct `getopts::Matches`)
found type `fn(&mut build::BuildQueue::rustc::RlsRustcCalls, &build::rustc::session::Session, &getopts::Matches) -> build::rustc_driver::driver::CompileController<'a>` (struct `getopts::Matches`)
note: Perhaps two different versions of crate `getopts` are being used?
--> src/build.rs:555:13
|
555 | / fn build_controller(&mut self,
556 | | sess: &Session,
557 | | matches: &getopts::Matches)
558 | | -> CompileController<'a> {
... |
575 | | result
576 | | }
| |_____________^
error: aborting due to 4 previous errors
error: Could not compile `rls`.
2. If I use getopts which is an indirect dependency,_
error[E0432]: unresolved import `getopts::Options`
--> src/version.rs:1:15
|
1 | use getopts::{Options, Matches};
| ^^^^^^^ no `Options` in the root
error: aborting due to previous error
error: Could not compile `rls`.
That looks like there's two different versions of getopts. What I've done to solve this kind of issue is install cargo tree and then run cargo tree | grep getopts which should show you all versions being compiled. If you change the getopts version to match the existing ones used by the dependencies, then this should compile.
This indirect dependency getopts is v0.2.14 and is introduced rustfmt v0.8.3 (https://github.com/rust-lang-nursery/rustfmt#7a257732).
However, build::RlsRustcCalls::early_callback is the implementation of self::rustc_driver::CompilerCalls. So its getopts is specified in librustc_driver. It could not suceed to compile even if I specify a arbitrary version in Cargo.toml.
What is the better way to resolve this complex puzzle?
Activity
tetsuharuohzeki commentedon May 10, 2017
related issue rust-lang/rust#41197
tetsuharuohzeki commentedon May 10, 2017
Which should we use to implement this?
tetsuharuohzeki commentedon May 10, 2017
@nrc @jonathandturner
How do you think about it?
nrc commentedon May 10, 2017
You could use getopts if you like - I would personally just manually check for
--versionand start using getopts if/when command line options get more complicatedtetsuharuohzeki commentedon May 10, 2017
I faced to these problems 😢
1. If I add
getoptstoCargo.toml's,_then rustc happening following compile error:
2. If I use
getoptswhich is an indirect dependency,_I'll just check
--versionflag manually.Nashenas88 commentedon May 10, 2017
That looks like there's two different versions of getopts. What I've done to solve this kind of issue is install cargo tree and then run
cargo tree | grep getoptswhich should show you all versions being compiled. If you change the getopts version to match the existing ones used by the dependencies, then this should compile.tetsuharuohzeki commentedon May 10, 2017
@Nashenas88
This indirect dependency
getoptsisv0.2.14and is introducedrustfmt v0.8.3 (https://github.com/rust-lang-nursery/rustfmt#7a257732).However,
build::RlsRustcCalls::early_callbackis the implementation ofself::rustc_driver::CompilerCalls. So itsgetoptsis specified inlibrustc_driver. It could not suceed to compile even if I specify a arbitrary version in Cargo.toml.What is the better way to resolve this complex puzzle?
nrc commentedon May 10, 2017
I would not use getopts and parse the command line arguments manually (long term we might need to do something else).
tetsuharuohzeki commentedon May 11, 2017
Fixed by #308