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 13 pull requests #52486

Merged
merged 29 commits into from
Jul 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ad7621d
Handle array manually in string case conversion methods
Pazzaz Jul 6, 2018
a1e1b5c
rework `LineWriter` example
euclio Jun 19, 2018
ede1a5d
Amend option.take examples
rivertam Jul 10, 2018
c12a757
simplify assertions
euclio Jul 11, 2018
10b65fa
Revert some changes from #51917 to fix #52317.
o01eg Jul 16, 2018
a65d535
Fix doc comment: use `?` instead of `.unwrap()`
felixrabe Jul 17, 2018
bb2398f
rustc: Fix a suggestion for the `proc_macro` feature
alexcrichton Jul 17, 2018
3df4309
Allow clippy to be installed with make install
o01eg Jul 17, 2018
5ecec1c
rustc: Enable `use_extern_macros` in 2018 edition
alexcrichton Jul 17, 2018
2d4011d
Clarify short-circuiting behvaior of Iterator::zip.
frewsxcv Jul 18, 2018
ef2bac4
Remove workarounds for #24958
ljedrz Jul 18, 2018
2712fbe
Rollup merge of #52116 - Pazzaz:match-str-case, r=SimonSapin
kennytm Jul 18, 2018
21f7d2b
Rollup merge of #52218 - rivertam:patch-1, r=withoutboats
kennytm Jul 18, 2018
47a1d6b
Rollup merge of #52439 - o01eg:fix-52317, r=alexcrichton
kennytm Jul 18, 2018
d94a279
Rollup merge of #52455 - felixrabe:patch-1, r=estebank
kennytm Jul 18, 2018
5dd3275
Rollup merge of #52458 - alexcrichton:fix-suggestion, r=petrochenkov
kennytm Jul 18, 2018
fa9f91d
Rollup merge of #52464 - o01eg:patch-1, r=alexcrichton
kennytm Jul 18, 2018
5624d2a
Rollup merge of #52472 - alexcrichton:macros-edition-2018, r=petroche…
kennytm Jul 18, 2018
091c9d2
Rollup merge of #52477 - frewsxcv:frewsxcv-iter-short, r=alexcrichton
kennytm Jul 18, 2018
2e5d925
Don't build twice the sanitizers on Linux
alexcrichton Jul 18, 2018
1e5a8c6
Rollup merge of #52487 - alexcrichton:build-less-sanitizers, r=kennytm
kennytm Jul 18, 2018
9fe86e5
Rollup merge of #51628 - euclio:line-writer, r=frewsxcv
kennytm Jul 18, 2018
b1c6b76
Rollup merge of #52480 - ljedrz:cleanup_24958, r=oli-obk
kennytm Jul 18, 2018
ed362c0
Do not use desugared ident when suggesting adding a type
estebank Jul 16, 2018
4c96932
Change label span to point at iterator instead of iter item
Jul 16, 2018
2c5b60d
Update test output
Jul 18, 2018
5d54144
remove FIXME about macro redirects
QuietMisdreavus Jul 18, 2018
8336f1b
Rollup merge of #52418 - estebank:desugaring-type, r=nikomatsakis
kennytm Jul 18, 2018
ae9c550
Rollup merge of #52510 - QuietMisdreavus:redirects-are-cool, r=nrc
kennytm Jul 18, 2018
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
3 changes: 2 additions & 1 deletion src/bootstrap/bin/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn main() {
};

let mut dylib_path = bootstrap::util::dylib_path();
dylib_path.insert(0, PathBuf::from(libdir));
dylib_path.insert(0, PathBuf::from(libdir.clone()));

