Skip to content

Rollup of 4 pull requests #61583

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

Merged
merged 9 commits into from
Jun 6, 2019
1 change: 1 addition & 0 deletions src/bootstrap/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ impl Step for ToolBuild {
| "cargo"
| "clippy-driver"
| "miri"
| "rustfmt"
=> {}

_ => return,
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,13 +374,13 @@ pub fn align_of_val<T: ?Sized>(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.
///
///
/// # 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};
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down Expand Up @@ -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 },
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -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::{
Expand All @@ -18,16 +18,16 @@ 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<Lrc<SourceMapperDyn>>,
/// If true, hides the longer explanation text
short_message: bool,
/// If true, will normalize line numbers with LL to prevent noise in UI test diffs.
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();
Expand Down Expand Up @@ -158,7 +158,7 @@ impl<'a> DiagnosticConverter<'a> {
}
}

impl AnnotateRsEmitterWriter {
impl AnnotateSnippetEmitterWriter {
pub fn new(
source_map: Option<Lrc<SourceMapperDyn>>,
short_message: bool
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_errors/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}

Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_errors/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy
9 changes: 8 additions & 1 deletion src/tools/rustc-workspace-hack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,22 @@ features = [
"basetsd",
"consoleapi",
"errhandlingapi",
"ioapiset",
"jobapi",
"jobapi2",
"knownfolders",
"lmcons",
"memoryapi",
"minschannel",
"minwinbase",
"namedpipeapi",
"ntdef",
"ntsecapi",
"ntstatus",
"objbase",
"profileapi",
"processenv",
"processthreadsapi",
"profileapi",
"psapi",
"schannel",
"securitybaseapi",
Expand All @@ -53,6 +56,10 @@ features = [
"winbase",
"wincon",
"wincrypt",
"winsock2",
"ws2def",
"ws2ipdef",
"ws2tcpip",
]

[dependencies]
Expand Down