Add fix and some docs
authorRichard Dodd <richard.dodd@itp-group.co.uk>
Tue, 17 Apr 2018 13:16:58 +0000 (14:16 +0100)
committerRichard Dodd <richard.dodd@itp-group.co.uk>
Tue, 17 Apr 2018 13:16:58 +0000 (14:16 +0100)
src/cargo/core/compiler/context/mod.rs
src/cargo/core/compiler/context/unit_dependencies.rs
src/cargo/core/resolver/mod.rs
src/cargo/ops/cargo_compile.rs
src/cargo/ops/cargo_doc.rs

index 2d317f8c15a2af53df33959f288765e840e25f3f..64e70e882a11cce3abad4cbd6a39d20c1756d7a9 100644 (file)
@@ -450,6 +450,8 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
         self.unit_dependencies[unit].clone()
     }
 
+    /// Whether a dependency should be compiled for the host or target platform,
+    /// specified by `Kind`.
     fn dep_platform_activated(&self, dep: &Dependency, kind: Kind) -> bool {
         // If this dependency is only available for certain platforms,
         // make sure we're only enabling it for that platform.
index d68037b551222bbdf7c1ec0dc0195bda2c531992..fad946b97e6da8de331a7e0e19ff641100777af7 100644 (file)
@@ -209,7 +209,7 @@ fn compute_deps_doc<'a, 'cfg>(
             unit.pkg
                 .dependencies()
                 .iter()
-                .filter(|d| d.name() == dep.name())
+                .filter(|d| d.name() == dep.name() && d.version_req().matches(dep.version()))
                 .any(|dep| match dep.kind() {
                     DepKind::Normal => cx.dep_platform_activated(dep, unit.kind),
                     _ => false,
index d40afddb6a8f329a2abb4b7a9ada6076562b47e3..8db1a74e95efa29dee60063dd82c2ddc68e2f4c2 100644 (file)
@@ -68,7 +68,7 @@ use self::types::{RcVecIter, RegistryQueryer};
 
 pub use self::encode::{EncodableDependency, EncodablePackageId, EncodableResolve};
 pub use self::encode::{Metadata, WorkspaceResolve};
-pub use self::resolve::Resolve;
+pub use self::resolve::{Resolve, Deps, DepsNotReplaced};
 pub use self::types::Method;
 
 mod context;
index 8a2d75980c3b21c024c710061313bedbecc0f251..4f77c997498c6b925c65667de13c6ac519573714 100644 (file)
@@ -199,6 +199,8 @@ pub fn compile<'a>(
     compile_with_exec(ws, options, Arc::new(DefaultExecutor))
 }
 
+/// Like `compile` but allows specifing a custom `Executor` that will be able to intercept build
+/// calls and add custom logic. `compile` uses `DefaultExecutor` which just passes calls through.
 pub fn compile_with_exec<'a>(
     ws: &Workspace<'a>,
     options: &CompileOptions<'a>,
index 3f2c93e889912719c7ea7c88bb83b23aa4c745e3..ed71ddc2acb790259ad630009fec4b208c4b87c8 100644 (file)
@@ -39,7 +39,6 @@ pub fn doc(ws: &Workspace, options: &DocOptions) -> CargoResult<()> {
 
     let mut lib_names = HashMap::new();
     let mut bin_names = HashMap::new();
-    //println!("{:#?}", pkgs);
     for package in &pkgs {
         for target in package.targets().iter().filter(|t| t.documented()) {
             if target.is_lib() {
@@ -67,7 +66,6 @@ pub fn doc(ws: &Workspace, options: &DocOptions) -> CargoResult<()> {
     }
 
     ops::compile(ws, &options.compile_opts)?;
-    //println!("Made it!");
 
     if options.open_result {
         let name = if pkgs.len() > 1 {