Skip to content

Commit ad19c32

Browse files
authored
Auto merge of #37002 - jonathandturner:rollup, r=jonathandturner
Rollup of 15 pull requests - Successful merges: #36726, #36832, #36909, #36930, #36932, #36957, #36959, #36960, #36962, #36965, #36966, #36967, #36972, #36974, #36977 - Failed merges:
2 parents 46957f0 + 89aebdb commit ad19c32

File tree

31 files changed

+925
-267
lines changed

31 files changed

+925
-267
lines changed

src/bootstrap/compile.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,16 @@ pub fn std_link(build: &Build,
9090
add_to_sysroot(&out_dir, &libdir);
9191

9292
if target.contains("musl") && !target.contains("mips") {
93-
copy_musl_third_party_objects(build, &libdir);
93+
copy_musl_third_party_objects(build, target, &libdir);
9494
}
9595
}
9696

9797
/// Copies the crt(1,i,n).o startup objects
9898
///
9999
/// Only required for musl targets that statically link to libc
100-
fn copy_musl_third_party_objects(build: &Build, into: &Path) {
100+
fn copy_musl_third_party_objects(build: &Build, target: &str, into: &Path) {
101101
for &obj in &["crt1.o", "crti.o", "crtn.o"] {
102-
copy(&build.config.musl_root.as_ref().unwrap().join("lib").join(obj), &into.join(obj));
102+
copy(&build.musl_root(target).unwrap().join("lib").join(obj), &into.join(obj));
103103
}
104104
}
105105

src/bootstrap/config.rs

+2
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ struct TomlTarget {
158158
cc: Option<String>,
159159
cxx: Option<String>,
160160
android_ndk: Option<String>,
161+
musl_root: Option<String>,
161162
}
162163

163164
impl Config {
@@ -268,6 +269,7 @@ impl Config {
268269
}
269270
target.cxx = cfg.cxx.clone().map(PathBuf::from);
270271
target.cc = cfg.cc.clone().map(PathBuf::from);
272+
target.musl_root = cfg.musl_root.clone().map(PathBuf::from);
271273

272274
config.target_config.insert(triple.clone(), target);
273275
}

src/bootstrap/sanity.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ pub fn check(build: &mut Build) {
146146
}
147147
}
148148
None => {
149-
panic!("when targeting MUSL either the build.musl-root \
150-
option or the target.$TARGET.musl-root one must \
149+
panic!("when targeting MUSL either the rust.musl-root \
150+
option or the target.$TARGET.musl-root option must \
151151
be specified in config.toml")
152152
}
153153
}

src/doc/book/concurrency.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Concurrency and parallelism are incredibly important topics in computer
44
science, and are also a hot topic in industry today. Computers are gaining more
55
and more cores, yet many programmers aren't prepared to fully utilize them.
66

7-
Rust's memory safety features also apply to its concurrency story too. Even
7+
Rust's memory safety features also apply to its concurrency story. Even
88
concurrent Rust programs must be memory safe, having no data races. Rust's type
99
system is up to the task, and gives you powerful ways to reason about
1010
concurrent code at compile time.
@@ -281,8 +281,8 @@ And... still gives us an error.
281281
```
282282

283283
`Arc<T>` by default has immutable contents. It allows the _sharing_ of data
284-
between threads, but shared mutable data is unsafe and when threads are
285-
involved can cause data races!
284+
between threads, but shared mutable data is unsafeand when threads are
285+
involvedcan cause data races!
286286

287287

288288
Usually when we wish to make something in an immutable position mutable, we use

src/libcollections/str.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -1053,10 +1053,10 @@ impl str {
10531053
}
10541054

10551055
/// An iterator over substrings of the given string slice, separated by a
1056-
/// pattern, restricted to returning at most `count` items.
1056+
/// pattern, restricted to returning at most `n` items.
10571057
///
1058-
/// The last element returned, if any, will contain the remainder of the
1059-
/// string slice.
1058+
/// If `n` substrings are returned, the last substring (the `n`th substring)
1059+
/// will contain the remainder of the string.
10601060
///
10611061
/// The pattern can be a `&str`, [`char`], or a closure that determines the
10621062
/// split.
@@ -1098,16 +1098,16 @@ impl str {
10981098
/// assert_eq!(v, ["abc", "defXghi"]);
10991099
/// ```
11001100
#[stable(feature = "rust1", since = "1.0.0")]
1101-
pub fn splitn<'a, P: Pattern<'a>>(&'a self, count: usize, pat: P) -> SplitN<'a, P> {
1102-
core_str::StrExt::splitn(self, count, pat)
1101+
pub fn splitn<'a, P: Pattern<'a>>(&'a self, n: usize, pat: P) -> SplitN<'a, P> {
1102+
core_str::StrExt::splitn(self, n, pat)
11031103
}
11041104

11051105
/// An iterator over substrings of this string slice, separated by a
11061106
/// pattern, starting from the end of the string, restricted to returning
1107-
/// at most `count` items.
1107+
/// at most `n` items.
11081108
///
1109-
/// The last element returned, if any, will contain the remainder of the
1110-
/// string slice.
1109+
/// If `n` substrings are returned, the last substring (the `n`th substring)
1110+
/// will contain the remainder of the string.
11111111
///
11121112
/// The pattern can be a `&str`, [`char`], or a closure that
11131113
/// determines the split.
@@ -1145,10 +1145,10 @@ impl str {
11451145
/// assert_eq!(v, ["ghi", "abc1def"]);
11461146
/// ```
11471147
#[stable(feature = "rust1", since = "1.0.0")]
1148-
pub fn rsplitn<'a, P: Pattern<'a>>(&'a self, count: usize, pat: P) -> RSplitN<'a, P>
1148+
pub fn rsplitn<'a, P: Pattern<'a>>(&'a self, n: usize, pat: P) -> RSplitN<'a, P>
11491149
where P::Searcher: ReverseSearcher<'a>
11501150
{
1151-
core_str::StrExt::rsplitn(self, count, pat)
1151+
core_str::StrExt::rsplitn(self, n, pat)
11521152
}
11531153

11541154
/// An iterator over the matches of a pattern within the given string

src/libcore/hash/sip.rs

+9-14
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ use ptr;
1717

1818
/// An implementation of SipHash 1-3.
1919
///
20+
/// This is currently the default hashing function used by standard library
21+
/// (eg. `collections::HashMap` uses it by default).
22+
///
2023
/// See: https://131002.net/siphash/
2124
#[unstable(feature = "sip_hash_13", issue = "34767")]
2225
#[rustc_deprecated(since = "1.13.0", reason = "use `DefaultHasher` instead")]
@@ -39,9 +42,6 @@ pub struct SipHasher24 {
3942
///
4043
/// See: https://131002.net/siphash/
4144
///
42-
/// This is currently the default hashing function used by standard library
43-
/// (eg. `collections::HashMap` uses it by default).
44-
///
4545
/// SipHash is a general-purpose hashing function: it runs at a good
4646
/// speed (competitive with Spooky and City) and permits strong _keyed_
4747
/// hashing. This lets you key your hashtables from a strong RNG, such as
@@ -117,23 +117,18 @@ unsafe fn load_u64_le(buf: &[u8], i: usize) -> u64 {
117117
data.to_le()
118118
}
119119

120-
macro_rules! rotl {
121-
($x:expr, $b:expr) =>
122-
(($x << $b) | ($x >> (64_i32.wrapping_sub($b))))
123-
}
124-
125120
macro_rules! compress {
126121
($state:expr) => ({
127122
compress!($state.v0, $state.v1, $state.v2, $state.v3)
128123
});
129124
($v0:expr, $v1:expr, $v2:expr, $v3:expr) =>
130125
({
131-
$v0 = $v0.wrapping_add($v1); $v1 = rotl!($v1, 13); $v1 ^= $v0;
132-
$v0 = rotl!($v0, 32);
133-
$v2 = $v2.wrapping_add($v3); $v3 = rotl!($v3, 16); $v3 ^= $v2;
134-
$v0 = $v0.wrapping_add($v3); $v3 = rotl!($v3, 21); $v3 ^= $v0;
135-
$v2 = $v2.wrapping_add($v1); $v1 = rotl!($v1, 17); $v1 ^= $v2;
136-
$v2 = rotl!($v2, 32);
126+
$v0 = $v0.wrapping_add($v1); $v1 = $v1.rotate_left(13); $v1 ^= $v0;
127+
$v0 = $v0.rotate_left(32);
128+
$v2 = $v2.wrapping_add($v3); $v3 = $v3.rotate_left(16); $v3 ^= $v2;
129+
$v0 = $v0.wrapping_add($v3); $v3 = $v3.rotate_left(21); $v3 ^= $v0;
130+
$v2 = $v2.wrapping_add($v1); $v1 = $v1.rotate_left(17); $v1 ^= $v2;
131+
$v2 = $v2.rotate_left(32);
137132
});
138133
}
139134

src/librustc_const_eval/check_match.rs

+15-7
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ use rustc::middle::expr_use_visitor::{LoanCause, MutateMode};
2525
use rustc::middle::expr_use_visitor as euv;
2626
use rustc::middle::mem_categorization::{cmt};
2727
use rustc::hir::pat_util::*;
28+
use rustc::session::Session;
2829
use rustc::traits::Reveal;
2930
use rustc::ty::{self, Ty, TyCtxt};
31+
use rustc_errors::DiagnosticBuilder;
3032
use std::cmp::Ordering;
3133
use std::fmt;
3234
use std::iter::{FromIterator, IntoIterator, repeat};
@@ -163,6 +165,10 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
163165
tcx.sess.abort_if_errors();
164166
}
165167

168+
fn create_e0004<'a>(sess: &'a Session, sp: Span, error_message: String) -> DiagnosticBuilder<'a> {
169+
struct_span_err!(sess, sp, E0004, "{}", &error_message)
170+
}
171+
166172
fn check_expr(cx: &mut MatchCheckCtxt, ex: &hir::Expr) {
167173
intravisit::walk_expr(cx, ex);
168174
match ex.node {
@@ -215,9 +221,10 @@ fn check_expr(cx: &mut MatchCheckCtxt, ex: &hir::Expr) {
215221
if inlined_arms.is_empty() {
216222
if !pat_ty.is_uninhabited(cx.tcx) {
217223
// We know the type is inhabited, so this must be wrong
218-
let mut err = struct_span_err!(cx.tcx.sess, ex.span, E0002,
219-
"non-exhaustive patterns: type {} is non-empty",
220-
pat_ty);
224+
let mut err = create_e0004(cx.tcx.sess, ex.span,
225+
format!("non-exhaustive patterns: type {} \
226+
is non-empty",
227+
pat_ty));
221228
span_help!(&mut err, ex.span,
222229
"Please ensure that all possible cases are being handled; \
223230
possibly adding wildcards or more match arms.");
@@ -438,10 +445,11 @@ fn check_exhaustive<'a, 'tcx>(cx: &MatchCheckCtxt<'a, 'tcx>,
438445
1 => format!("pattern {} not covered", joined_patterns),
439446
_ => format!("patterns {} not covered", joined_patterns)
440447
};
441-
struct_span_err!(cx.tcx.sess, sp, E0004,
442-
"non-exhaustive patterns: {} not covered",
443-
joined_patterns
444-
).span_label(sp, &label_text).emit();
448+
create_e0004(cx.tcx.sess, sp,
449+
format!("non-exhaustive patterns: {} not covered",
450+
joined_patterns))
451+
.span_label(sp, &label_text)
452+
.emit();
445453
},
446454
}
447455
}

0 commit comments

Comments
 (0)