Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/cmd/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ pub fn run(sess: &Session, args: &PathArgs) -> Result<()> {
if args.checkout || !paths.iter().all(|p| p.exists()) {
debugln!("main: obtain checkouts {:?}", ids);
let rt = Runtime::new()?;
let checkouts = rt
let _checkouts = rt
.block_on(join_all(
ids.iter()
.map(|&(_, id)| io.checkout(id, false, &[]))
.collect::<Vec<_>>(),
))
.into_iter()
.collect::<Result<Vec<_>>>()?;
debugln!("main: checkouts {:#?}", checkouts);
debugln!("main: checkouts {:#?}", _checkouts);
}

// Print paths
Expand Down
4 changes: 1 addition & 3 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ macro_rules! stageln {
#[macro_export]
#[cfg(not(debug_assertions))]
macro_rules! debugln {
($fmt:expr $(, $arg:expr)* $(,)?) => { $(let _ = $arg;)* }
// create an unused binding here so the compiler does not complain
// about the arguments to debugln! not being used in release builds.
($($arg:tt)*) => {};
}

/// Emit a diagnostic message.
Expand Down
40 changes: 24 additions & 16 deletions src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@ impl<'ctx> DependencyResolver<'ctx> {
&io,
)?;

let mut iteration = 0;
let mut _iteration = 0;
let mut any_changes = true;
while any_changes {
debugln!(
"resolve: iteration {} table {:#?}",
iteration,
_iteration,
TableDumper(&self.table)
);
iteration += 1;
_iteration += 1;

// Constraint all dependencies with state `Open` -> `Constrained`.
self.init()?;
Expand All @@ -171,7 +171,7 @@ impl<'ctx> DependencyResolver<'ctx> {
// Close the dependency set.
any_changes |= self.close(&rt, &io)?;
}
debugln!("resolve: resolved after {} iterations", iteration);
debugln!("resolve: resolved after {} iterations", _iteration);

// Convert the resolved dependencies into a lockfile.
let sess = self.sess;
Expand Down Expand Up @@ -583,7 +583,7 @@ impl<'ctx> DependencyResolver<'ctx> {
map
};

let src_cons_map = cons_map
let _src_cons_map = cons_map
.iter()
.map(|(name, cons)| {
(
Expand All @@ -599,7 +599,7 @@ impl<'ctx> DependencyResolver<'ctx> {

debugln!(
"resolve: gathered constraints {:#?}",
ConstraintsDumper(&src_cons_map)
ConstraintsDumper(&_src_cons_map)
);

// Impose the constraints on the dependencies.
Expand Down Expand Up @@ -991,16 +991,22 @@ impl<'ctx> DependencyResolver<'ctx> {
.map(|(a, b, c)| (a, (b, c)))
.collect::<IndexMap<DependencyRef, (usize, IndexSet<_>)>>();
// TODO: pick among possible sources.
debugln!(
"resolve: picking ref {} for `{}`",
src_map.first().unwrap().0,
dep.name
);
State::Picked(
*src_map.first().unwrap().0,
src_map.first().unwrap().1.0,
src_map.into_iter().map(|(k, (_, ids))| (k, ids)).collect(),
)
match src_map.first() {
Some(first) => {
debugln!("resolve: picking ref {} for `{}`", first.0, dep.name);
State::Picked(
*first.0,
first.1.0,
src_map.into_iter().map(|(k, (_, ids))| (k, ids)).collect(),
)
}
None => {
return Err(Error::new(format!(
"No versions available for `{}`. This may be due to a conflict in the dependency requirements.",
dep.name
)));
}
}
}
State::Picked(dref, id, map) => {
if !dep.sources[dref].is_path() && !map[dref].contains(id) {
Expand Down Expand Up @@ -1201,6 +1207,7 @@ impl State {
}
}

#[allow(dead_code)]
struct TableDumper<'a>(&'a IndexMap<&'a str, Dependency<'a>>);

impl fmt::Debug for TableDumper<'_> {
Expand Down Expand Up @@ -1232,6 +1239,7 @@ impl fmt::Debug for TableDumper<'_> {
}
}

#[allow(dead_code)]
struct ConstraintsDumper<'a>(
&'a IndexMap<&'a str, Vec<(&'a str, DependencyConstraint, DependencySource)>>,
);
Expand Down
8 changes: 4 additions & 4 deletions src/sess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ impl<'ctx> Session<'ctx> {
&self,
name: &str,
cfg: &config::Dependency,
calling_package: &str,
_calling_package: &str,
) -> DependencyRef {
debugln!(
"sess: load dependency `{}` as {:?} for package `{}`",
name,
cfg,
calling_package
_calling_package
);
let src = DependencySource::from(cfg);
self.deps
Expand Down Expand Up @@ -952,10 +952,10 @@ impl<'io, 'sess: 'io, 'ctx: 'sess> SessionIo<'sess, 'ctx> {
.await
{
Ok(r) => Ok(r),
Err(cause) => {
Err(_cause) => {
debugln!(
"checkout_git: failed to tag commit {:?}, attempting fetch.",
cause
_cause
);
let pb = Some(ProgressHandler::new(
self.sess.multiprogress.clone(),
Expand Down