Skip to content

Commit d70f91e

Browse files
author
Richard Dodd
committed
Add fix and some docs
1 parent 066f9a0 commit d70f91e

File tree

5 files changed

+6
-4
lines changed

5 files changed

+6
-4
lines changed

src/cargo/core/compiler/context/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,8 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
450450
self.unit_dependencies[unit].clone()
451451
}
452452

453+
/// Whether a dependency should be compiled for the host or target platform,
454+
/// specified by `Kind`.
453455
fn dep_platform_activated(&self, dep: &Dependency, kind: Kind) -> bool {
454456
// If this dependency is only available for certain platforms,
455457
// make sure we're only enabling it for that platform.

src/cargo/core/compiler/context/unit_dependencies.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ fn compute_deps_doc<'a, 'cfg>(
209209
unit.pkg
210210
.dependencies()
211211
.iter()
212-
.filter(|d| d.name() == dep.name())
212+
.filter(|d| d.name() == dep.name() && d.version_req().matches(dep.version()))
213213
.any(|dep| match dep.kind() {
214214
DepKind::Normal => cx.dep_platform_activated(dep, unit.kind),
215215
_ => false,

src/cargo/core/resolver/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ use self::types::{RcVecIter, RegistryQueryer};
6868

6969
pub use self::encode::{EncodableDependency, EncodablePackageId, EncodableResolve};
7070
pub use self::encode::{Metadata, WorkspaceResolve};
71-
pub use self::resolve::Resolve;
71+
pub use self::resolve::{Resolve, Deps, DepsNotReplaced};
7272
pub use self::types::Method;
7373

7474
mod context;

src/cargo/ops/cargo_compile.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ pub fn compile<'a>(
199199
compile_with_exec(ws, options, Arc::new(DefaultExecutor))
200200
}
201201

202+
/// Like `compile` but allows specifing a custom `Executor` that will be able to intercept build
203+
/// calls and add custom logic. `compile` uses `DefaultExecutor` which just passes calls through.
202204
pub fn compile_with_exec<'a>(
203205
ws: &Workspace<'a>,
204206
options: &CompileOptions<'a>,

src/cargo/ops/cargo_doc.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ pub fn doc(ws: &Workspace, options: &DocOptions) -> CargoResult<()> {
3939

4040
let mut lib_names = HashMap::new();
4141
let mut bin_names = HashMap::new();
42-
//println!("{:#?}", pkgs);
4342
for package in &pkgs {
4443
for target in package.targets().iter().filter(|t| t.documented()) {
4544
if target.is_lib() {
@@ -67,7 +66,6 @@ pub fn doc(ws: &Workspace, options: &DocOptions) -> CargoResult<()> {
6766
}
6867

6968
ops::compile(ws, &options.compile_opts)?;
70-
//println!("Made it!");
7169

7270
if options.open_result {
7371
let name = if pkgs.len() > 1 {

0 commit comments

Comments
 (0)