Skip to content

Commit 6f955bf

Browse files
committed
Auto merge of rust-lang#100171 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
[beta] Rollup of beta backports Includes the following PRs: * rustc-docs: Be less specific about the representation of +bundle rust-lang#100074 * Fix backwards-compatibility check for tests with +whole-archive rust-lang#100068 * Revert write! and writeln! to late drop temporaries rust-lang#99689 * Upgrade indexmap and thorin-dwp to use hashbrown 0.12 rust-lang#99251 * rustdoc: avoid inlining modules with duplicate names rust-lang#99738 r? `@ghost`
2 parents 7410ebb + 8482bac commit 6f955bf

21 files changed

+247
-83
lines changed

Cargo.lock

+14-35
Original file line numberDiff line numberDiff line change
@@ -1700,18 +1700,9 @@ dependencies = [
17001700

17011701
[[package]]
17021702
name = "hashbrown"
1703-
version = "0.11.2"
1704-
source = "registry+https://github.com/rust-lang/crates.io-index"
1705-
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
1706-
dependencies = [
1707-
"ahash",
1708-
]
1709-
1710-
[[package]]
1711-
name = "hashbrown"
1712-
version = "0.12.0"
1703+
version = "0.12.3"
17131704
source = "registry+https://github.com/rust-lang/crates.io-index"
1714-
checksum = "8c21d40587b92fa6a6c6e3c1bdbf87d75511db5672f9c93175574b3a00df1758"
1705+
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
17151706
dependencies = [
17161707
"ahash",
17171708
"compiler_builtins",
@@ -1873,12 +1864,12 @@ dependencies = [
18731864

18741865
[[package]]
18751866
name = "indexmap"
1876-
version = "1.8.2"
1867+
version = "1.9.1"
18771868
source = "registry+https://github.com/rust-lang/crates.io-index"
1878-
checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a"
1869+
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
18791870
dependencies = [
18801871
"autocfg",
1881-
"hashbrown 0.11.2",
1872+
"hashbrown",
18821873
"rustc-rayon",
18831874
"serde",
18841875
]
@@ -2559,27 +2550,15 @@ dependencies = [
25592550
"rustc-std-workspace-core",
25602551
]
25612552

2562-
[[package]]
2563-
name = "object"
2564-
version = "0.28.4"
2565-
source = "registry+https://github.com/rust-lang/crates.io-index"
2566-
checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424"
2567-
dependencies = [
2568-
"crc32fast",
2569-
"flate2",
2570-
"hashbrown 0.11.2",
2571-
"indexmap",
2572-
"memchr",
2573-
]
2574-
25752553
[[package]]
25762554
name = "object"
25772555
version = "0.29.0"
25782556
source = "registry+https://github.com/rust-lang/crates.io-index"
25792557
checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53"
25802558
dependencies = [
25812559
"crc32fast",
2582-
"hashbrown 0.12.0",
2560+
"flate2",
2561+
"hashbrown",
25832562
"indexmap",
25842563
"memchr",
25852564
]
@@ -4967,9 +4946,9 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
49674946

49684947
[[package]]
49694948
name = "smallvec"
4970-
version = "1.7.0"
4949+
version = "1.8.1"
49714950
source = "registry+https://github.com/rust-lang/crates.io-index"
4972-
checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309"
4951+
checksum = "cc88c725d61fc6c3132893370cac4a0200e3fedf5da8331c570664b1987f5ca2"
49734952

49744953
[[package]]
49754954
name = "snap"
@@ -5047,7 +5026,7 @@ dependencies = [
50475026
"core",
50485027
"dlmalloc",
50495028
"fortanix-sgx-abi",
5050-
"hashbrown 0.12.0",
5029+
"hashbrown",
50515030
"hermit-abi 0.2.0",
50525031
"libc",
50535032
"miniz_oxide",
@@ -5306,13 +5285,13 @@ dependencies = [
53065285

53075286
[[package]]
53085287
name = "thorin-dwp"
5309-
version = "0.2.0"
5288+
version = "0.3.0"
53105289
source = "registry+https://github.com/rust-lang/crates.io-index"
5311-
checksum = "dd95b4559c196987c8451b4e14d08a4c796c2844f9adf4d2a2dbc9b3142843be"
5290+
checksum = "e6cb0c7868d7f90407531108ab03263d9452a8811b7cdd87675343a40d4aa254"
53125291
dependencies = [
53135292
"gimli 0.26.1",
5314-
"hashbrown 0.11.2",
5315-
"object 0.28.4",
5293+
"hashbrown",
5294+
"object 0.29.0",
53165295
"tracing",
53175296
]
53185297

compiler/rustc_codegen_cranelift/Cargo.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,15 @@ dependencies = [
163163

164164
[[package]]
165165
name = "hashbrown"
166-
version = "0.11.2"
166+
version = "0.12.3"
167167
source = "registry+https://github.com/rust-lang/crates.io-index"
168-
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
168+
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
169169

170170
[[package]]
171171
name = "indexmap"
172-
version = "1.8.0"
172+
version = "1.9.1"
173173
source = "registry+https://github.com/rust-lang/crates.io-index"
174-
checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223"
174+
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
175175
dependencies = [
176176
"autocfg",
177177
"hashbrown",

compiler/rustc_codegen_cranelift/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ gimli = { version = "0.26.0", default-features = false, features = ["write"]}
1919
object = { version = "0.27.0", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
2020

2121
ar = { git = "https://github.com/bjorn3/rust-ar.git", branch = "do_not_remove_cg_clif_ranlib" }
22-
indexmap = "1.8.0"
22+
indexmap = "1.9.1"
2323
libloading = { version = "0.6.0", optional = true }
2424
once_cell = "1.10.0"
2525
smallvec = "1.6.1"

compiler/rustc_codegen_ssa/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ tracing = "0.1"
1414
libc = "0.2.50"
1515
jobserver = "0.1.22"
1616
tempfile = "3.2"
17-
thorin-dwp = "0.2"
17+
thorin-dwp = "0.3"
1818
pathdiff = "0.2.0"
1919
serde_json = "1.0.59"
2020
snap = "1"

compiler/rustc_codegen_ssa/src/back/link.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2222,7 +2222,7 @@ fn add_local_native_libraries(
22222222
// be added explicitly if necessary, see the error in `fn link_rlib`) compiled
22232223
// as an executable due to `--test`. Use whole-archive implicitly, like before
22242224
// the introduction of native lib modifiers.
2225-
|| (bundle != Some(false) && sess.opts.test)
2225+
|| (whole_archive == None && bundle != Some(false) && sess.opts.test)
22262226
{
22272227
cmd.link_whole_staticlib(
22282228
name,

compiler/rustc_data_structures/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ doctest = false
99
[dependencies]
1010
arrayvec = { version = "0.7", default-features = false }
1111
ena = "0.14"
12-
indexmap = { version = "1.8.2" }
12+
indexmap = { version = "1.9.1" }
1313
tracing = "0.1"
1414
jobserver_crate = { version = "0.1.13", package = "jobserver" }
1515
rustc_serialize = { path = "../rustc_serialize" }

compiler/rustc_serialize/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ version = "0.0.0"
44
edition = "2021"
55

66
[dependencies]
7-
indexmap = "1.8.0"
8-
smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }
7+
indexmap = "1.9.1"
8+
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
99

1010
[dev-dependencies]
1111
rustc_macros = { path = "../rustc_macros" }

library/core/src/macros/mod.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -496,10 +496,9 @@ macro_rules! r#try {
496496
#[stable(feature = "rust1", since = "1.0.0")]
497497
#[cfg_attr(not(test), rustc_diagnostic_item = "write_macro")]
498498
macro_rules! write {
499-
($dst:expr, $($arg:tt)*) => {{
500-
let result = $dst.write_fmt($crate::format_args!($($arg)*));
501-
result
502-
}};
499+
($dst:expr, $($arg:tt)*) => {
500+
$dst.write_fmt($crate::format_args!($($arg)*))
501+
};
503502
}
504503

505504
/// Write formatted data into a buffer, with a newline appended.
@@ -554,10 +553,9 @@ macro_rules! writeln {
554553
($dst:expr $(,)?) => {
555554
$crate::write!($dst, "\n")
556555
};
557-
($dst:expr, $($arg:tt)*) => {{
558-
let result = $dst.write_fmt($crate::format_args_nl!($($arg)*));
559-
result
560-
}};
556+
($dst:expr, $($arg:tt)*) => {
557+
$dst.write_fmt($crate::format_args_nl!($($arg)*))
558+
};
561559
}
562560

563561
/// Indicates unreachable code.

src/doc/rustc/src/command-line-arguments.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ but it is not guaranteed. If you need whole archive semantics use `+whole-archiv
8989
This modifier is only compatible with the `static` linking kind.
9090
Using any other kind will result in a compiler error.
9191

92-
When building a rlib or staticlib `+bundle` means that all object files from the native static
93-
library will be added to the rlib or staticlib archive, and then used from it during linking of
94-
the final binary.
92+
When building a rlib or staticlib `+bundle` means that the native static library
93+
will be packed into the rlib or staticlib archive, and then retrieved from there
94+
during linking of the final binary.
9595

9696
When building a rlib `-bundle` means that the native static library is registered as a dependency
9797
of that rlib "by name", and object files from it are included only during linking of the final

src/librustdoc/clean/mod.rs

+12-7
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,24 @@ pub(crate) trait Clean<'tcx, T> {
5151
impl<'tcx> Clean<'tcx, Item> for DocModule<'tcx> {
5252
fn clean(&self, cx: &mut DocContext<'tcx>) -> Item {
5353
let mut items: Vec<Item> = vec![];
54-
items.extend(
55-
self.foreigns
56-
.iter()
57-
.map(|(item, renamed)| clean_maybe_renamed_foreign_item(cx, item, *renamed)),
58-
);
59-
items.extend(self.mods.iter().map(|x| x.clean(cx)));
54+
let mut inserted = FxHashSet::default();
55+
items.extend(self.foreigns.iter().map(|(item, renamed)| {
56+
let item = clean_maybe_renamed_foreign_item(cx, item, *renamed);
57+
if let Some(name) = item.name {
58+
inserted.insert((item.type_(), name));
59+
}
60+
item
61+
}));
62+
items.extend(self.mods.iter().map(|x| {
63+
inserted.insert((ItemType::Module, x.name));
64+
x.clean(cx)
65+
}));
6066

6167
// Split up imports from all other items.
6268
//
6369
// This covers the case where somebody does an import which should pull in an item,
6470
// but there's already an item with the same namespace and same name. Rust gives
6571
// priority to the not-imported one, so we should, too.
66-
let mut inserted = FxHashSet::default();
6772
items.extend(self.items.iter().flat_map(|(item, renamed)| {
6873
// First, lower everything other than imports.
6974
if matches!(item.kind, hir::ItemKind::Use(..)) {

src/test/run-make/native-link-modifier-whole-archive/Makefile

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ignore-cross-compile -- compiling C++ code does not work well when cross-compiling
22

3-
# This test case makes sure that native libraries are linked with --whole-archive semantics
4-
# when the `-bundle,+whole-archive` modifiers are applied to them.
3+
# This test case makes sure that native libraries are linked with appropriate semantics
4+
# when the `[+-]bundle,[+-]whole-archive` modifiers are applied to them.
55
#
66
# The test works by checking that the resulting executables produce the expected output,
77
# part of which is emitted by otherwise unreferenced C code. If +whole-archive didn't work
@@ -10,15 +10,28 @@
1010

1111
-include ../../run-make-fulldeps/tools.mk
1212

13-
all: $(TMPDIR)/$(call BIN,directly_linked) $(TMPDIR)/$(call BIN,indirectly_linked) $(TMPDIR)/$(call BIN,indirectly_linked_via_attr)
13+
all: $(TMPDIR)/$(call BIN,directly_linked) \
14+
$(TMPDIR)/$(call BIN,directly_linked_test_plus_whole_archive) \
15+
$(TMPDIR)/$(call BIN,directly_linked_test_minus_whole_archive) \
16+
$(TMPDIR)/$(call BIN,indirectly_linked) \
17+
$(TMPDIR)/$(call BIN,indirectly_linked_via_attr)
1418
$(call RUN,directly_linked) | $(CGREP) 'static-initializer.directly_linked.'
19+
$(call RUN,directly_linked_test_plus_whole_archive) --nocapture | $(CGREP) 'static-initializer.'
20+
$(call RUN,directly_linked_test_minus_whole_archive) --nocapture | $(CGREP) -v 'static-initializer.'
1521
$(call RUN,indirectly_linked) | $(CGREP) 'static-initializer.indirectly_linked.'
1622
$(call RUN,indirectly_linked_via_attr) | $(CGREP) 'static-initializer.native_lib_in_src.'
1723

1824
# Native lib linked directly into executable
1925
$(TMPDIR)/$(call BIN,directly_linked): $(call NATIVE_STATICLIB,c_static_lib_with_constructor)
2026
$(RUSTC) directly_linked.rs -l static:+whole-archive=c_static_lib_with_constructor
2127

28+
# Native lib linked into test executable, +whole-archive
29+
$(TMPDIR)/$(call BIN,directly_linked_test_plus_whole_archive): $(call NATIVE_STATICLIB,c_static_lib_with_constructor)
30+
$(RUSTC) directly_linked_test_plus_whole_archive.rs --test -l static:+whole-archive=c_static_lib_with_constructor
31+
# Native lib linked into test executable, -whole-archive
32+
$(TMPDIR)/$(call BIN,directly_linked_test_minus_whole_archive): $(call NATIVE_STATICLIB,c_static_lib_with_constructor)
33+
$(RUSTC) directly_linked_test_minus_whole_archive.rs --test -l static:-whole-archive=c_static_lib_with_constructor
34+
2235
# Native lib linked into RLIB via `-l static:-bundle,+whole-archive`, RLIB linked into executable
2336
$(TMPDIR)/$(call BIN,indirectly_linked): $(TMPDIR)/librlib_with_cmdline_native_lib.rlib
2437
$(RUSTC) indirectly_linked.rs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use std::io::Write;
2+
3+
#[test]
4+
fn test_thing() {
5+
print!("ran the test");
6+
std::io::stdout().flush().unwrap();
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use std::io::Write;
2+
3+
#[test]
4+
fn test_thing() {
5+
print!("ran the test");
6+
std::io::stdout().flush().unwrap();
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
pub struct Option;
2+
impl Option {
3+
pub fn unwrap(self) {}
4+
}
5+
6+
/// [`Option::unwrap`]
7+
pub mod task {}
8+
9+
extern "C" {
10+
pub fn main() -> std::os::raw::c_int;
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// aux-build:issue-99734-aux.rs
2+
// build-aux-docs
3+
// ignore-cross-compile
4+
5+
#![crate_name = "foo"]
6+
7+
#[macro_use]
8+
extern crate issue_99734_aux;
9+
10+
pub use issue_99734_aux::*;
11+
12+
// @count foo/index.html '//a[@class="fn"][@title="foo::main fn"]' 1
13+
14+
extern "C" {
15+
pub fn main() -> std::os::raw::c_int;
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// aux-build:issue-99734-aux.rs
2+
// build-aux-docs
3+
// ignore-cross-compile
4+
5+
#![crate_name = "foo"]
6+
7+
#[macro_use]
8+
extern crate issue_99734_aux;
9+
10+
pub use issue_99734_aux::*;
11+
12+
// @count foo/index.html '//a[@class="mod"][@title="foo::task mod"]' 1
13+
14+
pub mod task {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// check-pass
2+
// edition:2021
3+
4+
use std::fmt::{self, Display};
5+
use std::future::Future;
6+
use std::io;
7+
use std::pin::Pin;
8+
use std::task::{Context, Poll};
9+
10+
struct AsyncStdout;
11+
12+
impl AsyncStdout {
13+
fn write_fmt<'a>(&'a mut self, _args: fmt::Arguments) -> WriteFmtFuture<'a, Self>
14+
where
15+
Self: Unpin,
16+
{
17+
WriteFmtFuture(self)
18+
}
19+
}
20+
21+
struct WriteFmtFuture<'a, T>(&'a mut T);
22+
23+
impl<'a, T> Future for WriteFmtFuture<'a, T> {
24+
type Output = io::Result<()>;
25+
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
26+
unimplemented!()
27+
}
28+
}
29+
30+
async fn async_main() {
31+
let _write = write!(&mut AsyncStdout, "...").await;
32+
let _writeln = writeln!(&mut AsyncStdout, "...").await;
33+
}
34+
35+
fn main() {
36+
let _ = async_main;
37+
}

0 commit comments

Comments
 (0)