Reformat use
declarations.
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
This commit is contained in:
parent
118f9350c5
commit
84ac80f192
1865 changed files with 8367 additions and 9199 deletions
|
@ -5,6 +5,12 @@
|
|||
//!
|
||||
//! [annotate_snippets]: https://docs.rs/crate/annotate-snippets/
|
||||
|
||||
use annotate_snippets::{Annotation, AnnotationType, Renderer, Slice, Snippet, SourceAnnotation};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_error_messages::FluentArgs;
|
||||
use rustc_span::source_map::SourceMap;
|
||||
use rustc_span::SourceFile;
|
||||
|
||||
use crate::emitter::FileWithAnnotatedLines;
|
||||
use crate::snippet::Line;
|
||||
use crate::translation::{to_fluent_args, Translate};
|
||||
|
@ -12,11 +18,6 @@ use crate::{
|
|||
CodeSuggestion, DiagInner, DiagMessage, Emitter, ErrCode, FluentBundle, LazyFallbackBundle,
|
||||
Level, MultiSpan, Style, Subdiag,
|
||||
};
|
||||
use annotate_snippets::{Annotation, AnnotationType, Renderer, Slice, Snippet, SourceAnnotation};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_error_messages::FluentArgs;
|
||||
use rustc_span::source_map::SourceMap;
|
||||
use rustc_span::SourceFile;
|
||||
|
||||
/// Generates diagnostics using annotate-snippet
|
||||
pub struct AnnotateSnippetEmitter {
|
||||
|
|
|
@ -1,16 +1,3 @@
|
|||
use crate::snippet::Style;
|
||||
use crate::{
|
||||
CodeSuggestion, DiagCtxtHandle, DiagMessage, ErrCode, ErrorGuaranteed, ExplicitBug, Level,
|
||||
MultiSpan, StashKey, SubdiagMessage, Substitution, SubstitutionPart, SuggestionStyle,
|
||||
};
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_error_messages::fluent_value_from_str_list_sep_by_and;
|
||||
use rustc_error_messages::FluentValue;
|
||||
use rustc_lint_defs::{Applicability, LintExpectationId};
|
||||
use rustc_macros::{Decodable, Encodable};
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use std::borrow::Cow;
|
||||
use std::fmt::{self, Debug};
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
@ -18,8 +5,22 @@ use std::marker::PhantomData;
|
|||
use std::ops::{Deref, DerefMut};
|
||||
use std::panic;
|
||||
use std::thread::panicking;
|
||||
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_error_messages::{fluent_value_from_str_list_sep_by_and, FluentValue};
|
||||
use rustc_lint_defs::{Applicability, LintExpectationId};
|
||||
use rustc_macros::{Decodable, Encodable};
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use tracing::debug;
|
||||
|
||||
use crate::snippet::Style;
|
||||
use crate::{
|
||||
CodeSuggestion, DiagCtxtHandle, DiagMessage, ErrCode, ErrorGuaranteed, ExplicitBug, Level,
|
||||
MultiSpan, StashKey, SubdiagMessage, Substitution, SubstitutionPart, SuggestionStyle,
|
||||
};
|
||||
|
||||
/// Error type for `DiagInner`'s `suggestions` field, indicating that
|
||||
/// `.disable_suggestions()` was called on the `DiagInner`.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable)]
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
use crate::diagnostic::DiagLocation;
|
||||
use crate::{fluent_generated as fluent, DiagCtxtHandle, Subdiagnostic};
|
||||
use crate::{
|
||||
Diag, DiagArgValue, Diagnostic, EmissionGuarantee, ErrCode, IntoDiagArg, Level,
|
||||
SubdiagMessageOp,
|
||||
};
|
||||
use rustc_ast as ast;
|
||||
use std::backtrace::Backtrace;
|
||||
use std::borrow::Cow;
|
||||
use std::fmt;
|
||||
use std::num::ParseIntError;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::ExitStatus;
|
||||
|
||||
use rustc_ast_pretty::pprust;
|
||||
use rustc_hir as hir;
|
||||
use rustc_macros::Subdiagnostic;
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent, Symbol};
|
||||
|
@ -14,12 +13,13 @@ use rustc_span::Span;
|
|||
use rustc_target::abi::TargetDataLayoutErrors;
|
||||
use rustc_target::spec::{PanicStrategy, SplitDebuginfo, StackProtector, TargetTriple};
|
||||
use rustc_type_ir::{ClosureKind, FloatTy};
|
||||
use std::backtrace::Backtrace;
|
||||
use std::borrow::Cow;
|
||||
use std::fmt;
|
||||
use std::num::ParseIntError;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::ExitStatus;
|
||||
use {rustc_ast as ast, rustc_hir as hir};
|
||||
|
||||
use crate::diagnostic::DiagLocation;
|
||||
use crate::{
|
||||
fluent_generated as fluent, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee,
|
||||
ErrCode, IntoDiagArg, Level, SubdiagMessageOp, Subdiagnostic,
|
||||
};
|
||||
|
||||
pub struct DiagArgFromDisplay<'a>(pub &'a dyn fmt::Display);
|
||||
|
||||
|
|
|
@ -7,25 +7,6 @@
|
|||
//!
|
||||
//! The output types are defined in `rustc_session::config::ErrorOutputType`.
|
||||
|
||||
use rustc_span::source_map::SourceMap;
|
||||
use rustc_span::{char_width, FileLines, FileName, SourceFile, Span};
|
||||
|
||||
use crate::snippet::{
|
||||
Annotation, AnnotationColumn, AnnotationType, Line, MultilineAnnotation, Style, StyledString,
|
||||
};
|
||||
use crate::styled_buffer::StyledBuffer;
|
||||
use crate::translation::{to_fluent_args, Translate};
|
||||
use crate::{
|
||||
diagnostic::DiagLocation, CodeSuggestion, DiagCtxt, DiagInner, DiagMessage, ErrCode,
|
||||
FluentBundle, LazyFallbackBundle, Level, MultiSpan, Subdiag, SubstitutionHighlight,
|
||||
SuggestionStyle, TerminalUrl,
|
||||
};
|
||||
use derive_setters::Setters;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet};
|
||||
use rustc_data_structures::sync::{DynSend, IntoDynSyncSend, Lrc};
|
||||
use rustc_error_messages::{FluentArgs, SpanLabel};
|
||||
use rustc_lint_defs::pluralize;
|
||||
use rustc_span::hygiene::{ExpnKind, MacroKind};
|
||||
use std::borrow::Cow;
|
||||
use std::cmp::{max, min, Reverse};
|
||||
use std::error::Report;
|
||||
|
@ -33,10 +14,29 @@ use std::io::prelude::*;
|
|||
use std::io::{self, IsTerminal};
|
||||
use std::iter;
|
||||
use std::path::Path;
|
||||
use termcolor::{Buffer, BufferWriter, ColorChoice, ColorSpec, StandardStream};
|
||||
use termcolor::{Color, WriteColor};
|
||||
|
||||
use derive_setters::Setters;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet};
|
||||
use rustc_data_structures::sync::{DynSend, IntoDynSyncSend, Lrc};
|
||||
use rustc_error_messages::{FluentArgs, SpanLabel};
|
||||
use rustc_lint_defs::pluralize;
|
||||
use rustc_span::hygiene::{ExpnKind, MacroKind};
|
||||
use rustc_span::source_map::SourceMap;
|
||||
use rustc_span::{char_width, FileLines, FileName, SourceFile, Span};
|
||||
use termcolor::{Buffer, BufferWriter, Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
|
||||
use tracing::{debug, instrument, trace, warn};
|
||||
|
||||
use crate::diagnostic::DiagLocation;
|
||||
use crate::snippet::{
|
||||
Annotation, AnnotationColumn, AnnotationType, Line, MultilineAnnotation, Style, StyledString,
|
||||
};
|
||||
use crate::styled_buffer::StyledBuffer;
|
||||
use crate::translation::{to_fluent_args, Translate};
|
||||
use crate::{
|
||||
CodeSuggestion, DiagCtxt, DiagInner, DiagMessage, ErrCode, FluentBundle, LazyFallbackBundle,
|
||||
Level, MultiSpan, Subdiag, SubstitutionHighlight, SuggestionStyle, TerminalUrl,
|
||||
};
|
||||
|
||||
/// Default column width, used in tests and when terminal dimensions cannot be determined.
|
||||
const DEFAULT_COLUMN_WIDTH: usize = 140;
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
use rustc_error_messages::{
|
||||
fluent_bundle::resolver::errors::{ReferenceKind, ResolverError},
|
||||
FluentArgs, FluentError,
|
||||
};
|
||||
use std::borrow::Cow;
|
||||
use std::error::Error;
|
||||
use std::fmt;
|
||||
|
||||
use rustc_error_messages::fluent_bundle::resolver::errors::{ReferenceKind, ResolverError};
|
||||
use rustc_error_messages::{FluentArgs, FluentError};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum TranslateError<'args> {
|
||||
One {
|
||||
|
|
|
@ -9,16 +9,12 @@
|
|||
|
||||
// FIXME: spec the JSON output properly.
|
||||
|
||||
use crate::emitter::{
|
||||
should_show_source_code, ColorConfig, Destination, Emitter, HumanEmitter,
|
||||
HumanReadableErrorType,
|
||||
};
|
||||
use crate::registry::Registry;
|
||||
use crate::translation::{to_fluent_args, Translate};
|
||||
use crate::{
|
||||
diagnostic::IsLint, CodeSuggestion, FluentBundle, LazyFallbackBundle, MultiSpan, SpanLabel,
|
||||
Subdiag, TerminalUrl,
|
||||
};
|
||||
use std::error::Report;
|
||||
use std::io::{self, Write};
|
||||
use std::path::Path;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::vec;
|
||||
|
||||
use derive_setters::Setters;
|
||||
use rustc_data_structures::sync::{IntoDynSyncSend, Lrc};
|
||||
use rustc_error_messages::FluentArgs;
|
||||
|
@ -27,13 +23,19 @@ use rustc_span::hygiene::ExpnData;
|
|||
use rustc_span::source_map::SourceMap;
|
||||
use rustc_span::Span;
|
||||
use serde::Serialize;
|
||||
use std::error::Report;
|
||||
use std::io::{self, Write};
|
||||
use std::path::Path;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::vec;
|
||||
use termcolor::{ColorSpec, WriteColor};
|
||||
|
||||
use crate::diagnostic::IsLint;
|
||||
use crate::emitter::{
|
||||
should_show_source_code, ColorConfig, Destination, Emitter, HumanEmitter,
|
||||
HumanReadableErrorType,
|
||||
};
|
||||
use crate::registry::Registry;
|
||||
use crate::translation::{to_fluent_args, Translate};
|
||||
use crate::{
|
||||
CodeSuggestion, FluentBundle, LazyFallbackBundle, MultiSpan, SpanLabel, Subdiag, TerminalUrl,
|
||||
};
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
use super::*;
|
||||
|
||||
use crate::DiagCtxt;
|
||||
use rustc_span::source_map::FilePathMapping;
|
||||
use rustc_span::BytePos;
|
||||
|
||||
use std::str;
|
||||
|
||||
use rustc_span::source_map::FilePathMapping;
|
||||
use rustc_span::BytePos;
|
||||
use serde::Deserialize;
|
||||
|
||||
use super::*;
|
||||
use crate::DiagCtxt;
|
||||
|
||||
#[derive(Deserialize, Debug, PartialEq, Eq)]
|
||||
struct TestData {
|
||||
spans: Vec<SpanTestData>,
|
||||
|
|
|
@ -28,6 +28,17 @@
|
|||
|
||||
extern crate self as rustc_errors;
|
||||
|
||||
use std::backtrace::{Backtrace, BacktraceStatus};
|
||||
use std::borrow::Cow;
|
||||
use std::cell::Cell;
|
||||
use std::error::Report;
|
||||
use std::hash::Hash;
|
||||
use std::io::Write;
|
||||
use std::num::NonZero;
|
||||
use std::ops::DerefMut;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::{fmt, panic};
|
||||
|
||||
pub use codes::*;
|
||||
pub use diagnostic::{
|
||||
BugAbort, Diag, DiagArg, DiagArgMap, DiagArgName, DiagArgValue, DiagInner, DiagStyledString,
|
||||
|
@ -39,42 +50,28 @@ pub use diagnostic_impls::{
|
|||
IndicateAnonymousLifetime, SingleLabelManySpans,
|
||||
};
|
||||
pub use emitter::ColorConfig;
|
||||
pub use rustc_error_messages::{
|
||||
fallback_fluent_bundle, fluent_bundle, DiagMessage, FluentBundle, LanguageIdentifier,
|
||||
LazyFallbackBundle, MultiSpan, SpanLabel, SubdiagMessage,
|
||||
};
|
||||
pub use rustc_lint_defs::{pluralize, Applicability};
|
||||
pub use rustc_span::fatal_error::{FatalError, FatalErrorMarker};
|
||||
pub use rustc_span::ErrorGuaranteed;
|
||||
pub use snippet::Style;
|
||||
|
||||
// Used by external projects such as `rust-gpu`.
|
||||
// See https://github.com/rust-lang/rust/pull/115393.
|
||||
pub use termcolor::{Color, ColorSpec, WriteColor};
|
||||
|
||||
use emitter::{is_case_difference, DynEmitter, Emitter};
|
||||
use registry::Registry;
|
||||
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
|
||||
use rustc_data_structures::stable_hasher::{Hash128, StableHasher};
|
||||
use rustc_data_structures::sync::{Lock, Lrc};
|
||||
use rustc_data_structures::AtomicRef;
|
||||
pub use rustc_error_messages::{
|
||||
fallback_fluent_bundle, fluent_bundle, DiagMessage, FluentBundle, LanguageIdentifier,
|
||||
LazyFallbackBundle, MultiSpan, SpanLabel, SubdiagMessage,
|
||||
};
|
||||
use rustc_lint_defs::LintExpectationId;
|
||||
pub use rustc_lint_defs::{pluralize, Applicability};
|
||||
use rustc_macros::{Decodable, Encodable};
|
||||
pub use rustc_span::fatal_error::{FatalError, FatalErrorMarker};
|
||||
use rustc_span::source_map::SourceMap;
|
||||
pub use rustc_span::ErrorGuaranteed;
|
||||
use rustc_span::{Loc, Span, DUMMY_SP};
|
||||
use std::backtrace::{Backtrace, BacktraceStatus};
|
||||
use std::borrow::Cow;
|
||||
use std::cell::Cell;
|
||||
use std::error::Report;
|
||||
use std::fmt;
|
||||
use std::hash::Hash;
|
||||
use std::io::Write;
|
||||
use std::num::NonZero;
|
||||
use std::ops::DerefMut;
|
||||
use std::panic;
|
||||
use std::path::{Path, PathBuf};
|
||||
pub use snippet::Style;
|
||||
// Used by external projects such as `rust-gpu`.
|
||||
// See https://github.com/rust-lang/rust/pull/115393.
|
||||
pub use termcolor::{Color, ColorSpec, WriteColor};
|
||||
use tracing::debug;
|
||||
|
||||
use Level::*;
|
||||
|
||||
pub mod annotate_snippet_emitter_writer;
|
||||
|
|
|
@ -16,10 +16,10 @@ pub fn acquire_global_lock(name: &str) -> Box<dyn Any> {
|
|||
use std::ffi::CString;
|
||||
use std::io;
|
||||
|
||||
use windows::{
|
||||
core::PCSTR,
|
||||
Win32::Foundation::{CloseHandle, HANDLE, WAIT_ABANDONED, WAIT_OBJECT_0},
|
||||
Win32::System::Threading::{CreateMutexA, ReleaseMutex, WaitForSingleObject, INFINITE},
|
||||
use windows::core::PCSTR;
|
||||
use windows::Win32::Foundation::{CloseHandle, HANDLE, WAIT_ABANDONED, WAIT_OBJECT_0};
|
||||
use windows::Win32::System::Threading::{
|
||||
CreateMutexA, ReleaseMutex, WaitForSingleObject, INFINITE,
|
||||
};
|
||||
|
||||
struct Handle(HANDLE);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use crate::markdown::{MdStream, MdTree};
|
||||
use std::{iter, mem, str};
|
||||
|
||||
use crate::markdown::{MdStream, MdTree};
|
||||
|
||||
/// Short aliases that we can use in match patterns. If an end pattern is not
|
||||
/// included, this type may be variable
|
||||
const ANC_E: &[u8] = b">";
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use super::*;
|
||||
use ParseOpt as PO;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_parse_simple() {
|
||||
let buf = "**abcd** rest";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use std::io::BufWriter;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use termcolor::{BufferWriter, ColorChoice};
|
||||
|
||||
use super::*;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use crate::ErrCode;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
|
||||
use crate::ErrCode;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct InvalidErrorCode;
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
// Code for annotating snippets.
|
||||
|
||||
use crate::{Level, Loc};
|
||||
use rustc_macros::{Decodable, Encodable};
|
||||
|
||||
use crate::{Level, Loc};
|
||||
|
||||
#[derive(Clone, Debug, PartialOrd, Ord, PartialEq, Eq)]
|
||||
pub struct Line {
|
||||
pub line_index: usize,
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use rustc_data_structures::sync::{IntoDynSyncSend, Lrc};
|
||||
use rustc_error_messages::fluent_bundle::resolver::errors::{ReferenceKind, ResolverError};
|
||||
use rustc_error_messages::{langid, DiagMessage};
|
||||
|
||||
use crate::error::{TranslateError, TranslateErrorKind};
|
||||
use crate::fluent_bundle::*;
|
||||
use crate::translation::Translate;
|
||||
use crate::FluentBundle;
|
||||
use rustc_data_structures::sync::{IntoDynSyncSend, Lrc};
|
||||
use rustc_error_messages::fluent_bundle::resolver::errors::{ReferenceKind, ResolverError};
|
||||
use rustc_error_messages::langid;
|
||||
use rustc_error_messages::DiagMessage;
|
||||
|
||||
struct Dummy {
|
||||
bundle: FluentBundle,
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
use crate::error::{TranslateError, TranslateErrorKind};
|
||||
use crate::snippet::Style;
|
||||
use crate::{DiagArg, DiagMessage, FluentBundle};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
pub use rustc_error_messages::FluentArgs;
|
||||
use std::borrow::Cow;
|
||||
use std::env;
|
||||
use std::error::Report;
|
||||
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
pub use rustc_error_messages::FluentArgs;
|
||||
use tracing::{debug, trace};
|
||||
|
||||
use crate::error::{TranslateError, TranslateErrorKind};
|
||||
use crate::snippet::Style;
|
||||
use crate::{DiagArg, DiagMessage, FluentBundle};
|
||||
|
||||
/// Convert diagnostic arguments (a rustc internal type that exists to implement
|
||||
/// `Encodable`/`Decodable`) into `FluentArgs` which is necessary to perform translation.
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue