Skip to content

Commit 44afd76

Browse files
committed
Auto merge of #47280 - alexcrichton:update-cargo, r=kennytm
Update Cargo and its dependencies This'll probably have a bunch of build errors, so let's try and head those off and find them sooner rather than later!
2 parents 0f9c784 + 80d6ed2 commit 44afd76

File tree

7 files changed

+367
-295
lines changed

7 files changed

+367
-295
lines changed

src/Cargo.lock

+320-288
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Cargo.toml

+10
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,18 @@ debug-assertions = false
5555
debug = false
5656
debug-assertions = false
5757

58+
# We want the RLS to use the version of Cargo that we've got vendored in this
59+
# repository to ensure that the same exact version of Cargo is used by both the
60+
# RLS and the Cargo binary itself. The RLS depends on Cargo as a git repository
61+
# so we use a `[patch]` here to override the github repository with our local
62+
# vendored copy.
5863
[patch."https://github.com/rust-lang/cargo"]
5964
cargo = { path = "tools/cargo" }
6065

6166
[patch.crates-io]
67+
# Similar to Cargo above we want the RLS to use a vendored version of `rustfmt`
68+
# that we're shipping as well (to ensure that the rustfmt in RLS and the
69+
# `rustfmt` executable are the same exact vesion). Unlike Cargo, however, the
70+
# RLS depends on `rustfmt` from crates.io, so we put this in a `[patch]` section
71+
# for crates.io
6272
rustfmt-nightly = { path = "tools/rustfmt" }

src/bootstrap/bootstrap.py

-5
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,6 @@ def download_stage0(self):
351351
with open(self.rustc_stamp(), 'w') as rust_stamp:
352352
rust_stamp.write(self.date)
353353

354-
if "pc-windows-gnu" in self.build:
355-
filename = "rust-mingw-{}-{}.tar.gz".format(
356-
rustc_channel, self.build)
357-
self._download_stage0_helper(filename, "rust-mingw")
358-
359354
if self.cargo().startswith(self.bin_root()) and \
360355
(not os.path.exists(self.cargo()) or
361356
self.program_out_of_date(self.cargo_stamp())):

src/bootstrap/builder.rs

+33
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,39 @@ impl<'a> Builder<'a> {
620620
// Set this for all builds to make sure doc builds also get it.
621621
cargo.env("CFG_RELEASE_CHANNEL", &self.build.config.channel);
622622

623+
// This one's a bit tricky. As of the time of this writing the compiler
624+
// links to the `winapi` crate on crates.io. This crate provides raw
625+
// bindings to Windows system functions, sort of like libc does for
626+
// Unix. This crate also, however, provides "import libraries" for the
627+
// MinGW targets. There's an import library per dll in the windows
628+
// distribution which is what's linked to. These custom import libraries
629+
// are used because the winapi crate can reference Windows functions not
630+
// present in the MinGW import libraries.
631+
//
632+
// For example MinGW may ship libdbghelp.a, but it may not have
633+
// references to all the functions in the dbghelp dll. Instead the
634+
// custom import library for dbghelp in the winapi crates has all this
635+
// information.
636+
//
637+
// Unfortunately for us though the import libraries are linked by
638+
// default via `-ldylib=winapi_foo`. That is, they're linked with the
639+
// `dylib` type with a `winapi_` prefix (so the winapi ones don't
640+
// conflict with the system MinGW ones). This consequently means that
641+
// the binaries we ship of things like rustc_trans (aka the rustc_trans
642+
// DLL) when linked against *again*, for example with procedural macros
643+
// or plugins, will trigger the propagation logic of `-ldylib`, passing
644+
// `-lwinapi_foo` to the linker again. This isn't actually available in
645+
// our distribution, however, so the link fails.
646+
//
647+
// To solve this problem we tell winapi to not use its bundled import
648+
// libraries. This means that it will link to the system MinGW import
649+
// libraries by default, and the `-ldylib=foo` directives will still get
650+
// passed to the final linker, but they'll look like `-lfoo` which can
651+
// be resolved because MinGW has the import library. The downside is we
652+
// don't get newer functions from Windows, but we don't use any of them
653+
// anyway.
654+
cargo.env("WINAPI_NO_BUNDLED_LIBRARIES", "1");
655+
623656
if self.is_very_verbose() {
624657
cargo.arg("-v");
625658
}

src/bootstrap/dist.rs

+2
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ fn make_win_dist(
224224
"libwinspool.a",
225225
"libws2_32.a",
226226
"libwsock32.a",
227+
"libdbghelp.a",
228+
"libmsimg32.a",
227229
];
228230

229231
//Find mingw artifacts we want to bundle

src/bootstrap/doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ impl Step for CargoBook {
160160

161161
let target = self.target;
162162
let name = self.name;
163-
let src = build.src.join("src/tools/cargo/src/doc/book");
163+
let src = build.src.join("src/tools/cargo/src/doc");
164164

165165
let out = build.doc_out(target);
166166
t!(fs::create_dir_all(&out));

src/tools/cargo

Submodule cargo updated 105 files

0 commit comments

Comments
 (0)