Skip to content

Commit

Permalink
Remove some failed experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
jneem authored and torhovland committed May 22, 2024
1 parent 2fe6249 commit 4ebca7a
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 49 deletions.
1 change: 0 additions & 1 deletion example
Submodule example deleted from cb9288
1 change: 0 additions & 1 deletion src/cargo/core/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@ impl Manifest {
/// See [`Manifest::resolved_toml`] for what "resolved" means
pub fn to_resolved_contents(&self) -> CargoResult<String> {
let toml = toml::to_string_pretty(self.resolved_toml())?;
debug!("Step 2c: Somewhere around here we need to strip paths from workspace deps.");
Ok(format!("{}\n{}", MANIFEST_PREAMBLE, toml))
}
/// Collection of spans for the original TOML
Expand Down
33 changes: 0 additions & 33 deletions src/cargo/core/resolver/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,39 +215,6 @@ impl Resolve {
}
}

// FIXME: Just recording this attempt, but it doesn't work :(
// The resulting lockfile just gets an additional replace field
pub fn add_replacement(&mut self, id: PackageId, new: PackageId, checksum: String) {
self.replacements.insert(id, new);
self.checksums.insert(new, Some(checksum));
}

pub fn hacky_replace_source(&mut self, id: PackageId, source: SourceId, checksum: String) {
let new = id.with_source_id(source);
self.checksums.insert(new, Some(checksum));
let parents: Vec<_> = self
.graph
.iter()
.filter_map(|n| self.graph.edge(n, &id).map(|e| (*n, e.clone())))
.collect();
let children: Vec<_> = self
.graph
.edges(&id)
.map(|(n, e)| (*n, e.clone()))
.collect();
self.graph.add(new);

for (p, edge) in parents {
*self.graph.link(p, new) = edge.clone();
self.graph.unlink(&p, &id);
}
for (c, edge) in children {
*self.graph.link(new, c) = edge.clone();
self.graph.unlink(&id, &c);
}
self.graph.remove(id);
}

pub fn merge_from(&mut self, previous: &Resolve) -> CargoResult<()> {
// Given a previous instance of resolve, it should be forbidden to ever
// have a checksums which *differ*. If the same package ID has differing
Expand Down
4 changes: 0 additions & 4 deletions src/cargo/ops/cargo_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,10 +648,6 @@ fn build_lock(
"consider updating to a version that is not yanked",
)?;

debug!("Step 2b: We need to modify the lock file here, and insert source and checksum on all workspace dependencies.");
// Note that this requires knowing their checksums, meaning that we need to have them
// packaged first...

ops::resolve_to_string(&tmp_ws, &mut new_resolve)
}

Expand Down
10 changes: 0 additions & 10 deletions src/cargo/util/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ impl<N: Eq + Ord + Clone, E: Default + Clone> Graph<N, E> {
self.nodes.entry(node).or_insert_with(im_rc::OrdMap::new);
}

// TODO: Can we avoid adding this?
pub fn remove(&mut self, node: N) {
self.nodes.remove(&node);
}

pub fn link(&mut self, node: N, child: N) -> &mut E {
self.nodes
.entry(node)
Expand All @@ -30,11 +25,6 @@ impl<N: Eq + Ord + Clone, E: Default + Clone> Graph<N, E> {
.or_insert_with(Default::default)
}

// TODO: Can we avoid adding this?
pub fn unlink(&mut self, node: &N, child: &N) -> Option<E> {
self.nodes.get_mut(node)?.remove(child)
}

pub fn contains<Q: ?Sized>(&self, k: &Q) -> bool
where
N: Borrow<Q>,
Expand Down

0 comments on commit 4ebca7a

Please sign in to comment.