diff --git a/src/Cargo.lock b/src/Cargo.lock index 27abcf61d63..ccc1ccce87a 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -243,6 +243,18 @@ dependencies = [ "serde_json 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "cargo_metadata" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.69 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.69 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "cargotest2" version = "0.1.0" @@ -629,6 +641,14 @@ dependencies = [ "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "error-chain" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "error_index_generator" version = "0.0.0" @@ -1216,12 +1236,13 @@ name = "miri" version = "0.1.0" dependencies = [ "byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "cargo_metadata 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", + "cargo_metadata 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "compiletest_rs 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3031,6 +3052,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum bufstream 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f382711e76b9de6c744cc00d0497baba02fb00a787f088c879f01d09468e32" "checksum byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "74c0b906e9446b0a2e4f760cdb3fa4b2c48cdc6db8766a845c54b6ff063fd2e9" "checksum cargo_metadata 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1efca0b863ca03ed4c109fb1c55e0bc4bbeb221d3e103d86251046b06a526bd0" +"checksum cargo_metadata 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d6809b327f87369e6f3651efd2c5a96c49847a3ed2559477ecba79014751ee1" "checksum cc 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "49ec142f5768efb5b7622aebc3fdbdbb8950a4b9ba996393cb76ef7466e8747d" "checksum cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efe5c877e17a9c717a0bf3613b2709f723202c4e4675cc8f12926ded29bcb17e" "checksum chalk-engine 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a146c19172c7eea48ea55a7123ac95da786639bc665097f1e14034ee5f1d8699" @@ -3062,6 +3084,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0e6e40ebb0e66918a37b38c7acab4e10d299e0463fe2af5d29b9cc86710cfd2a" "checksum environment 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f4b14e20978669064c33b4c1e0fb4083412e40fe56cbea2eae80fd7591503ee" "checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3" +"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" "checksum failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "934799b6c1de475a012a02dab0ace1ace43789ee4b99bcfbf1a2e3e8ced5de82" "checksum failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7cdda555bb90c9bb67a3b670a0f42de8e73f5981524123ad8578aafec8ddb8b" "checksum filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "da4b9849e77b13195302c174324b5ba73eec9b236b24c221a61000daefb95c5f" diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index eb534cb685e..79167b1fd5e 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -903,10 +903,7 @@ impl<'a> Builder<'a> { .env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_libdir(compiler)); } - // Ignore incremental modes except for stage0, since we're - // not guaranteeing correctness across builds if the compiler - // is changing under your feet.` - if self.config.incremental && compiler.stage == 0 { + if self.config.incremental { cargo.env("CARGO_INCREMENTAL", "1"); } diff --git a/src/bootstrap/metadata.rs b/src/bootstrap/metadata.rs index 718a6da3637..fa0b1983510 100644 --- a/src/bootstrap/metadata.rs +++ b/src/bootstrap/metadata.rs @@ -51,7 +51,7 @@ pub fn build(build: &mut Build) { build_krate("", build, &mut resolves, "src/libtest"); build_krate(&build.rustc_features(), build, &mut resolves, "src/rustc"); - let mut id2name = HashMap::new(); + let mut id2name = HashMap::with_capacity(build.crates.len()); for (name, krate) in build.crates.iter() { id2name.insert(krate.id.clone(), name.clone()); } diff --git a/src/ci/docker/x86_64-gnu-tools/checktools.sh b/src/ci/docker/x86_64-gnu-tools/checktools.sh index e8197e90851..f6d375058a7 100755 --- a/src/ci/docker/x86_64-gnu-tools/checktools.sh +++ b/src/ci/docker/x86_64-gnu-tools/checktools.sh @@ -81,8 +81,8 @@ status_check() { check_dispatch $1 beta rust-by-example src/doc/rust-by-example check_dispatch $1 beta rls src/tools/rls check_dispatch $1 beta rustfmt src/tools/rustfmt + check_dispatch $1 beta clippy-driver src/tools/clippy # these tools are not required for beta to successfully branch - check_dispatch $1 nightly clippy-driver src/tools/clippy check_dispatch $1 nightly miri src/tools/miri } @@ -106,12 +106,14 @@ $COMMIT\t$(cat "$TOOLSTATE_FILE") fi } -if [ "$RUST_RELEASE_CHANNEL" = nightly -a -n "${TOOLSTATE_REPO_ACCESS_TOKEN+is_set}" ]; then - . "$(dirname $0)/repo.sh" - MESSAGE_FILE=$(mktemp -t msg.XXXXXX) - echo "($OS CI update)" > "$MESSAGE_FILE" - commit_toolstate_change "$MESSAGE_FILE" change_toolstate - rm -f "$MESSAGE_FILE" +if [ "$RUST_RELEASE_CHANNEL" = nightly ]; then + if [ -n "${TOOLSTATE_REPO_ACCESS_TOKEN+is_set}" ]; then + . "$(dirname $0)/repo.sh" + MESSAGE_FILE=$(mktemp -t msg.XXXXXX) + echo "($OS CI update)" > "$MESSAGE_FILE" + commit_toolstate_change "$MESSAGE_FILE" change_toolstate + rm -f "$MESSAGE_FILE" + fi exit 0 fi diff --git a/src/doc/nomicon b/src/doc/nomicon index 13e3745ca39..66ef7373409 160000 --- a/src/doc/nomicon +++ b/src/doc/nomicon @@ -1 +1 @@ -Subproject commit 13e3745ca399118df05e8261e12e3ada6e616b48 +Subproject commit 66ef7373409d1979c2839db8886ac2ec9b6a58cd diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index 7324df95bc5..11cc4ffecf0 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -63,9 +63,9 @@ /// /// The key difference between the two traits is the intention: /// -/// - Use `AsRef` when goal is to simply convert into a reference -/// - Use `Borrow` when goal is related to writing code that is agnostic to the -/// type of borrow and if is reference or value +/// - Use `AsRef` when the goal is to simply convert into a reference +/// - Use `Borrow` when the goal is related to writing code that is agnostic to +/// the type of borrow and whether it is a reference or value /// /// See [the book][book] for a more detailed comparison. /// diff --git a/src/librustc_data_structures/obligation_forest/mod.rs b/src/librustc_data_structures/obligation_forest/mod.rs index df34891ff03..0d6cf260dcd 100644 --- a/src/librustc_data_structures/obligation_forest/mod.rs +++ b/src/librustc_data_structures/obligation_forest/mod.rs @@ -496,9 +496,14 @@ impl ObligationForest { } } NodeState::Done => { - self.waiting_cache.remove(self.nodes[i].obligation.as_predicate()); - // FIXME(HashMap): why can't I get my key back? - self.done_cache.insert(self.nodes[i].obligation.as_predicate().clone()); + // Avoid cloning the key (predicate) in case it exists in the waiting cache + if let Some((predicate, _)) = self.waiting_cache + .remove_entry(self.nodes[i].obligation.as_predicate()) + { + self.done_cache.insert(predicate); + } else { + self.done_cache.insert(self.nodes[i].obligation.as_predicate().clone()); + } node_rewrites[i] = nodes_len; dead_nodes += 1; } diff --git a/src/librustc_driver/profile/trace.rs b/src/librustc_driver/profile/trace.rs index 6426286ccbc..5f10c56e8e2 100644 --- a/src/librustc_driver/profile/trace.rs +++ b/src/librustc_driver/profile/trace.rs @@ -220,7 +220,8 @@ pub fn write_counts(count_file: &mut File, counts: &mut HashMap) { - let mut counts : HashMap = HashMap::new(); + let capacity = traces.iter().fold(0, |acc, t| acc + 1 + t.extent.len()); + let mut counts : HashMap = HashMap::with_capacity(capacity); compute_counts_rec(&mut counts, traces); write_counts(counts_file, &mut counts); diff --git a/src/librustc_errors/diagnostic.rs b/src/librustc_errors/diagnostic.rs index de73295b499..d079102a4ba 100644 --- a/src/librustc_errors/diagnostic.rs +++ b/src/librustc_errors/diagnostic.rs @@ -121,7 +121,7 @@ impl Diagnostic { } pub fn note_expected_found(&mut self, - label: &fmt::Display, + label: &dyn fmt::Display, expected: DiagnosticStyledString, found: DiagnosticStyledString) -> &mut Self @@ -130,11 +130,11 @@ impl Diagnostic { } pub fn note_expected_found_extra(&mut self, - label: &fmt::Display, + label: &dyn fmt::Display, expected: DiagnosticStyledString, found: DiagnosticStyledString, - expected_extra: &fmt::Display, - found_extra: &fmt::Display) + expected_extra: &dyn fmt::Display, + found_extra: &dyn fmt::Display) -> &mut Self { let mut msg: Vec<_> = vec![(format!("expected {} `", label), Style::NoStyle)]; diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs index 562c28f0840..9c7b7ea3395 100644 --- a/src/librustc_errors/diagnostic_builder.rs +++ b/src/librustc_errors/diagnostic_builder.rs @@ -148,17 +148,17 @@ impl<'a> DiagnosticBuilder<'a> { } forward!(pub fn note_expected_found(&mut self, - label: &fmt::Display, + label: &dyn fmt::Display, expected: DiagnosticStyledString, found: DiagnosticStyledString) -> &mut Self); forward!(pub fn note_expected_found_extra(&mut self, - label: &fmt::Display, + label: &dyn fmt::Display, expected: DiagnosticStyledString, found: DiagnosticStyledString, - expected_extra: &fmt::Display, - found_extra: &fmt::Display) + expected_extra: &dyn fmt::Display, + found_extra: &dyn fmt::Display) -> &mut Self); forward!(pub fn note(&mut self, msg: &str) -> &mut Self); diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index e79a3a87738..2f71c3a7232 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -148,7 +148,7 @@ impl EmitterWriter { } } - pub fn new(dst: Box, + pub fn new(dst: Box, code_map: Option>, short_message: bool, teach: bool) @@ -1469,13 +1469,13 @@ fn emit_to_destination(rendered_buffer: &Vec>, pub enum Destination { Terminal(StandardStream), Buffered(BufferWriter), - Raw(Box), + Raw(Box), } pub enum WritableDst<'a> { Terminal(&'a mut StandardStream), Buffered(&'a mut BufferWriter, Buffer), - Raw(&'a mut Box), + Raw(&'a mut Box), } impl Destination { diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index fd90e1cbe08..f18a7bd9136 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![deny(bare_trait_objects)] + #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] @@ -110,7 +112,7 @@ pub struct SubstitutionPart { pub snippet: String, } -pub type CodeMapperDyn = CodeMapper + sync::Send + sync::Sync; +pub type CodeMapperDyn = dyn CodeMapper + sync::Send + sync::Sync; pub trait CodeMapper { fn lookup_char_pos(&self, pos: BytePos) -> Loc; @@ -270,7 +272,7 @@ pub struct Handler { pub flags: HandlerFlags, err_count: AtomicUsize, - emitter: Lock>, + emitter: Lock>, continue_after_error: LockCell, delayed_span_bug: Lock>, @@ -326,7 +328,7 @@ impl Handler { pub fn with_emitter(can_emit_warnings: bool, treat_err_as_bug: bool, - e: Box) + e: Box) -> Handler { Handler::with_emitter_and_flags( e, @@ -337,7 +339,8 @@ impl Handler { }) } - pub fn with_emitter_and_flags(e: Box, flags: HandlerFlags) -> Handler { + pub fn with_emitter_and_flags(e: Box, flags: HandlerFlags) -> Handler + { Handler { flags, err_count: AtomicUsize::new(0), diff --git a/src/librustc_errors/lock.rs b/src/librustc_errors/lock.rs index 4c298228c37..dff8d53986d 100644 --- a/src/librustc_errors/lock.rs +++ b/src/librustc_errors/lock.rs @@ -23,7 +23,7 @@ use std::any::Any; #[cfg(windows)] #[allow(bad_style)] -pub fn acquire_global_lock(name: &str) -> Box { +pub fn acquire_global_lock(name: &str) -> Box { use std::ffi::CString; use std::io; @@ -110,6 +110,6 @@ pub fn acquire_global_lock(name: &str) -> Box { } #[cfg(unix)] -pub fn acquire_global_lock(_name: &str) -> Box { +pub fn acquire_global_lock(_name: &str) -> Box { Box::new(()) } diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index bd35cc0acda..b7040ed37d7 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -37,7 +37,7 @@ use syntax::codemap::CodeMap; use syntax::edition::Edition; use syntax::feature_gate::UnstableFeatures; use syntax::with_globals; -use syntax_pos::{BytePos, DUMMY_SP, Pos, Span, FileName}; +use syntax_pos::{BytePos, DUMMY_SP, Pos, Span, FileName, hygiene}; use errors; use errors::emitter::ColorConfig; @@ -561,6 +561,7 @@ impl Collector { rustc_driver::in_rustc_thread(move || with_globals(move || { io::set_panic(panic); io::set_print(print); + hygiene::set_default_edition(edition); run_test(&test, &cratename, &filename, diff --git a/src/test/rustdoc/edition-flag.rs b/src/test/rustdoc/edition-flag.rs new file mode 100644 index 00000000000..3475b657d25 --- /dev/null +++ b/src/test/rustdoc/edition-flag.rs @@ -0,0 +1,24 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags:--test -Z unstable-options +// edition:2018 + +#![feature(async_await)] + +/// ```rust +/// #![feature(async_await)] +/// fn main() { +/// let _ = async { }; +/// } +/// ``` +fn main() { + let _ = async { }; +} diff --git a/src/tools/miri b/src/tools/miri index 5b7bb32b0e4..911aedf7369 160000 --- a/src/tools/miri +++ b/src/tools/miri @@ -1 +1 @@ -Subproject commit 5b7bb32b0e46d195b80c4da09b560ac7fc92015d +Subproject commit 911aedf736992e907d11cb494167f41f28d02368