From f708228508f29983e7d936e9b0388b0e64a51512 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 5 Jun 2019 12:38:05 -0700 Subject: [PATCH 1/5] rustbuild: Include `rustfmt` in deduplicated dependencies Currently `rustfmt` is excluded from the "don't build dependencies twice" check but it's currently building dependencies twice! Namely big dependencies like `rustc-ap-syntax` are built once for rustfmt and once for the RLS. This commit includes `rustfmt` in these checks and then fixes the resulting feature mismatches for winapi. --- src/bootstrap/tool.rs | 1 + src/tools/rustc-workspace-hack/Cargo.toml | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 3b6f02c9368c9..83a897f1ab74f 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -84,6 +84,7 @@ impl Step for ToolBuild { | "cargo" | "clippy-driver" | "miri" + | "rustfmt" => {} _ => return, diff --git a/src/tools/rustc-workspace-hack/Cargo.toml b/src/tools/rustc-workspace-hack/Cargo.toml index 18d682640db01..747200611224e 100644 --- a/src/tools/rustc-workspace-hack/Cargo.toml +++ b/src/tools/rustc-workspace-hack/Cargo.toml @@ -26,6 +26,7 @@ features = [ "basetsd", "consoleapi", "errhandlingapi", + "ioapiset", "jobapi", "jobapi2", "knownfolders", @@ -33,12 +34,14 @@ features = [ "memoryapi", "minschannel", "minwinbase", + "namedpipeapi", + "ntdef", "ntsecapi", "ntstatus", "objbase", - "profileapi", "processenv", "processthreadsapi", + "profileapi", "psapi", "schannel", "securitybaseapi", @@ -53,6 +56,10 @@ features = [ "winbase", "wincon", "wincrypt", + "winsock2", + "ws2def", + "ws2ipdef", + "ws2tcpip", ] [dependencies] From df076b2d5e21bd62263efbb1a6345492a7e302ca Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Wed, 5 Jun 2019 21:13:56 +0200 Subject: [PATCH 2/5] librustc_errors: Rename AnnotateRs -> AnnotateSnippet The proper name of the library is `annotate-snippet`, not `annotate-rs`, this commit should get rid of any confusing `AnnotateRs` names. 1. Renames `annotate_rs_emitter.rs` to `annotate_snippet_emitter_writer.rs` so that the difference between the `Emitter` trait and the implementers is more clear. 2. Renames `AnnotateRsEmitterWriter` to `AnnotateSnippetEmitterWriter` 3. Renames `HumanReadableErrorType::AnnotateRs` to `HumanReadableErrorType::AnnotateSnippet` --- src/librustc/session/config.rs | 4 ++-- src/librustc/session/mod.rs | 6 +++--- ....rs => annotate_snippet_emitter_writer.rs} | 20 +++++++++---------- src/librustc_errors/emitter.rs | 4 ++-- src/librustc_errors/lib.rs | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) rename src/librustc_errors/{annotate_rs_emitter.rs => annotate_snippet_emitter_writer.rs} (94%) diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 6a35906d20c2f..003fdd501a35a 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -2003,7 +2003,7 @@ pub fn build_session_options_and_crate_config( None | Some("human") => ErrorOutputType::HumanReadable(HumanReadableErrorType::Default(color)), Some("human-annotate-rs") => { - ErrorOutputType::HumanReadable(HumanReadableErrorType::AnnotateRs(color)) + ErrorOutputType::HumanReadable(HumanReadableErrorType::AnnotateSnippet(color)) }, Some("json") => ErrorOutputType::Json { pretty: false, json_rendered }, Some("pretty-json") => ErrorOutputType::Json { pretty: true, json_rendered }, @@ -2041,7 +2041,7 @@ pub fn build_session_options_and_crate_config( "--error-format=pretty-json is unstable", ); } - if let ErrorOutputType::HumanReadable(HumanReadableErrorType::AnnotateRs(_)) = + if let ErrorOutputType::HumanReadable(HumanReadableErrorType::AnnotateSnippet(_)) = error_format { early_error( ErrorOutputType::Json { pretty: false, json_rendered }, diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index b3a9d764b1db0..d04b9ac083ce5 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -24,7 +24,7 @@ use rustc_data_structures::sync::{ use errors::{DiagnosticBuilder, DiagnosticId, Applicability}; use errors::emitter::{Emitter, EmitterWriter}; use errors::emitter::HumanReadableErrorType; -use errors::annotate_rs_emitter::{AnnotateRsEmitterWriter}; +use errors::annotate_snippet_emitter_writer::{AnnotateSnippetEmitterWriter}; use syntax::ast::{self, NodeId}; use syntax::edition::Edition; use syntax::feature_gate::{self, AttributeType}; @@ -1034,8 +1034,8 @@ fn default_emitter( (config::ErrorOutputType::HumanReadable(kind), dst) => { let (short, color_config) = kind.unzip(); - if let HumanReadableErrorType::AnnotateRs(_) = kind { - let emitter = AnnotateRsEmitterWriter::new( + if let HumanReadableErrorType::AnnotateSnippet(_) = kind { + let emitter = AnnotateSnippetEmitterWriter::new( Some(source_map.clone()), short, ); diff --git a/src/librustc_errors/annotate_rs_emitter.rs b/src/librustc_errors/annotate_snippet_emitter_writer.rs similarity index 94% rename from src/librustc_errors/annotate_rs_emitter.rs rename to src/librustc_errors/annotate_snippet_emitter_writer.rs index de42389de74ba..9f9c7588d977b 100644 --- a/src/librustc_errors/annotate_rs_emitter.rs +++ b/src/librustc_errors/annotate_snippet_emitter_writer.rs @@ -1,9 +1,9 @@ -/// Emit diagnostics using the `annotate-snippets` library -/// -/// This is the equivalent of `./emitter.rs` but making use of the -/// [`annotate-snippets`][annotate_snippets] library instead of building the output ourselves. -/// -/// [annotate_snippets]: https://docs.rs/crate/annotate-snippets/ +//! Emit diagnostics using the `annotate-snippets` library +//! +//! This is the equivalent of `./emitter.rs` but making use of the +//! [`annotate-snippets`][annotate_snippets] library instead of building the output ourselves. +//! +//! [annotate_snippets]: https://docs.rs/crate/annotate-snippets/ use syntax_pos::{SourceFile, MultiSpan, Loc}; use crate::{ @@ -18,8 +18,8 @@ use annotate_snippets::display_list::DisplayList; use annotate_snippets::formatter::DisplayListFormatter; -/// Generates diagnostics using annotate-rs -pub struct AnnotateRsEmitterWriter { +/// Generates diagnostics using annotate-snippet +pub struct AnnotateSnippetEmitterWriter { source_map: Option>, /// If true, hides the longer explanation text short_message: bool, @@ -27,7 +27,7 @@ pub struct AnnotateRsEmitterWriter { ui_testing: bool, } -impl Emitter for AnnotateRsEmitterWriter { +impl Emitter for AnnotateSnippetEmitterWriter { /// The entry point for the diagnostics generation fn emit_diagnostic(&mut self, db: &DiagnosticBuilder<'_>) { let primary_span = db.span.clone(); @@ -158,7 +158,7 @@ impl<'a> DiagnosticConverter<'a> { } } -impl AnnotateRsEmitterWriter { +impl AnnotateSnippetEmitterWriter { pub fn new( source_map: Option>, short_message: bool diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index fcc0358ea7c11..3bf477efe35f9 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -24,7 +24,7 @@ use termcolor::{WriteColor, Color, Buffer}; #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum HumanReadableErrorType { Default(ColorConfig), - AnnotateRs(ColorConfig), + AnnotateSnippet(ColorConfig), Short(ColorConfig), } @@ -34,7 +34,7 @@ impl HumanReadableErrorType { match self { HumanReadableErrorType::Default(cc) => (false, cc), HumanReadableErrorType::Short(cc) => (true, cc), - HumanReadableErrorType::AnnotateRs(cc) => (false, cc), + HumanReadableErrorType::AnnotateSnippet(cc) => (false, cc), } } pub fn new_emitter( diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 7bc7d0ddaf243..1831d58e73607 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -33,7 +33,7 @@ use termcolor::{ColorSpec, Color}; mod diagnostic; mod diagnostic_builder; pub mod emitter; -pub mod annotate_rs_emitter; +pub mod annotate_snippet_emitter_writer; mod snippet; pub mod registry; mod styled_buffer; From 94ea5dc5978f85a3ce6c8bf3543df2b35dde7ac1 Mon Sep 17 00:00:00 2001 From: Chris Gregory Date: Wed, 5 Jun 2019 18:21:17 -0700 Subject: [PATCH 3/5] Escape HashMap with backticks in needs_drop docs --- src/libcore/mem/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/mem/mod.rs b/src/libcore/mem/mod.rs index 91449f09936aa..6d578d178dcc6 100644 --- a/src/libcore/mem/mod.rs +++ b/src/libcore/mem/mod.rs @@ -374,7 +374,7 @@ pub fn align_of_val(val: &T) -> usize { /// will do a single needs_drop check for all the values. /// /// Types like Vec therefore just `drop_in_place(&mut self[..])` without using -/// needs_drop explicitly. Types like HashMap, on the other hand, have to drop +/// needs_drop explicitly. Types like `HashMap`, on the other hand, have to drop /// values one at a time and should use this API. /// /// From 408895d5b3ef3e64775646f70d5a76cacc5093b1 Mon Sep 17 00:00:00 2001 From: Chris Gregory Date: Wed, 5 Jun 2019 18:22:31 -0700 Subject: [PATCH 4/5] Escape needs_drop in the needs_drop documentation --- src/libcore/mem/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/mem/mod.rs b/src/libcore/mem/mod.rs index 6d578d178dcc6..b43ba6ac34032 100644 --- a/src/libcore/mem/mod.rs +++ b/src/libcore/mem/mod.rs @@ -380,7 +380,7 @@ pub fn align_of_val(val: &T) -> usize { /// /// # Examples /// -/// Here's an example of how a collection might make use of needs_drop: +/// Here's an example of how a collection might make use of `needs_drop`: /// /// ``` /// use std::{mem, ptr}; From d68f0e1ef61ac86b351df84fd17141bba73eb68d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Thu, 6 Jun 2019 12:56:26 +0200 Subject: [PATCH 5/5] submodules: update clippy from 20da8f45 to 71be6f62 Changes: ```` rustup https://github.com/rust-lang/rust/pull/57428/ Remove `to_string()`s from CompilerLintFunctions Fix comment grammar Fix .map(..).unwrap_or_else(..) bad suggestion add suggestions for print/write with newline lint ```` --- src/tools/clippy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/clippy b/src/tools/clippy index 20da8f45c601d..71be6f62fa920 160000 --- a/src/tools/clippy +++ b/src/tools/clippy @@ -1 +1 @@ -Subproject commit 20da8f45c601d0eec8af8c0897abd536ad57951f +Subproject commit 71be6f62fa920c0bd10cdf3a29aeb8c6719a8075