Skip to content

Commit 028c6f1

Browse files
committed
Auto merge of rust-lang#92471 - matthiaskrgr:rollup-lmduxwh, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#88310 (Lock bootstrap (x.py) build directory) - rust-lang#92097 (Implement split_at_spare_mut without Deref to a slice so that the spare slice is valid) - rust-lang#92412 (Fix double space in pretty printed TryBlock) - rust-lang#92420 (Fix whitespace in pretty printed PatKind::Range) - rust-lang#92457 (Sync rustc_codegen_gcc) - rust-lang#92460 ([rustc_builtin_macros] add indices to format_foreign::printf::Substitution::Escape) - rust-lang#92469 (Make tidy check for magic numbers that spell things) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents ad0d419 + 4bd4e27 commit 028c6f1

40 files changed

+368
-259
lines changed

compiler/rustc_ast_pretty/src/pprust/state.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2241,7 +2241,6 @@ impl<'a> State<'a> {
22412241
}
22422242
ast::ExprKind::TryBlock(ref blk) => {
22432243
self.head("try");
2244-
self.space();
22452244
self.print_block_with_attrs(blk, attrs)
22462245
}
22472246
ast::ExprKind::Err => {
@@ -2517,7 +2516,6 @@ impl<'a> State<'a> {
25172516
PatKind::Range(ref begin, ref end, Spanned { node: ref end_kind, .. }) => {
25182517
if let Some(e) = begin {
25192518
self.print_expr(e);
2520-
self.space();
25212519
}
25222520
match *end_kind {
25232521
RangeEnd::Included(RangeSyntax::DotDotDot) => self.word("..."),

compiler/rustc_builtin_macros/src/format_foreign.rs

+12-16
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,29 @@ pub(crate) mod printf {
77
pub enum Substitution<'a> {
88
/// A formatted output substitution with its internal byte offset.
99
Format(Format<'a>),
10-
/// A literal `%%` escape.
11-
Escape,
10+
/// A literal `%%` escape, with its start and end indices.
11+
Escape((usize, usize)),
1212
}
1313

1414
impl<'a> Substitution<'a> {
1515
pub fn as_str(&self) -> &str {
1616
match *self {
1717
Substitution::Format(ref fmt) => fmt.span,
18-
Substitution::Escape => "%%",
18+
Substitution::Escape(_) => "%%",
1919
}
2020
}
2121

2222
pub fn position(&self) -> Option<InnerSpan> {
2323
match *self {
2424
Substitution::Format(ref fmt) => Some(fmt.position),
25-
_ => None,
25+
Substitution::Escape((start, end)) => Some(InnerSpan::new(start, end)),
2626
}
2727
}
2828

2929
pub fn set_position(&mut self, start: usize, end: usize) {
30-
if let Substitution::Format(ref mut fmt) = self {
31-
fmt.position = InnerSpan::new(start, end);
30+
match self {
31+
Substitution::Format(ref mut fmt) => fmt.position = InnerSpan::new(start, end),
32+
Substitution::Escape(ref mut pos) => *pos = (start, end),
3233
}
3334
}
3435

@@ -39,7 +40,7 @@ pub(crate) mod printf {
3940
pub fn translate(&self) -> Result<String, Option<String>> {
4041
match *self {
4142
Substitution::Format(ref fmt) => fmt.translate(),
42-
Substitution::Escape => Err(None),
43+
Substitution::Escape(_) => Err(None),
4344
}
4445
}
4546
}
@@ -304,14 +305,9 @@ pub(crate) mod printf {
304305
fn next(&mut self) -> Option<Self::Item> {
305306
let (mut sub, tail) = parse_next_substitution(self.s)?;
306307
self.s = tail;
307-
match sub {
308-
Substitution::Format(_) => {
309-
if let Some(inner_span) = sub.position() {
310-
sub.set_position(inner_span.start + self.pos, inner_span.end + self.pos);
311-
self.pos += inner_span.end;
312-
}
313-
}
314-
Substitution::Escape => self.pos += 2,
308+
if let Some(InnerSpan { start, end }) = sub.position() {
309+
sub.set_position(start + self.pos, end + self.pos);
310+
self.pos += end;
315311
}
316312
Some(sub)
317313
}
@@ -340,7 +336,7 @@ pub(crate) mod printf {
340336
let at = {
341337
let start = s.find('%')?;
342338
if let '%' = s[start + 1..].chars().next()? {
343-
return Some((Substitution::Escape, &s[start + 2..]));
339+
return Some((Substitution::Escape((start, start + 2)), &s[start + 2..]));
344340
}
345341

346342
Cur::new_at(s, start)

compiler/rustc_builtin_macros/src/format_foreign/printf/tests.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ macro_rules! assert_eq_pnsat {
1313
fn test_escape() {
1414
assert_eq!(pns("has no escapes"), None);
1515
assert_eq!(pns("has no escapes, either %"), None);
16-
assert_eq!(pns("*so* has a %% escape"), Some((S::Escape, " escape")));
17-
assert_eq!(pns("%% leading escape"), Some((S::Escape, " leading escape")));
18-
assert_eq!(pns("trailing escape %%"), Some((S::Escape, "")));
16+
assert_eq!(pns("*so* has a %% escape"), Some((S::Escape((11, 13)), " escape")));
17+
assert_eq!(pns("%% leading escape"), Some((S::Escape((0, 2)), " leading escape")));
18+
assert_eq!(pns("trailing escape %%"), Some((S::Escape((16, 18)), "")));
1919
}
2020

2121
#[test]

compiler/rustc_codegen_gcc/Cargo.lock

+13-56
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ version = "0.8.0"
1717
source = "registry+https://github.com/rust-lang/crates.io-index"
1818
checksum = "450575f58f7bee32816abbff470cbc47797397c2a81e0eaced4b98436daf52e1"
1919

20-
[[package]]
21-
name = "autocfg"
22-
version = "1.0.1"
23-
source = "registry+https://github.com/rust-lang/crates.io-index"
24-
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
25-
2620
[[package]]
2721
name = "bitflags"
2822
version = "1.3.2"
@@ -35,15 +29,6 @@ version = "1.0.0"
3529
source = "registry+https://github.com/rust-lang/crates.io-index"
3630
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
3731

38-
[[package]]
39-
name = "crc32fast"
40-
version = "1.2.1"
41-
source = "registry+https://github.com/rust-lang/crates.io-index"
42-
checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a"
43-
dependencies = [
44-
"cfg-if",
45-
]
46-
4732
[[package]]
4833
name = "fm"
4934
version = "0.1.4"
@@ -56,15 +41,15 @@ dependencies = [
5641
[[package]]
5742
name = "gccjit"
5843
version = "1.0.0"
59-
source = "git+https://github.com/antoyo/gccjit.rs#2d4fea7319f80531b2e5d264fca9f1c498a3a62e"
44+
source = "git+https://github.com/antoyo/gccjit.rs#0672b78d162d65b6f36ea4062947253affe9fdef"
6045
dependencies = [
6146
"gccjit_sys",
6247
]
6348

6449
[[package]]
6550
name = "gccjit_sys"
6651
version = "0.0.1"
67-
source = "git+https://github.com/antoyo/gccjit.rs#2d4fea7319f80531b2e5d264fca9f1c498a3a62e"
52+
source = "git+https://github.com/antoyo/gccjit.rs#0672b78d162d65b6f36ea4062947253affe9fdef"
6853
dependencies = [
6954
"libc 0.1.12",
7055
]
@@ -85,33 +70,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
8570
checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
8671
dependencies = [
8772
"cfg-if",
88-
"libc 0.2.102",
73+
"libc 0.2.112",
8974
"wasi",
9075
]
9176

92-
[[package]]
93-
name = "hashbrown"
94-
version = "0.11.2"
95-
source = "registry+https://github.com/rust-lang/crates.io-index"
96-
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
97-
9877
[[package]]
9978
name = "hermit-abi"
10079
version = "0.1.19"
10180
source = "registry+https://github.com/rust-lang/crates.io-index"
10281
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
10382
dependencies = [
104-
"libc 0.2.102",
105-
]
106-
107-
[[package]]
108-
name = "indexmap"
109-
version = "1.7.0"
110-
source = "registry+https://github.com/rust-lang/crates.io-index"
111-
checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
112-
dependencies = [
113-
"autocfg",
114-
"hashbrown",
83+
"libc 0.2.112",
11584
]
11685

11786
[[package]]
@@ -122,7 +91,7 @@ checksum = "96bd995a092cac79868250589869b5a5d656b02a02bd74c8ebdc566dc7203090"
12291
dependencies = [
12392
"fm",
12493
"getopts",
125-
"libc 0.2.102",
94+
"libc 0.2.112",
12695
"num_cpus",
12796
"termcolor",
12897
"threadpool",
@@ -138,9 +107,9 @@ checksum = "e32a70cf75e5846d53a673923498228bbec6a8624708a9ea5645f075d6276122"
138107

139108
[[package]]
140109
name = "libc"
141-
version = "0.2.102"
110+
version = "0.2.112"
142111
source = "registry+https://github.com/rust-lang/crates.io-index"
143-
checksum = "a2a5ac8f984bfcf3a823267e5fde638acc3325f6496633a5da6bb6eb2171e103"
112+
checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"
144113

145114
[[package]]
146115
name = "memchr"
@@ -155,33 +124,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
155124
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
156125
dependencies = [
157126
"hermit-abi",
158-
"libc 0.2.102",
159-
]
160-
161-
[[package]]
162-
name = "object"
163-
version = "0.25.3"
164-
source = "registry+https://github.com/rust-lang/crates.io-index"
165-
checksum = "a38f2be3697a57b4060074ff41b44c16870d916ad7877c17696e063257482bc7"
166-
dependencies = [
167-
"crc32fast",
168-
"indexmap",
169-
"memchr",
127+
"libc 0.2.112",
170128
]
171129

172130
[[package]]
173131
name = "ppv-lite86"
174-
version = "0.2.10"
132+
version = "0.2.15"
175133
source = "registry+https://github.com/rust-lang/crates.io-index"
176-
checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
134+
checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba"
177135

178136
[[package]]
179137
name = "rand"
180138
version = "0.8.4"
181139
source = "registry+https://github.com/rust-lang/crates.io-index"
182140
checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
183141
dependencies = [
184-
"libc 0.2.102",
142+
"libc 0.2.112",
185143
"rand_chacha",
186144
"rand_core",
187145
"rand_hc",
@@ -257,7 +215,6 @@ dependencies = [
257215
"ar",
258216
"gccjit",
259217
"lang_tester",
260-
"object",
261218
"target-lexicon",
262219
"tempfile",
263220
]
@@ -284,7 +241,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
284241
checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
285242
dependencies = [
286243
"cfg-if",
287-
"libc 0.2.102",
244+
"libc 0.2.112",
288245
"rand",
289246
"redox_syscall",
290247
"remove_dir_all",
@@ -321,7 +278,7 @@ version = "0.2.0"
321278
source = "registry+https://github.com/rust-lang/crates.io-index"
322279
checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6"
323280
dependencies = [
324-
"libc 0.2.102",
281+
"libc 0.2.112",
325282
]
326283

327284
[[package]]

compiler/rustc_codegen_gcc/Cargo.toml

-5
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ target-lexicon = "0.10.0"
2323

2424
ar = "0.8.0"
2525

26-
[dependencies.object]
27-
version = "0.25.0"
28-
default-features = false
29-
features = ["read", "std", "write"] # We don't need WASM support.
30-
3126
[dev-dependencies]
3227
lang_tester = "0.3.9"
3328
tempfile = "3.1.0"

compiler/rustc_codegen_gcc/Readme.md

+2
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ Or add a breakpoint to `add_error` in gdb and print the line number using:
111111
p loc->m_line
112112
```
113113
114+
To get the `rustc` command to run in `gdb`, add the `--verbose` flag to `cargo build`.
115+
114116
### How to use a custom-build rustc
115117
116118
* Build the stage2 compiler (`rustup toolchain link debug-current build/x86_64-unknown-linux-gnu/stage2`).

compiler/rustc_codegen_gcc/patches/0023-core-Ignore-failing-tests.patch

+20
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,24 @@ index 4bc44e9..8e3c7a4 100644
4646

4747
#[test]
4848
fn cell_allows_array_cycle() {
49+
diff --git a/library/core/tests/slice.rs b/library/core/tests/slice.rs
50+
index 3e00e0a..8e5663b 100644
51+
--- a/library/core/tests/slice.rs
52+
+++ b/library/core/tests/slice.rs
53+
@@ -2108,6 +2108,7 @@ fn test_copy_within_panics_src_out_of_bounds() {
54+
bytes.copy_within(usize::MAX..=usize::MAX, 0);
55+
}
56+
57+
+/*
58+
#[test]
59+
fn test_is_sorted() {
60+
let empty: [i32; 0] = [];
61+
@@ -2122,6 +2123,7 @@ fn test_is_sorted() {
62+
assert!(!["c", "bb", "aaa"].is_sorted());
63+
assert!(["c", "bb", "aaa"].is_sorted_by_key(|s| s.len()));
64+
}
65+
+*/
66+
67+
#[test]
68+
fn test_slice_run_destructors() {
4969
-- 2.21.0 (Apple Git-122)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
From b1ae000f6da1abd3b8e9b80c40bc11c89b8ae93c Mon Sep 17 00:00:00 2001
2+
From: bjorn3 <bjorn3@users.noreply.github.com>
3+
Date: Thu, 30 Dec 2021 16:54:40 +0100
4+
Subject: [PATCH] [core] Disable portable-simd test
5+
6+
---
7+
library/core/tests/lib.rs | 1 -
8+
1 file changed, 1 deletion(-)
9+
10+
diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs
11+
index ec70034..7cd9e21 100644
12+
--- a/library/core/tests/lib.rs
13+
+++ b/library/core/tests/lib.rs
14+
@@ -121,7 +121,6 @@ mod pattern;
15+
mod pin;
16+
mod ptr;
17+
mod result;
18+
-mod simd;
19+
mod slice;
20+
mod str;
21+
mod str_lossy;
22+
--
23+
2.26.2.7.g19db9cfb68
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
From 0ffdd8eda8df364391c8ac6e1ce92c73ba9254d4 Mon Sep 17 00:00:00 2001
2+
From: bjorn3 <bjorn3@users.noreply.github.com>
3+
Date: Fri, 3 Dec 2021 12:16:30 +0100
4+
Subject: [PATCH] Disable long running tests
5+
6+
---
7+
library/core/tests/slice.rs | 3 +++
8+
1 file changed, 3 insertions(+)
9+
10+
diff --git a/library/core/tests/slice.rs b/library/core/tests/slice.rs
11+
index 2c8f00a..44847ee 100644
12+
--- a/library/core/tests/slice.rs
13+
+++ b/library/core/tests/slice.rs
14+
@@ -2332,7 +2332,8 @@ macro_rules! empty_max_mut {
15+
};
16+
}
17+
18+
+/*
19+
#[cfg(not(miri))] // Comparing usize::MAX many elements takes forever in Miri (and in rustc without optimizations)
20+
take_tests! {
21+
slice: &[(); usize::MAX], method: take,
22+
(take_in_bounds_max_range_to, (..usize::MAX), Some(EMPTY_MAX), &[(); 0]),
23+
@@ -2345,3 +2347,4 @@ take_tests! {
24+
(take_mut_oob_max_range_to_inclusive, (..=usize::MAX), None, empty_max_mut!()),
25+
(take_mut_in_bounds_max_range_from, (usize::MAX..), Some(&mut [] as _), empty_max_mut!()),
26+
}
27+
+*/
28+
--
29+
2.26.2.7.g19db9cfb68
30+
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nightly-2021-09-28
1+
nightly-2021-12-30

0 commit comments

Comments
 (0)