Skip to content

Commit 9f4bc3e

Browse files
committed
Auto merge of rust-lang#83301 - Dylan-DPC:rollup-x1yzvhm, r=Dylan-DPC
Rollup of 11 pull requests Successful merges: - rust-lang#82500 (Reuse `std::sys::unsupported::pipe` on `hermit`) - rust-lang#82759 (Remove unwrap_none/expect_none from compiler/.) - rust-lang#82846 (rustdoc: allow list syntax for #[doc(alias)] attributes) - rust-lang#82892 (Clarify docs for Read::read's return value) - rust-lang#83179 (Extend `proc_macro_back_compat` lint to `actix-web`) - rust-lang#83197 (Move some test-only code to test files) - rust-lang#83208 (Fix gitattibutes for old git versions) - rust-lang#83215 (Deprecate std::os::haiku::raw, which accidentally wasn't deprecated) - rust-lang#83230 (Remove unnecessary `forward_inner_docs` hack) - rust-lang#83236 (Upgrade memmap to memmap2) - rust-lang#83270 (Fix typo/inaccuracy in the documentation of Iterator::skip_while) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents b97fd3e + 99f411d commit 9f4bc3e

File tree

45 files changed

+530
-252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+530
-252
lines changed

.gitattributes

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
*.fixed linguist-language=Rust
88
*.mir linguist-language=Rust
99
src/etc/installer/gfx/* binary
10-
*.woff binary
11-
*.woff2 binary
1210
src/vendor/** -text
1311
Cargo.lock linguist-generated=false
1412

15-
# Older git versions try to fix line endings on images, this prevents it.
13+
# Older git versions try to fix line endings on images and fonts, this prevents it.
1614
*.png binary
1715
*.ico binary
16+
*.woff binary
17+
*.woff2 binary

Cargo.lock

+11-2
Original file line numberDiff line numberDiff line change
@@ -2164,6 +2164,15 @@ dependencies = [
21642164
"winapi 0.3.9",
21652165
]
21662166

2167+
[[package]]
2168+
name = "memmap2"
2169+
version = "0.2.1"
2170+
source = "registry+https://github.com/rust-lang/crates.io-index"
2171+
checksum = "04e3e85b970d650e2ae6d70592474087051c11c54da7f7b4949725c5735fbcc6"
2172+
dependencies = [
2173+
"libc",
2174+
]
2175+
21672176
[[package]]
21682177
name = "memoffset"
21692178
version = "0.5.5"
@@ -3782,7 +3791,7 @@ dependencies = [
37823791
"itertools 0.9.0",
37833792
"jobserver",
37843793
"libc",
3785-
"memmap",
3794+
"memmap2",
37863795
"pathdiff",
37873796
"rustc_apfloat",
37883797
"rustc_ast",
@@ -4116,7 +4125,7 @@ name = "rustc_metadata"
41164125
version = "0.0.0"
41174126
dependencies = [
41184127
"libc",
4119-
"memmap",
4128+
"memmap2",
41204129
"rustc_ast",
41214130
"rustc_attr",
41224131
"rustc_data_structures",

compiler/rustc_arena/src/lib.rs

-16
Original file line numberDiff line numberDiff line change
@@ -298,22 +298,6 @@ impl<T> TypedArena<T> {
298298
}
299299
}
300300

301-
/// Clears the arena. Deallocates all but the longest chunk which may be reused.
302-
pub fn clear(&mut self) {
303-
unsafe {
304-
// Clear the last chunk, which is partially filled.
305-
let mut chunks_borrow = self.chunks.borrow_mut();
306-
if let Some(mut last_chunk) = chunks_borrow.last_mut() {
307-
self.clear_last_chunk(&mut last_chunk);
308-
let len = chunks_borrow.len();
309-
// If `T` is ZST, code below has no effect.
310-
for mut chunk in chunks_borrow.drain(..len - 1) {
311-
chunk.destroy(chunk.entries);
312-
}
313-
}
314-
}
315-
}
316-
317301
// Drops the contents of the last chunk. The last chunk is partially empty, unlike all other
318302
// chunks.
319303
fn clear_last_chunk(&self, last_chunk: &mut TypedArenaChunk<T>) {

compiler/rustc_arena/src/tests.rs

+18
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,24 @@ struct Point {
1111
z: i32,
1212
}
1313

14+
impl<T> TypedArena<T> {
15+
/// Clears the arena. Deallocates all but the longest chunk which may be reused.
16+
fn clear(&mut self) {
17+
unsafe {
18+
// Clear the last chunk, which is partially filled.
19+
let mut chunks_borrow = self.chunks.borrow_mut();
20+
if let Some(mut last_chunk) = chunks_borrow.last_mut() {
21+
self.clear_last_chunk(&mut last_chunk);
22+
let len = chunks_borrow.len();
23+
// If `T` is ZST, code below has no effect.
24+
for mut chunk in chunks_borrow.drain(..len - 1) {
25+
chunk.destroy(chunk.entries);
26+
}
27+
}
28+
}
29+
}
30+
}
31+
1432
#[test]
1533
pub fn test_unused() {
1634
let arena: TypedArena<Point> = TypedArena::default();

compiler/rustc_codegen_ssa/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test = false
1111
bitflags = "1.2.1"
1212
cc = "1.0.1"
1313
itertools = "0.9"
14-
memmap = "0.7"
14+
memmap2 = "0.2.1"
1515
tracing = "0.1"
1616
libc = "0.2.50"
1717
jobserver = "0.1.11"

compiler/rustc_codegen_ssa/src/back/lto.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl<B: WriteBackendMethods> LtoModuleCodegen<B> {
9393
pub enum SerializedModule<M: ModuleBufferMethods> {
9494
Local(M),
9595
FromRlib(Vec<u8>),
96-
FromUncompressedFile(memmap::Mmap),
96+
FromUncompressedFile(memmap2::Mmap),
9797
}
9898

9999
impl<M: ModuleBufferMethods> SerializedModule<M> {

compiler/rustc_codegen_ssa/src/back/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1958,7 +1958,7 @@ pub fn submit_pre_lto_module_to_llvm<B: ExtraBackendMethods>(
19581958
.unwrap_or_else(|e| panic!("failed to open bitcode file `{}`: {}", bc_path.display(), e));
19591959

19601960
let mmap = unsafe {
1961-
memmap::Mmap::map(&file).unwrap_or_else(|e| {
1961+
memmap2::Mmap::map(&file).unwrap_or_else(|e| {
19621962
panic!("failed to mmap bitcode file `{}`: {}", bc_path.display(), e)
19631963
})
19641964
};

compiler/rustc_codegen_ssa/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
2+
#![feature(assert_matches)]
23
#![feature(bool_to_option)]
3-
#![feature(option_expect_none)]
44
#![feature(box_patterns)]
55
#![feature(drain_filter)]
66
#![feature(try_blocks)]

compiler/rustc_data_structures/src/tiny_list.rs

+2-12
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
mod tests;
1616

1717
#[derive(Clone)]
18-
pub struct TinyList<T: PartialEq> {
18+
pub struct TinyList<T> {
1919
head: Option<Element<T>>,
2020
}
2121

@@ -56,20 +56,10 @@ impl<T: PartialEq> TinyList<T> {
5656
}
5757
false
5858
}
59-
60-
#[inline]
61-
pub fn len(&self) -> usize {
62-
let (mut elem, mut count) = (self.head.as_ref(), 0);
63-
while let Some(ref e) = elem {
64-
count += 1;
65-
elem = e.next.as_deref();
66-
}
67-
count
68-
}
6959
}
7060

7161
#[derive(Clone)]
72-
struct Element<T: PartialEq> {
62+
struct Element<T> {
7363
data: T,
7464
next: Option<Box<Element<T>>>,
7565
}

compiler/rustc_data_structures/src/tiny_list/tests.rs

+11
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@ use super::*;
33
extern crate test;
44
use test::{black_box, Bencher};
55

6+
impl<T> TinyList<T> {
7+
fn len(&self) -> usize {
8+
let (mut elem, mut count) = (self.head.as_ref(), 0);
9+
while let Some(ref e) = elem {
10+
count += 1;
11+
elem = e.next.as_deref();
12+
}
13+
count
14+
}
15+
}
16+
617
#[test]
718
fn test_contains_and_insert() {
819
fn do_insert(i: u32) -> bool {

compiler/rustc_data_structures/src/transitive_relation.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::mem;
99
mod tests;
1010

1111
#[derive(Clone, Debug)]
12-
pub struct TransitiveRelation<T: Eq + Hash> {
12+
pub struct TransitiveRelation<T> {
1313
// List of elements. This is used to map from a T to a usize.
1414
elements: FxIndexSet<T>,
1515

@@ -49,7 +49,7 @@ struct Edge {
4949
target: Index,
5050
}
5151

52-
impl<T: Clone + Debug + Eq + Hash> TransitiveRelation<T> {
52+
impl<T: Eq + Hash> TransitiveRelation<T> {
5353
pub fn is_empty(&self) -> bool {
5454
self.edges.is_empty()
5555
}
@@ -322,12 +322,6 @@ impl<T: Clone + Debug + Eq + Hash> TransitiveRelation<T> {
322322
.collect()
323323
}
324324

325-
/// A "best" parent in some sense. See `parents` and
326-
/// `postdom_upper_bound` for more details.
327-
pub fn postdom_parent(&self, a: &T) -> Option<&T> {
328-
self.mutual_immediate_postdominator(self.parents(a))
329-
}
330-
331325
fn with_closure<OP, R>(&self, op: OP) -> R
332326
where
333327
OP: FnOnce(&BitMatrix<usize, usize>) -> R,

compiler/rustc_data_structures/src/transitive_relation/tests.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
use super::*;
22

3+
impl<T: Eq + Hash> TransitiveRelation<T> {
4+
/// A "best" parent in some sense. See `parents` and
5+
/// `postdom_upper_bound` for more details.
6+
fn postdom_parent(&self, a: &T) -> Option<&T> {
7+
self.mutual_immediate_postdominator(self.parents(a))
8+
}
9+
}
10+
311
#[test]
412
fn test_one_step() {
513
let mut relation = TransitiveRelation::default();

compiler/rustc_errors/src/diagnostic_builder.rs

+6-15
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@ struct DiagnosticBuilderInner<'a> {
3030
allow_suggestions: bool,
3131
}
3232

33-
/// This is a helper macro for [`forward!`] that allows automatically adding documentation
34-
/// that uses tokens from [`forward!`]'s input.
35-
macro_rules! forward_inner_docs {
36-
($e:expr => $i:item) => {
37-
#[doc = $e]
38-
$i
39-
};
40-
}
41-
4233
/// In general, the `DiagnosticBuilder` uses deref to allow access to
4334
/// the fields and methods of the embedded `diagnostic` in a
4435
/// transparent way. *However,* many of the methods are intended to
@@ -54,11 +45,11 @@ macro_rules! forward {
5445
pub fn $n:ident(&self, $($name:ident: $ty:ty),* $(,)?) -> &Self
5546
) => {
5647
$(#[$attrs])*
57-
forward_inner_docs!(concat!("See [`Diagnostic::", stringify!($n), "()`].") =>
48+
#[doc = concat!("See [`Diagnostic::", stringify!($n), "()`].")]
5849
pub fn $n(&self, $($name: $ty),*) -> &Self {
5950
self.diagnostic.$n($($name),*);
6051
self
61-
});
52+
}
6253
};
6354

6455
// Forward pattern for &mut self -> &mut Self
@@ -67,11 +58,11 @@ macro_rules! forward {
6758
pub fn $n:ident(&mut self, $($name:ident: $ty:ty),* $(,)?) -> &mut Self
6859
) => {
6960
$(#[$attrs])*
70-
forward_inner_docs!(concat!("See [`Diagnostic::", stringify!($n), "()`].") =>
61+
#[doc = concat!("See [`Diagnostic::", stringify!($n), "()`].")]
7162
pub fn $n(&mut self, $($name: $ty),*) -> &mut Self {
7263
self.0.diagnostic.$n($($name),*);
7364
self
74-
});
65+
}
7566
};
7667

7768
// Forward pattern for &mut self -> &mut Self, with generic parameters.
@@ -84,11 +75,11 @@ macro_rules! forward {
8475
) -> &mut Self
8576
) => {
8677
$(#[$attrs])*
87-
forward_inner_docs!(concat!("See [`Diagnostic::", stringify!($n), "()`].") =>
78+
#[doc = concat!("See [`Diagnostic::", stringify!($n), "()`].")]
8879
pub fn $n<$($generic: $bound),*>(&mut self, $($name: $ty),*) -> &mut Self {
8980
self.0.diagnostic.$n($($name),*);
9081
self
91-
});
82+
}
9283
};
9384
}
9485

compiler/rustc_errors/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
66
#![feature(crate_visibility_modifier)]
77
#![feature(backtrace)]
8+
#![feature(extended_key_value_attributes)]
89
#![feature(nll)]
910

1011
#[macro_use]

0 commit comments

Comments
 (0)