Skip to content

Commit ef3ec5e

Browse files
committed
Auto merge of #41965 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 15 pull requests - Successful merges: #41820, #41860, #41876, #41896, #41912, #41916, #41918, #41921, #41923, #41934, #41935, #41940, #41942, #41943, #41951 - Failed merges:
2 parents 453cad6 + f28e3cd commit ef3ec5e

39 files changed

+475
-384
lines changed

src/bootstrap/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ impl Config {
264264
let table = match p.parse() {
265265
Some(table) => table,
266266
None => {
267-
println!("failed to parse TOML configuration:");
267+
println!("failed to parse TOML configuration '{}':", file.to_str().unwrap());
268268
for err in p.errors.iter() {
269269
let (loline, locol) = p.to_linecol(err.lo);
270270
let (hiline, hicol) = p.to_linecol(err.hi);

src/bootstrap/config.toml.example

+3
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@
175175
[rust]
176176

177177
# Whether or not to optimize the compiler and standard library
178+
# Note: the slowness of the non optimized compiler compiling itself usually
179+
# outweighs the time gains in not doing optimizations, therefore a
180+
# full bootstrap takes much more time with optimize set to false.
178181
#optimize = true
179182

180183
# Number of codegen units to use for each compiler invocation. A value of 0

src/bootstrap/native.rs

+17
Original file line numberDiff line numberDiff line change
@@ -309,11 +309,15 @@ pub fn openssl(build: &Build, target: &str) {
309309
configure.arg("no-ssl3");
310310

311311
let os = match target {
312+
"aarch64-linux-android" => "linux-aarch64",
312313
"aarch64-unknown-linux-gnu" => "linux-aarch64",
314+
"arm-linux-androideabi" => "android",
313315
"arm-unknown-linux-gnueabi" => "linux-armv4",
314316
"arm-unknown-linux-gnueabihf" => "linux-armv4",
317+
"armv7-linux-androideabi" => "android-armv7",
315318
"armv7-unknown-linux-gnueabihf" => "linux-armv4",
316319
"i686-apple-darwin" => "darwin-i386-cc",
320+
"i686-linux-android" => "android-x86",
317321
"i686-unknown-freebsd" => "BSD-x86-elf",
318322
"i686-unknown-linux-gnu" => "linux-elf",
319323
"i686-unknown-linux-musl" => "linux-elf",
@@ -326,6 +330,7 @@ pub fn openssl(build: &Build, target: &str) {
326330
"powerpc64le-unknown-linux-gnu" => "linux-ppc64le",
327331
"s390x-unknown-linux-gnu" => "linux64-s390x",
328332
"x86_64-apple-darwin" => "darwin64-x86_64-cc",
333+
"x86_64-linux-android" => "linux-x86_64",
329334
"x86_64-unknown-freebsd" => "BSD-x86_64",
330335
"x86_64-unknown-linux-gnu" => "linux-x86_64",
331336
"x86_64-unknown-linux-musl" => "linux-x86_64",
@@ -337,6 +342,18 @@ pub fn openssl(build: &Build, target: &str) {
337342
for flag in build.cflags(target) {
338343
configure.arg(flag);
339344
}
345+
// There is no specific os target for android aarch64 or x86_64,
346+
// so we need to pass some extra cflags
347+
if target == "aarch64-linux-android" || target == "x86_64-linux-android" {
348+
configure.arg("-mandroid");
349+
configure.arg("-fomit-frame-pointer");
350+
}
351+
// Make PIE binaries
352+
// Non-PIE linker support was removed in Lollipop
353+
// https://source.android.com/security/enhancements/enhancements50
354+
if target == "i686-linux-android" {
355+
configure.arg("no-asm");
356+
}
340357
configure.current_dir(&obj);
341358
println!("Configuring openssl for {}", target);
342359
build.run_quiet(&mut configure);

src/libcollections/str.rs

-12
Original file line numberDiff line numberDiff line change
@@ -176,18 +176,6 @@ impl<'a> Iterator for EncodeUtf16<'a> {
176176
#[unstable(feature = "fused", issue = "35602")]
177177
impl<'a> FusedIterator for EncodeUtf16<'a> {}
178178

179-
// Return the initial codepoint accumulator for the first byte.
180-
// The first byte is special, only want bottom 5 bits for width 2, 4 bits
181-
// for width 3, and 3 bits for width 4
182-
macro_rules! utf8_first_byte {
183-
($byte:expr, $width:expr) => (($byte & (0x7F >> $width)) as u32)
184-
}
185-
186-
// return the value of $ch updated with continuation byte $byte
187-
macro_rules! utf8_acc_cont_byte {
188-
($ch:expr, $byte:expr) => (($ch << 6) | ($byte & 63) as u32)
189-
}
190-
191179
#[stable(feature = "rust1", since = "1.0.0")]
192180
impl Borrow<str> for String {
193181
#[inline]

src/libcore/iter/iterator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ pub trait Iterator {
119119
/// // exactly wouldn't be possible without executing filter().
120120
/// assert_eq!((0, Some(10)), iter.size_hint());
121121
///
122-
/// // Let's add one five more numbers with chain()
122+
/// // Let's add five more numbers with chain()
123123
/// let iter = (0..10).filter(|x| x % 2 == 0).chain(15..20);
124124
///
125125
/// // now both bounds are increased by five

src/libcore/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,6 @@ mod macros;
104104
#[macro_use]
105105
mod internal_macros;
106106

107-
#[path = "num/float_macros.rs"]
108-
#[macro_use]
109-
mod float_macros;
110-
111107
#[path = "num/int_macros.rs"]
112108
#[macro_use]
113109
mod int_macros;

src/libcore/num/mod.rs

-7
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,6 @@ pub mod dec2flt;
9696
pub mod bignum;
9797
pub mod diy_float;
9898

99-
macro_rules! checked_op {
100-
($U:ty, $op:path, $x:expr, $y:expr) => {{
101-
let (result, overflowed) = unsafe { $op($x as $U, $y as $U) };
102-
if overflowed { None } else { Some(result as Self) }
103-
}}
104-
}
105-
10699
// `Int` + `SignedInt` implemented for signed integers
107100
macro_rules! int_impl {
108101
($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr,

src/librustc/ty/sty.rs

+23-24
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ pub enum BoundRegion {
6767
/// Fresh bound identifiers created during GLB computations.
6868
BrFresh(u32),
6969

70-
// Anonymous region for the implicit env pointer parameter
71-
// to a closure
70+
/// Anonymous region for the implicit env pointer parameter
71+
/// to a closure
7272
BrEnv,
7373
}
7474

@@ -95,8 +95,8 @@ pub struct Issue32330 {
9595
pub region_name: ast::Name,
9696
}
9797

98-
// NB: If you change this, you'll probably want to change the corresponding
99-
// AST structure in libsyntax/ast.rs as well.
98+
/// NB: If you change this, you'll probably want to change the corresponding
99+
/// AST structure in libsyntax/ast.rs as well.
100100
#[derive(Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)]
101101
pub enum TypeVariants<'tcx> {
102102
/// The primitive boolean type. Written as `bool`.
@@ -283,11 +283,11 @@ impl<'a, 'gcx, 'acx, 'tcx> ClosureSubsts<'tcx> {
283283

284284
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
285285
pub enum ExistentialPredicate<'tcx> {
286-
// e.g. Iterator
286+
/// e.g. Iterator
287287
Trait(ExistentialTraitRef<'tcx>),
288-
// e.g. Iterator::Item = T
288+
/// e.g. Iterator::Item = T
289289
Projection(ExistentialProjection<'tcx>),
290-
// e.g. Send
290+
/// e.g. Send
291291
AutoTrait(DefId),
292292
}
293293

@@ -683,8 +683,8 @@ impl<'a, 'gcx, 'tcx> ParamTy {
683683
/// [dbi]: http://en.wikipedia.org/wiki/De_Bruijn_index
684684
#[derive(Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug, Copy)]
685685
pub struct DebruijnIndex {
686-
// We maintain the invariant that this is never 0. So 1 indicates
687-
// the innermost binder. To ensure this, create with `DebruijnIndex::new`.
686+
/// We maintain the invariant that this is never 0. So 1 indicates
687+
/// the innermost binder. To ensure this, create with `DebruijnIndex::new`.
688688
pub depth: u32,
689689
}
690690

@@ -908,7 +908,7 @@ impl DebruijnIndex {
908908
}
909909
}
910910

911-
// Region utilities
911+
/// Region utilities
912912
impl<'tcx> RegionKind<'tcx> {
913913
pub fn is_bound(&self) -> bool {
914914
match *self {
@@ -972,7 +972,7 @@ impl<'tcx> RegionKind<'tcx> {
972972
}
973973
}
974974

975-
// Type utilities
975+
/// Type utilities
976976
impl<'a, 'gcx, 'tcx> TyS<'tcx> {
977977
pub fn as_opt_param_ty(&self) -> Option<ty::ParamTy> {
978978
match self.sty {
@@ -995,8 +995,8 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
995995
}
996996
}
997997

998-
// Test whether this is a `()` which was produced by defaulting a
999-
// diverging type variable with feature(never_type) disabled.
998+
/// Test whether this is a `()` which was produced by defaulting a
999+
/// diverging type variable with feature(never_type) disabled.
10001000
pub fn is_defaulted_unit(&self) -> bool {
10011001
match self.sty {
10021002
TyTuple(_, true) => true,
@@ -1171,18 +1171,17 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
11711171
}
11721172
}
11731173

1174+
/// panics if called on any type other than `Box<T>`
11741175
pub fn boxed_ty(&self) -> Ty<'tcx> {
11751176
match self.sty {
11761177
TyAdt(def, substs) if def.is_box() => substs.type_at(0),
11771178
_ => bug!("`boxed_ty` is called on non-box type {:?}", self),
11781179
}
11791180
}
11801181

1181-
/*
1182-
A scalar type is one that denotes an atomic datum, with no sub-components.
1183-
(A TyRawPtr is scalar because it represents a non-managed pointer, so its
1184-
contents are abstract to rustc.)
1185-
*/
1182+
/// A scalar type is one that denotes an atomic datum, with no sub-components.
1183+
/// (A TyRawPtr is scalar because it represents a non-managed pointer, so its
1184+
/// contents are abstract to rustc.)
11861185
pub fn is_scalar(&self) -> bool {
11871186
match self.sty {
11881187
TyBool | TyChar | TyInt(_) | TyFloat(_) | TyUint(_) |
@@ -1278,10 +1277,10 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
12781277
}
12791278
}
12801279

1281-
// Returns the type and mutability of *ty.
1282-
//
1283-
// The parameter `explicit` indicates if this is an *explicit* dereference.
1284-
// Some types---notably unsafe ptrs---can only be dereferenced explicitly.
1280+
/// Returns the type and mutability of *ty.
1281+
///
1282+
/// The parameter `explicit` indicates if this is an *explicit* dereference.
1283+
/// Some types---notably unsafe ptrs---can only be dereferenced explicitly.
12851284
pub fn builtin_deref(&self, explicit: bool, pref: ty::LvaluePreference)
12861285
-> Option<TypeAndMut<'tcx>>
12871286
{
@@ -1302,7 +1301,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
13021301
}
13031302
}
13041303

1305-
// Returns the type of ty[i]
1304+
/// Returns the type of ty[i]
13061305
pub fn builtin_index(&self) -> Option<Ty<'tcx>> {
13071306
match self.sty {
13081307
TyArray(ty, _) | TySlice(ty) => Some(ty),
@@ -1317,7 +1316,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
13171316
}
13181317
}
13191318

1320-
// Type accessors for substructures of types
1319+
/// Type accessors for substructures of types
13211320
pub fn fn_args(&self) -> ty::Binder<&'tcx [Ty<'tcx>]> {
13221321
self.fn_sig().inputs()
13231322
}

src/librustc_errors/diagnostic.rs

+19-6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
use CodeSuggestion;
12+
use Substitution;
1213
use Level;
1314
use RenderSpan;
1415
use std::fmt;
@@ -23,7 +24,7 @@ pub struct Diagnostic {
2324
pub code: Option<String>,
2425
pub span: MultiSpan,
2526
pub children: Vec<SubDiagnostic>,
26-
pub suggestion: Option<CodeSuggestion>,
27+
pub suggestions: Vec<CodeSuggestion>,
2728
}
2829

2930
/// For example a note attached to an error.
@@ -87,7 +88,7 @@ impl Diagnostic {
8788
code: code,
8889
span: MultiSpan::new(),
8990
children: vec![],
90-
suggestion: None,
91+
suggestions: vec![],
9192
}
9293
}
9394

@@ -204,10 +205,22 @@ impl Diagnostic {
204205
///
205206
/// See `diagnostic::CodeSuggestion` for more information.
206207
pub fn span_suggestion(&mut self, sp: Span, msg: &str, suggestion: String) -> &mut Self {
207-
assert!(self.suggestion.is_none());
208-
self.suggestion = Some(CodeSuggestion {
209-
msp: sp.into(),
210-
substitutes: vec![suggestion],
208+
self.suggestions.push(CodeSuggestion {
209+
substitution_parts: vec![Substitution {
210+
span: sp,
211+
substitutions: vec![suggestion],
212+
}],
213+
msg: msg.to_owned(),
214+
});
215+
self
216+
}
217+
218+
pub fn span_suggestions(&mut self, sp: Span, msg: &str, suggestions: Vec<String>) -> &mut Self {
219+
self.suggestions.push(CodeSuggestion {
220+
substitution_parts: vec![Substitution {
221+
span: sp,
222+
substitutions: suggestions,
223+
}],
211224
msg: msg.to_owned(),
212225
});
213226
self

src/librustc_errors/diagnostic_builder.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ impl<'a> DiagnosticBuilder<'a> {
9999

100100
self.handler.emitter.borrow_mut().emit(&self);
101101
self.cancel();
102-
self.handler.panic_if_treat_err_as_bug();
102+
103+
if self.level == Level::Error {
104+
self.handler.panic_if_treat_err_as_bug();
105+
}
103106

104107
// if self.is_fatal() {
105108
// panic!(FatalError);
@@ -148,6 +151,11 @@ impl<'a> DiagnosticBuilder<'a> {
148151
msg: &str,
149152
suggestion: String)
150153
-> &mut Self);
154+
forward!(pub fn span_suggestions(&mut self,
155+
sp: Span,
156+
msg: &str,
157+
suggestions: Vec<String>)
158+
-> &mut Self);
151159
forward!(pub fn set_span<S: Into<MultiSpan>>(&mut self, sp: S) -> &mut Self);
152160
forward!(pub fn code(&mut self, s: String) -> &mut Self);
153161

0 commit comments

Comments
 (0)