let mut cmd = Command::new(rustdoc);
cmd.args(&args)
Expand Down Expand Up @@ -69,6 +69,7 @@ fn main() {

if verbose > 1 {
eprintln!("rustdoc command: {:?}", cmd);
eprintln!("libdir: {:?}", libdir);
}

std::process::exit(match cmd.status() {
Expand Down
4 changes: 3 additions & 1 deletion src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ impl<'a> Builder<'a> {
dist::Cargo,
dist::Rls,
dist::Rustfmt,
dist::Clippy,
dist::LlvmTools,
dist::Extended,
dist::HashSign
Expand All @@ -469,6 +470,7 @@ impl<'a> Builder<'a> {
install::Cargo,
install::Rls,
install::Rustfmt,
install::Clippy,
install::Analysis,
install::Src,
install::Rustc
Expand Down Expand Up @@ -825,7 +827,7 @@ impl<'a> Builder<'a> {
cargo.env("RUSTC_ERROR_FORMAT", error_format);
}
if cmd != "build" && cmd != "check" && want_rustdoc {
cargo.env("RUSTDOC_LIBDIR", &libdir);
cargo.env("RUSTDOC_LIBDIR", self.sysroot_libdir(compiler, self.config.build));
}

if mode.is_tool() {
Expand Down
27 changes: 20 additions & 7 deletions src/build_helper/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
use std::time::{SystemTime, UNIX_EPOCH};
use std::{env, fs};
use std::thread;

/// A helper macro to `unwrap` a result except also print out details like:
///
Expand Down Expand Up @@ -181,7 +182,9 @@ pub struct NativeLibBoilerplate {

impl Drop for NativeLibBoilerplate {
fn drop(&mut self) {
t!(File::create(self.out_dir.join("rustbuild.timestamp")));
if !thread::panicking() {
t!(File::create(self.out_dir.join("rustbuild.timestamp")));
}
}
}

Expand Down Expand Up @@ -225,24 +228,34 @@ pub fn native_lib_boilerplate(
}
}

pub fn sanitizer_lib_boilerplate(sanitizer_name: &str) -> Result<NativeLibBoilerplate, ()> {
let (link_name, search_path) = match &*env::var("TARGET").unwrap() {
pub fn sanitizer_lib_boilerplate(sanitizer_name: &str)
-> Result<(NativeLibBoilerplate, String), ()>
{
let (link_name, search_path, dynamic) = match &*env::var("TARGET").unwrap() {
"x86_64-unknown-linux-gnu" => (
format!("clang_rt.{}-x86_64", sanitizer_name),
"build/lib/linux",
false,
),
"x86_64-apple-darwin" => (
format!("dylib=clang_rt.{}_osx_dynamic", sanitizer_name),
format!("clang_rt.{}_osx_dynamic", sanitizer_name),
"build/lib/darwin",
true,
),
_ => return Err(()),
};
native_lib_boilerplate(
let to_link = if dynamic {
format!("dylib={}", link_name)
} else {
format!("static={}", link_name)
};
let lib = native_lib_boilerplate(
"libcompiler_builtins/compiler-rt",
sanitizer_name,
&link_name,
&to_link,
search_path,
)
)?;
Ok((lib, link_name))
}

fn dir_up_to_date(src: &Path, threshold: SystemTime) -> bool {
Expand Down
29 changes: 27 additions & 2 deletions src/liballoc/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ use core::str::pattern::{Searcher, ReverseSearcher, DoubleEndedSearcher};
use core::mem;
use core::ptr;
use core::iter::FusedIterator;
use core::unicode::conversions;

use borrow::{Borrow, ToOwned};
use boxed::Box;
Expand Down Expand Up @@ -369,7 +370,18 @@ impl str {
// See https://github.com/rust-lang/rust/issues/26035
map_uppercase_sigma(self, i, &mut s)
} else {
s.extend(c.to_lowercase());
match conversions::to_lower(c) {
[a, '\0', _] => s.push(a),
[a, b, '\0'] => {
s.push(a);
s.push(b);
}
[a, b, c] => {
s.push(a);
s.push(b);
s.push(c);
}
}
}
}
return s;
Expand Down Expand Up @@ -423,7 +435,20 @@ impl str {
#[stable(feature = "unicode_case_mapping", since = "1.2.0")]
pub fn to_uppercase(&self) -> String {
let mut s = String::with_capacity(self.len());
s.extend(self.chars().flat_map(|c| c.to_uppercase()));
for c in self[..].chars() {
match conversions::to_upper(c) {
[a, '\0', _] => s.push(a),
[a, b, '\0'] => {
s.push(a);
s.push(b);
}
[a, b, c] => {
s.push(a);
s.push(b);
s.push(c);
}
}
}
return s;
}

Expand Down
4 changes: 3 additions & 1 deletion src/libcore/iter/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,9 @@ pub trait Iterator {
///
/// In other words, it zips two iterators together, into a single one.
///
/// If either iterator returns [`None`], [`next`] will return [`None`].
/// If either iterator returns [`None`], [`next`] from the zipped iterator
/// will return [`None`]. If the first iterator returns [`None`], `zip` will
/// short-circuit and `next` will not be called on the second iterator.
///
/// # Examples
///
Expand Down
6 changes: 4 additions & 2 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -833,12 +833,14 @@ impl<T> Option<T> {
///
/// ```
/// let mut x = Some(2);
/// x.take();
/// let y = x.take();
/// assert_eq!(x, None);
/// assert_eq!(y, Some(2));
///
/// let mut x: Option<u32> = None;
/// x.take();
/// let y = x.take();
/// assert_eq!(x, None);
/// assert_eq!(y, None);
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down
3 changes: 3 additions & 0 deletions src/libcore/unicode/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ pub(crate) mod version;
pub mod derived_property {
pub use unicode::tables::derived_property::{Case_Ignorable, Cased};
}
pub mod conversions {
pub use unicode::tables::conversions::{to_lower, to_upper};
}

// For use in libsyntax
pub mod property {
Expand Down
6 changes: 5 additions & 1 deletion src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4011,8 +4011,12 @@ impl<'a> LoweringContext<'a> {
let iter = self.str_to_ident("iter");

let next_ident = self.str_to_ident("__next");
let next_sp = self.allow_internal_unstable(
CompilerDesugaringKind::ForLoop,
head_sp,
);
let next_pat = self.pat_ident_binding_mode(
pat.span,
next_sp,
next_ident,
hir::BindingAnnotation::Mutable,
);
Expand Down
1 change: 1 addition & 0 deletions src/librustc/ich/impls_syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ impl_stable_hash_for!(enum ::syntax_pos::hygiene::CompilerDesugaringKind {
DotFill,
QuestionMark,
ExistentialReturnType,
ForLoop,
Catch
});

Expand Down
11 changes: 10 additions & 1 deletion src/librustc/infer/error_reporting/need_type_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use hir::intravisit::{self, Visitor, NestedVisitorMap};
use infer::InferCtxt;
use infer::type_variable::TypeVariableOrigin;
use ty::{self, Ty, TyInfer, TyVar};
use syntax::codemap::CompilerDesugaringKind;
use syntax_pos::Span;
use errors::DiagnosticBuilder;

Expand Down Expand Up @@ -132,7 +133,15 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
labels.push((pattern.span, format!("consider giving this closure parameter a type")));
} else if let Some(pattern) = local_visitor.found_local_pattern {
if let Some(simple_ident) = pattern.simple_ident() {
labels.push((pattern.span, format!("consider giving `{}` a type", simple_ident)));
match pattern.span.compiler_desugaring_kind() {
None => labels.push((pattern.span,
format!("consider giving `{}` a type", simple_ident))),
Some(CompilerDesugaringKind::ForLoop) => labels.push((
pattern.span,
"the element type for this iterator is not specified".to_string(),
)),
_ => {}
}
} else {
labels.push((pattern.span, format!("consider giving the pattern a type")));
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_asan/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use cmake::Config;

fn main() {
if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
let native = match sanitizer_lib_boilerplate("asan") {
let (native, target) = match sanitizer_lib_boilerplate("asan") {
Ok(native) => native,
_ => return,
};
Expand All @@ -29,7 +29,7 @@ fn main() {
.define("COMPILER_RT_BUILD_XRAY", "OFF")
.define("LLVM_CONFIG_PATH", llvm_config)
.out_dir(&native.out_dir)
.build_target("asan")
.build_target(&target)
.build();
}
println!("cargo:rerun-if-env-changed=LLVM_CONFIG");
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_lsan/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use cmake::Config;

fn main() {
if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
let native = match sanitizer_lib_boilerplate("lsan") {
let (native, target) = match sanitizer_lib_boilerplate("lsan") {
Ok(native) => native,
_ => return,
};
Expand All @@ -29,7 +29,7 @@ fn main() {
.define("COMPILER_RT_BUILD_XRAY", "OFF")
.define("LLVM_CONFIG_PATH", llvm_config)
.out_dir(&native.out_dir)
.build_target("lsan")
.build_target(&target)
.build();
}
println!("cargo:rerun-if-env-changed=LLVM_CONFIG");
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_msan/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use cmake::Config;

fn main() {
if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
let native = match sanitizer_lib_boilerplate("msan") {
let (native, target) = match sanitizer_lib_boilerplate("msan") {
Ok(native) => native,
_ => return,
};
Expand All @@ -29,7 +29,7 @@ fn main() {
.define("COMPILER_RT_BUILD_XRAY", "OFF")
.define("LLVM_CONFIG_PATH", llvm_config)
.out_dir(&native.out_dir)
.build_target("msan")
.build_target(&target)
.build();
}
println!("cargo:rerun-if-env-changed=LLVM_CONFIG");
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4521,7 +4521,7 @@ impl<'a> Resolver<'a> {
attr::mark_known(attr);

let msg = "attribute procedural macros are experimental";
let feature = "proc_macro";
let feature = "use_extern_macros";

feature_err(&self.session.parse_sess, feature,
attr.span, GateIssue::Language, msg)
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_tsan/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use cmake::Config;

fn main() {
if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
let native = match sanitizer_lib_boilerplate("tsan") {
let (native, target) = match sanitizer_lib_boilerplate("tsan") {
Ok(native) => native,
_ => return,
};
Expand All @@ -29,7 +29,7 @@ fn main() {
.define("COMPILER_RT_BUILD_XRAY", "OFF")
.define("LLVM_CONFIG_PATH", llvm_config)
.out_dir(&native.out_dir)
.build_target("tsan")
.build_target(&target)
.build();
}
println!("cargo:rerun-if-env-changed=LLVM_CONFIG");
Expand Down
1 change: 0 additions & 1 deletion src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1968,7 +1968,6 @@ impl Context {

// If the item is a macro, redirect from the old macro URL (with !)
// to the new one (without).
// FIXME(#35705) remove this redirect.
if item_type == ItemType::Macro {
let redir_name = format!("{}.{}!.html", item_type, name);
let redir_dst = self.dst.join(redir_name);
Expand Down
33 changes: 23 additions & 10 deletions src/libstd/io/buffered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ impl<W> fmt::Display for IntoInnerError<W> {
/// reducing the number of actual writes to the file.
///
/// ```no_run
/// use std::fs::File;
/// use std::fs::{self, File};
/// use std::io::prelude::*;
/// use std::io::LineWriter;
///
Expand All @@ -752,17 +752,30 @@ impl<W> fmt::Display for IntoInnerError<W> {
/// let file = File::create("poem.txt")?;
/// let mut file = LineWriter::new(file);
///
/// for &byte in road_not_taken.iter() {
/// file.write(&[byte]).unwrap();
/// }
/// file.write_all(b"I shall be telling this with a sigh")?;
///
/// // No bytes are written until a newline is encountered (or
/// // the internal buffer is filled).
/// assert_eq!(fs::read_to_string("poem.txt")?, "");
/// file.write_all(b"\n")?;
/// assert_eq!(
/// fs::read_to_string("poem.txt")?,
/// "I shall be telling this with a sigh\n",
/// );
///
/// // let's check we did the right thing.
/// let mut file = File::open("poem.txt")?;
/// let mut contents = String::new();
/// // Write the rest of the poem.
/// file.write_all(b"Somewhere ages and ages hence:
/// Two roads diverged in a wood, and I -
/// I took the one less traveled by,
/// And that has made all the difference.")?;
///
/// file.read_to_string(&mut contents)?;
/// // The last line of the poem doesn't end in a newline, so
/// // we have to flush or drop the `LineWriter` to finish
/// // writing.
/// file.flush()?;
///
/// assert_eq!(contents.as_bytes(), &road_not_taken[..]);
/// // Confirm the whole poem was written.
/// assert_eq!(fs::read("poem.txt")?, &road_not_taken[..]);
/// Ok(())
/// }
/// ```
Expand Down Expand Up @@ -862,7 +875,7 @@ impl<W: Write> LineWriter<W> {
///
/// The internal buffer is written out before returning the writer.
///
// # Errors
/// # Errors
///
/// An `Err` will be returned if an error occurs while flushing the buffer.
///
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/net/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub struct TcpStream(net_imp::TcpStream);
/// }
///
/// fn main() -> io::Result<()> {
/// let listener = TcpListener::bind("127.0.0.1:80").unwrap();
/// let listener = TcpListener::bind("127.0.0.1:80")?;
///
/// // accept connections and process them serially
/// for stream in listener.incoming() {
Expand Down
Loading