Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 11 additions & 2 deletions
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

Lines changed: 0 additions & 16 deletions
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

Lines changed: 18 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 12 deletions
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

Lines changed: 11 additions & 0 deletions
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 {

0 commit comments

Comments
 (0)