Skip to content

Commit c60f424

Browse files
weihangloMuscraftehuss
committed
chore: remove rustc-workspace-hack
Co-authored-by: Scott Schafer <[email protected]> Co-authored-by: Eric Huss <[email protected]>
1 parent 2af8993 commit c60f424

File tree

7 files changed

+7
-352
lines changed

7 files changed

+7
-352
lines changed

Cargo.lock

+2-87
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,6 @@ dependencies = [
266266
"toml",
267267
]
268268

269-
[[package]]
270-
name = "bumpalo"
271-
version = "3.11.1"
272-
source = "registry+https://github.com/rust-lang/crates.io-index"
273-
checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba"
274-
275269
[[package]]
276270
name = "bytecount"
277271
version = "0.6.2"
@@ -1349,10 +1343,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
13491343
checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
13501344
dependencies = [
13511345
"cfg-if",
1352-
"js-sys",
13531346
"libc",
13541347
"wasi",
1355-
"wasm-bindgen",
13561348
]
13571349

13581350
[[package]]
@@ -1727,15 +1719,6 @@ dependencies = [
17271719
"libc",
17281720
]
17291721

1730-
[[package]]
1731-
name = "js-sys"
1732-
version = "0.3.60"
1733-
source = "registry+https://github.com/rust-lang/crates.io-index"
1734-
checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47"
1735-
dependencies = [
1736-
"wasm-bindgen",
1737-
]
1738-
17391722
[[package]]
17401723
name = "jsondocck"
17411724
version = "0.1.0"
@@ -2852,22 +2835,8 @@ dependencies = [
28522835
[[package]]
28532836
name = "rustc-workspace-hack"
28542837
version = "1.0.0"
2855-
dependencies = [
2856-
"bstr 0.2.17",
2857-
"clap 3.2.20",
2858-
"getrandom",
2859-
"hashbrown 0.12.3",
2860-
"libc",
2861-
"libz-sys",
2862-
"once_cell",
2863-
"rand",
2864-
"regex",
2865-
"serde_json",
2866-
"smallvec",
2867-
"syn",
2868-
"url",
2869-
"winapi",
2870-
]
2838+
source = "registry+https://github.com/rust-lang/crates.io-index"
2839+
checksum = "fc71d2faa173b74b232dedc235e3ee1696581bb132fc116fa3626d6151a1a8fb"
28712840

28722841
[[package]]
28732842
name = "rustc_abi"
@@ -5177,60 +5146,6 @@ dependencies = [
51775146
"rustc-std-workspace-core",
51785147
]
51795148

5180-
[[package]]
5181-
name = "wasm-bindgen"
5182-
version = "0.2.83"
5183-
source = "registry+https://github.com/rust-lang/crates.io-index"
5184-
checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268"
5185-
dependencies = [
5186-
"cfg-if",
5187-
"wasm-bindgen-macro",
5188-
]
5189-
5190-
[[package]]
5191-
name = "wasm-bindgen-backend"
5192-
version = "0.2.83"
5193-
source = "registry+https://github.com/rust-lang/crates.io-index"
5194-
checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142"
5195-
dependencies = [
5196-
"bumpalo",
5197-
"log",
5198-
"once_cell",
5199-
"proc-macro2",
5200-
"quote",
5201-
"syn",
5202-
"wasm-bindgen-shared",
5203-
]
5204-
5205-
[[package]]
5206-
name = "wasm-bindgen-macro"
5207-
version = "0.2.83"
5208-
source = "registry+https://github.com/rust-lang/crates.io-index"
5209-
checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810"
5210-
dependencies = [
5211-
"quote",
5212-
"wasm-bindgen-macro-support",
5213-
]
5214-
5215-
[[package]]
5216-
name = "wasm-bindgen-macro-support"
5217-
version = "0.2.83"
5218-
source = "registry+https://github.com/rust-lang/crates.io-index"
5219-
checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"
5220-
dependencies = [
5221-
"proc-macro2",
5222-
"quote",
5223-
"syn",
5224-
"wasm-bindgen-backend",
5225-
"wasm-bindgen-shared",
5226-
]
5227-
5228-
[[package]]
5229-
name = "wasm-bindgen-shared"
5230-
version = "0.2.83"
5231-
source = "registry+https://github.com/rust-lang/crates.io-index"
5232-
checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f"
5233-
52345149
[[package]]
52355150
name = "winapi"
52365151
version = "0.3.9"

Cargo.toml

-4
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ miniz_oxide.debug = 0
9999
object.debug = 0
100100

101101
[patch.crates-io]
102-
# See comments in `src/tools/rustc-workspace-hack/README.md` for what's going on
103-
# here
104-
rustc-workspace-hack = { path = 'src/tools/rustc-workspace-hack' }
105-
106102
# See comments in `library/rustc-std-workspace-core/README.md` for what's going on
107103
# here
108104
rustc-std-workspace-core = { path = 'library/rustc-std-workspace-core' }

src/bootstrap/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,6 @@ pub struct Build {
228228
ci_env: CiEnv,
229229
delayed_failures: RefCell<Vec<String>>,
230230
prerelease_version: Cell<Option<u32>>,
231-
tool_artifacts:
232-
RefCell<HashMap<TargetSelection, HashMap<String, (&'static str, PathBuf, Vec<String>)>>>,
233231

234232
#[cfg(feature = "build-metrics")]
235233
metrics: metrics::BuildMetrics,
@@ -448,7 +446,6 @@ impl Build {
448446
ci_env: CiEnv::current(),
449447
delayed_failures: RefCell::new(Vec::new()),
450448
prerelease_version: Cell::new(None),
451-
tool_artifacts: Default::default(),
452449

453450
#[cfg(feature = "build-metrics")]
454451
metrics: metrics::BuildMetrics::init(),

src/bootstrap/tool.rs

+5-130
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::collections::HashSet;
21
use std::env;
32
use std::fs;
43
use std::path::PathBuf;
@@ -120,136 +119,10 @@ impl Step for ToolBuild {
120119
&self.target,
121120
);
122121
builder.info(&msg);
123-
let mut duplicates = Vec::new();
124-
let is_expected = compile::stream_cargo(builder, cargo, vec![], &mut |msg| {
125-
// Only care about big things like the RLS/Cargo for now
126-
match tool {
127-
"rls" | "clippy-driver" | "miri" | "rustfmt" => {}
128-
129-
_ => return,
130-
}
131-
let (id, features, filenames) = match msg {
132-
compile::CargoMessage::CompilerArtifact {
133-
package_id,
134-
features,
135-
filenames,
136-
target: _,
137-
} => (package_id, features, filenames),
138-
_ => return,
139-
};
140-
let features = features.iter().map(|s| s.to_string()).collect::<Vec<_>>();
141-
142-
for path in filenames {
143-
let val = (tool, PathBuf::from(&*path), features.clone());
144-
// we're only interested in deduplicating rlibs for now
145-
if val.1.extension().and_then(|s| s.to_str()) != Some("rlib") {
146-
continue;
147-
}
148-
149-
// Don't worry about compiles that turn out to be host
150-
// dependencies or build scripts. To skip these we look for
151-
// anything that goes in `.../release/deps` but *doesn't* go in
152-
// `$target/release/deps`. This ensure that outputs in
153-
// `$target/release` are still considered candidates for
154-
// deduplication.
155-
if let Some(parent) = val.1.parent() {
156-
if parent.ends_with("release/deps") {
157-
let maybe_target = parent
158-
.parent()
159-
.and_then(|p| p.parent())
160-
.and_then(|p| p.file_name())
161-
.and_then(|p| p.to_str())
162-
.unwrap();
163-
if maybe_target != &*target.triple {
164-
continue;
165-
}
166-
}
167-
}
168-
169-
// Record that we've built an artifact for `id`, and if one was
170-
// already listed then we need to see if we reused the same
171-
// artifact or produced a duplicate.
172-
let mut artifacts = builder.tool_artifacts.borrow_mut();
173-
let prev_artifacts = artifacts.entry(target).or_default();
174-
let prev = match prev_artifacts.get(&*id) {
175-
Some(prev) => prev,
176-
None => {
177-
prev_artifacts.insert(id.to_string(), val);
178-
continue;
179-
}
180-
};
181-
if prev.1 == val.1 {
182-
return; // same path, same artifact
183-
}
184-
185-
// If the paths are different and one of them *isn't* inside of
186-
// `release/deps`, then it means it's probably in
187-
// `$target/release`, or it's some final artifact like
188-
// `libcargo.rlib`. In these situations Cargo probably just
189-
// copied it up from `$target/release/deps/libcargo-xxxx.rlib`,
190-
// so if the features are equal we can just skip it.
191-
let prev_no_hash = prev.1.parent().unwrap().ends_with("release/deps");
192-
let val_no_hash = val.1.parent().unwrap().ends_with("release/deps");
193-
if prev.2 == val.2 || !prev_no_hash || !val_no_hash {
194-
return;
195-
}
196-
197-
// ... and otherwise this looks like we duplicated some sort of
198-
// compilation, so record it to generate an error later.
199-
duplicates.push((id.to_string(), val, prev.clone()));
200-
}
122+
let is_expected = compile::stream_cargo(builder, cargo, vec![], &mut |_msg| {
123+
return;
201124
});
202125

203-
if is_expected && !duplicates.is_empty() {
204-
eprintln!(
205-
"duplicate artifacts found when compiling a tool, this \
206-
typically means that something was recompiled because \
207-
a transitive dependency has different features activated \
208-
than in a previous build:\n"
209-
);
210-
let (same, different): (Vec<_>, Vec<_>) =
211-
duplicates.into_iter().partition(|(_, cur, prev)| cur.2 == prev.2);
212-
if !same.is_empty() {
213-
eprintln!(
214-
"the following dependencies are duplicated although they \
215-
have the same features enabled:"
216-
);
217-
for (id, cur, prev) in same {
218-
eprintln!(" {}", id);
219-
// same features
220-
eprintln!(" `{}` ({:?})\n `{}` ({:?})", cur.0, cur.1, prev.0, prev.1);
221-
}
222-
}
223-
if !different.is_empty() {
224-
eprintln!("the following dependencies have different features:");
225-
for (id, cur, prev) in different {
226-
eprintln!(" {}", id);
227-
let cur_features: HashSet<_> = cur.2.into_iter().collect();
228-
let prev_features: HashSet<_> = prev.2.into_iter().collect();
229-
eprintln!(
230-
" `{}` additionally enabled features {:?} at {:?}",
231-
cur.0,
232-
&cur_features - &prev_features,
233-
cur.1
234-
);
235-
eprintln!(
236-
" `{}` additionally enabled features {:?} at {:?}",
237-
prev.0,
238-
&prev_features - &cur_features,
239-
prev.1
240-
);
241-
}
242-
}
243-
eprintln!();
244-
eprintln!(
245-
"to fix this you will probably want to edit the local \
246-
src/tools/rustc-workspace-hack/Cargo.toml crate, as \
247-
that will update the dependency graph to ensure that \
248-
these crates all share the same feature set"
249-
);
250-
panic!("tools should not compile multiple copies of the same crate");
251-
}
252-
253126
builder.save_toolstate(
254127
tool,
255128
if is_expected { ToolState::TestFail } else { ToolState::BuildFail },
@@ -299,7 +172,9 @@ pub fn prepare_tool_cargo(
299172
|| path.ends_with("rustfmt")
300173
{
301174
cargo.env("LIBZ_SYS_STATIC", "1");
302-
features.push("rustc-workspace-hack/all-static".to_string());
175+
}
176+
if path.ends_with("cargo") {
177+
features.push("all-static".to_string());
303178
}
304179
}
305180

0 commit comments

Comments
 (0)