Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 15 pull requests #41965

Merged
merged 36 commits into from
May 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3acfa81
bootstrap: openssl android support
malbarbo May 5, 2017
cf05cd8
bootstrap: Output name of failed config in case of errors
devurandom May 7, 2017
defcfb2
Remove wrong or outdated info from CString docs.
mbrubeck May 9, 2017
67d762d
Refactor suggestion diagnostic API to allow for multiple suggestions
oli-obk May 9, 2017
e2f781c
Example usage of multiple suggestions
oli-obk May 10, 2017
9d51d6b
Fix tidy issues
oli-obk May 10, 2017
f859f25
Update a compile-fail test
oli-obk May 10, 2017
e42875c
doc: break into 2 sentences
tshepang May 11, 2017
644ce5e
Address PR reviews
oli-obk May 11, 2017
43349e6
Upgrade some comments to doc comments
oli-obk May 11, 2017
641d053
Fix typo in size_hint example comment
mglagla May 11, 2017
084b67f
Annotate the license exceptions
brson May 11, 2017
75b69c4
Fix search when looking to sources
GuillaumeGomez May 11, 2017
68c1ce9
rustc_trans: do not attempt to truncate an i1 const to i1.
eddyb May 11, 2017
80891f6
Remove some unused macros from the rust codebase
est31 May 12, 2017
a54bbf2
Weave the span of an import through the resolve code
oli-obk May 12, 2017
3f2bbe3
Don't use a DUMMY_SP for reporting issues with crate imports
oli-obk May 12, 2017
b47aa1b
config.toml.example: add note that optimize = false won't speed up a …
est31 May 12, 2017
7a03b4c
Fix unexpected panic with the -Z treat-err-as-bug option
tommyip May 12, 2017
26e7e49
rustdoc: Break words in the location box of the sidebar.
Eijebong May 12, 2017
99bca6e
Add tidy check to detect empty files
iKevinY May 12, 2017
88a5af7
Rollup merge of #41820 - devurandom:patch-1, r=alexcrichton
Mark-Simulacrum May 13, 2017
2519e90
Rollup merge of #41860 - mbrubeck:docs, r=nagisa
Mark-Simulacrum May 13, 2017
1f72662
Rollup merge of #41876 - oli-obk:diagnosing_diagnostics, r=nagisa
Mark-Simulacrum May 13, 2017
605d727
Rollup merge of #41896 - tshepang:too-long, r=steveklabnik
Mark-Simulacrum May 13, 2017
8b62560
Rollup merge of #41912 - oli-obk:patch-3, r=eddyb
Mark-Simulacrum May 13, 2017
82c3163
Rollup merge of #41916 - mglagla:typo, r=sfackler
Mark-Simulacrum May 13, 2017
cde12ee
Rollup merge of #41918 - brson:lic, r=alexcrichton
Mark-Simulacrum May 13, 2017
ee1c102
Rollup merge of #41921 - GuillaumeGomez:fix-search-style, r=steveklabnik
Mark-Simulacrum May 13, 2017
cf4fac6
Rollup merge of #41923 - eddyb:issue-41744, r=arielb1
Mark-Simulacrum May 13, 2017
f6bf99a
Rollup merge of #41934 - est31:remove_unused_macros, r=nagisa
Mark-Simulacrum May 13, 2017
ac02b64
Rollup merge of #41935 - iKevinY:detect-empty-files, r=Mark-Simulacrum
Mark-Simulacrum May 13, 2017
6e29059
Rollup merge of #41940 - est31:master, r=eddyb
Mark-Simulacrum May 13, 2017
c17811c
Rollup merge of #41942 - tommyip:master, r=Mark-Simulacrum
Mark-Simulacrum May 13, 2017
7b1e51d
Rollup merge of #41943 - malbarbo:android-openssl, r=alexcrichton
Mark-Simulacrum May 13, 2017
f28e3cd
Rollup merge of #41951 - Eijebong:master, r=GuillaumeGomez
Mark-Simulacrum May 13, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ impl Config {
let table = match p.parse() {
Some(table) => table,
None => {
println!("failed to parse TOML configuration:");
println!("failed to parse TOML configuration '{}':", file.to_str().unwrap());
for err in p.errors.iter() {
let (loline, locol) = p.to_linecol(err.lo);
let (hiline, hicol) = p.to_linecol(err.hi);
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@
[rust]

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

# Number of codegen units to use for each compiler invocation. A value of 0
Expand Down
17 changes: 17 additions & 0 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,15 @@ pub fn openssl(build: &Build, target: &str) {
configure.arg("no-ssl3");

let os = match target {
"aarch64-linux-android" => "linux-aarch64",
"aarch64-unknown-linux-gnu" => "linux-aarch64",
"arm-linux-androideabi" => "android",
"arm-unknown-linux-gnueabi" => "linux-armv4",
"arm-unknown-linux-gnueabihf" => "linux-armv4",
"armv7-linux-androideabi" => "android-armv7",
"armv7-unknown-linux-gnueabihf" => "linux-armv4",
"i686-apple-darwin" => "darwin-i386-cc",
"i686-linux-android" => "android-x86",
"i686-unknown-freebsd" => "BSD-x86-elf",
"i686-unknown-linux-gnu" => "linux-elf",
"i686-unknown-linux-musl" => "linux-elf",
Expand All @@ -326,6 +330,7 @@ pub fn openssl(build: &Build, target: &str) {
"powerpc64le-unknown-linux-gnu" => "linux-ppc64le",
"s390x-unknown-linux-gnu" => "linux64-s390x",
"x86_64-apple-darwin" => "darwin64-x86_64-cc",
"x86_64-linux-android" => "linux-x86_64",
"x86_64-unknown-freebsd" => "BSD-x86_64",
"x86_64-unknown-linux-gnu" => "linux-x86_64",
"x86_64-unknown-linux-musl" => "linux-x86_64",
Expand All @@ -337,6 +342,18 @@ pub fn openssl(build: &Build, target: &str) {
for flag in build.cflags(target) {
configure.arg(flag);
}
// There is no specific os target for android aarch64 or x86_64,
// so we need to pass some extra cflags
if target == "aarch64-linux-android" || target == "x86_64-linux-android" {
configure.arg("-mandroid");
configure.arg("-fomit-frame-pointer");
}
// Make PIE binaries
// Non-PIE linker support was removed in Lollipop
// https://source.android.com/security/enhancements/enhancements50
if target == "i686-linux-android" {
configure.arg("no-asm");
}
configure.current_dir(&obj);
println!("Configuring openssl for {}", target);
build.run_quiet(&mut configure);
Expand Down
12 changes: 0 additions & 12 deletions src/libcollections/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,18 +176,6 @@ impl<'a> Iterator for EncodeUtf16<'a> {
#[unstable(feature = "fused", issue = "35602")]
impl<'a> FusedIterator for EncodeUtf16<'a> {}

// Return the initial codepoint accumulator for the first byte.
// The first byte is special, only want bottom 5 bits for width 2, 4 bits
// for width 3, and 3 bits for width 4
macro_rules! utf8_first_byte {
($byte:expr, $width:expr) => (($byte & (0x7F >> $width)) as u32)
}

// return the value of $ch updated with continuation byte $byte
macro_rules! utf8_acc_cont_byte {
($ch:expr, $byte:expr) => (($ch << 6) | ($byte & 63) as u32)
}

#[stable(feature = "rust1", since = "1.0.0")]
impl Borrow<str> for String {
#[inline]
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/iter/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pub trait Iterator {
/// // exactly wouldn't be possible without executing filter().
/// assert_eq!((0, Some(10)), iter.size_hint());
///
/// // Let's add one five more numbers with chain()
/// // Let's add five more numbers with chain()
/// let iter = (0..10).filter(|x| x % 2 == 0).chain(15..20);
///
/// // now both bounds are increased by five
Expand Down
4 changes: 0 additions & 4 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,6 @@ mod macros;
#[macro_use]
mod internal_macros;

#[path = "num/float_macros.rs"]
#[macro_use]
mod float_macros;

#[path = "num/int_macros.rs"]
#[macro_use]
mod int_macros;
Expand Down
7 changes: 0 additions & 7 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,6 @@ pub mod dec2flt;
pub mod bignum;
pub mod diy_float;

macro_rules! checked_op {
($U:ty, $op:path, $x:expr, $y:expr) => {{
let (result, overflowed) = unsafe { $op($x as $U, $y as $U) };
if overflowed { None } else { Some(result as Self) }
}}
}

// `Int` + `SignedInt` implemented for signed integers
macro_rules! int_impl {
($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr,
Expand Down
47 changes: 23 additions & 24 deletions src/librustc/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ pub enum BoundRegion {
/// Fresh bound identifiers created during GLB computations.
BrFresh(u32),

// Anonymous region for the implicit env pointer parameter
// to a closure
/// Anonymous region for the implicit env pointer parameter
/// to a closure
BrEnv,
}

Expand All @@ -95,8 +95,8 @@ pub struct Issue32330 {
pub region_name: ast::Name,
}

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

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
pub enum ExistentialPredicate<'tcx> {
// e.g. Iterator
/// e.g. Iterator
Trait(ExistentialTraitRef<'tcx>),
// e.g. Iterator::Item = T
/// e.g. Iterator::Item = T
Projection(ExistentialProjection<'tcx>),
// e.g. Send
/// e.g. Send
AutoTrait(DefId),
}

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

Expand Down Expand Up @@ -908,7 +908,7 @@ impl DebruijnIndex {
}
}

// Region utilities
/// Region utilities
impl<'tcx> RegionKind<'tcx> {
pub fn is_bound(&self) -> bool {
match *self {
Expand Down Expand Up @@ -972,7 +972,7 @@ impl<'tcx> RegionKind<'tcx> {
}
}

// Type utilities
/// Type utilities
impl<'a, 'gcx, 'tcx> TyS<'tcx> {
pub fn as_opt_param_ty(&self) -> Option<ty::ParamTy> {
match self.sty {
Expand All @@ -995,8 +995,8 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
}
}

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

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

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

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

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

// Type accessors for substructures of types
/// Type accessors for substructures of types
pub fn fn_args(&self) -> ty::Binder<&'tcx [Ty<'tcx>]> {
self.fn_sig().inputs()
}
Expand Down
25 changes: 19 additions & 6 deletions src/librustc_errors/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

use CodeSuggestion;
use Substitution;
use Level;
use RenderSpan;
use std::fmt;
Expand All @@ -23,7 +24,7 @@ pub struct Diagnostic {
pub code: Option<String>,
pub span: MultiSpan,
pub children: Vec<SubDiagnostic>,
pub suggestion: Option<CodeSuggestion>,
pub suggestions: Vec<CodeSuggestion>,
}

/// For example a note attached to an error.
Expand Down Expand Up @@ -87,7 +88,7 @@ impl Diagnostic {
code: code,
span: MultiSpan::new(),
children: vec![],
suggestion: None,
suggestions: vec![],
}
}

Expand Down Expand Up @@ -204,10 +205,22 @@ impl Diagnostic {
///
/// See `diagnostic::CodeSuggestion` for more information.
pub fn span_suggestion(&mut self, sp: Span, msg: &str, suggestion: String) -> &mut Self {
assert!(self.suggestion.is_none());
self.suggestion = Some(CodeSuggestion {
msp: sp.into(),
substitutes: vec![suggestion],
self.suggestions.push(CodeSuggestion {
substitution_parts: vec![Substitution {
span: sp,
substitutions: vec![suggestion],
}],
msg: msg.to_owned(),
});
self
}

pub fn span_suggestions(&mut self, sp: Span, msg: &str, suggestions: Vec<String>) -> &mut Self {
self.suggestions.push(CodeSuggestion {
substitution_parts: vec![Substitution {
span: sp,
substitutions: suggestions,
}],
msg: msg.to_owned(),
});
self
Expand Down
10 changes: 9 additions & 1 deletion src/librustc_errors/diagnostic_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ impl<'a> DiagnosticBuilder<'a> {

self.handler.emitter.borrow_mut().emit(&self);
self.cancel();
self.handler.panic_if_treat_err_as_bug();

if self.level == Level::Error {
self.handler.panic_if_treat_err_as_bug();
}

// if self.is_fatal() {
// panic!(FatalError);
Expand Down Expand Up @@ -148,6 +151,11 @@ impl<'a> DiagnosticBuilder<'a> {
msg: &str,
suggestion: String)
-> &mut Self);
forward!(pub fn span_suggestions(&mut self,
sp: Span,
msg: &str,
suggestions: Vec<String>)
-> &mut Self);
forward!(pub fn set_span<S: Into<MultiSpan>>(&mut self, sp: S) -> &mut Self);
forward!(pub fn code(&mut self, s: String) -> &mut Self);

Expand Down
Loading