Reformat using the new identifier sorting from rustfmt
This commit is contained in:
parent
1173204b36
commit
c682aa162b
1455 changed files with 7152 additions and 8384 deletions
|
@ -8,12 +8,12 @@
|
|||
use annotate_snippets::{Renderer, Snippet};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_error_messages::FluentArgs;
|
||||
use rustc_span::source_map::SourceMap;
|
||||
use rustc_span::SourceFile;
|
||||
use rustc_span::source_map::SourceMap;
|
||||
|
||||
use crate::emitter::FileWithAnnotatedLines;
|
||||
use crate::snippet::Line;
|
||||
use crate::translation::{to_fluent_args, Translate};
|
||||
use crate::translation::{Translate, to_fluent_args};
|
||||
use crate::{
|
||||
CodeSuggestion, DiagInner, DiagMessage, Emitter, ErrCode, FluentBundle, LazyFallbackBundle,
|
||||
Level, MultiSpan, Style, Subdiag,
|
||||
|
|
|
@ -7,12 +7,12 @@ 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_error_messages::{FluentValue, fluent_value_from_str_list_sep_by_and};
|
||||
use rustc_lint_defs::Applicability;
|
||||
use rustc_macros::{Decodable, Encodable};
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use rustc_span::{DUMMY_SP, Span};
|
||||
use tracing::debug;
|
||||
|
||||
use crate::snippet::Style;
|
||||
|
|
|
@ -7,9 +7,9 @@ use std::process::ExitStatus;
|
|||
|
||||
use rustc_ast_pretty::pprust;
|
||||
use rustc_macros::Subdiagnostic;
|
||||
use rustc_span::Span;
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent, Symbol};
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::TargetDataLayoutErrors;
|
||||
use rustc_target::spec::{PanicStrategy, SplitDebuginfo, StackProtector, TargetTriple};
|
||||
use rustc_type_ir::{ClosureKind, FloatTy};
|
||||
|
@ -17,8 +17,8 @@ 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,
|
||||
Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, ErrCode, IntoDiagArg, Level,
|
||||
SubdiagMessageOp, Subdiagnostic, fluent_generated as fluent,
|
||||
};
|
||||
|
||||
pub struct DiagArgFromDisplay<'a>(pub &'a dyn fmt::Display);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
//! The output types are defined in `rustc_session::config::ErrorOutputType`.
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::cmp::{max, min, Reverse};
|
||||
use std::cmp::{Reverse, max, min};
|
||||
use std::error::Report;
|
||||
use std::io::prelude::*;
|
||||
use std::io::{self, IsTerminal};
|
||||
|
@ -22,7 +22,7 @@ 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 rustc_span::{FileLines, FileName, SourceFile, Span, char_width};
|
||||
use termcolor::{Buffer, BufferWriter, Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
|
||||
use tracing::{debug, instrument, trace, warn};
|
||||
|
||||
|
@ -31,7 +31,7 @@ use crate::snippet::{
|
|||
Annotation, AnnotationColumn, AnnotationType, Line, MultilineAnnotation, Style, StyledString,
|
||||
};
|
||||
use crate::styled_buffer::StyledBuffer;
|
||||
use crate::translation::{to_fluent_args, Translate};
|
||||
use crate::translation::{Translate, to_fluent_args};
|
||||
use crate::{
|
||||
CodeSuggestion, DiagCtxt, DiagInner, DiagMessage, ErrCode, FluentBundle, LazyFallbackBundle,
|
||||
Level, MultiSpan, Subdiag, SubstitutionHighlight, SuggestionStyle, TerminalUrl,
|
||||
|
|
|
@ -19,19 +19,19 @@ use derive_setters::Setters;
|
|||
use rustc_data_structures::sync::{IntoDynSyncSend, Lrc};
|
||||
use rustc_error_messages::FluentArgs;
|
||||
use rustc_lint_defs::Applicability;
|
||||
use rustc_span::Span;
|
||||
use rustc_span::hygiene::ExpnData;
|
||||
use rustc_span::source_map::SourceMap;
|
||||
use rustc_span::Span;
|
||||
use serde::Serialize;
|
||||
use termcolor::{ColorSpec, WriteColor};
|
||||
|
||||
use crate::diagnostic::IsLint;
|
||||
use crate::emitter::{
|
||||
should_show_source_code, ColorConfig, Destination, Emitter, HumanEmitter,
|
||||
HumanReadableErrorType,
|
||||
ColorConfig, Destination, Emitter, HumanEmitter, HumanReadableErrorType,
|
||||
should_show_source_code,
|
||||
};
|
||||
use crate::registry::Registry;
|
||||
use crate::translation::{to_fluent_args, Translate};
|
||||
use crate::translation::{Translate, to_fluent_args};
|
||||
use crate::{
|
||||
CodeSuggestion, FluentBundle, LazyFallbackBundle, MultiSpan, SpanLabel, Subdiag, Suggestions,
|
||||
TerminalUrl,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::str;
|
||||
|
||||
use rustc_span::source_map::FilePathMapping;
|
||||
use rustc_span::BytePos;
|
||||
use rustc_span::source_map::FilePathMapping;
|
||||
use serde::Deserialize;
|
||||
|
||||
use super::*;
|
||||
|
@ -69,128 +69,96 @@ fn test_positions(code: &str, span: (u32, u32), expected_output: SpanTestData) {
|
|||
|
||||
#[test]
|
||||
fn empty() {
|
||||
test_positions(
|
||||
" ",
|
||||
(0, 1),
|
||||
SpanTestData {
|
||||
byte_start: 0,
|
||||
byte_end: 1,
|
||||
line_start: 1,
|
||||
column_start: 1,
|
||||
line_end: 1,
|
||||
column_end: 2,
|
||||
},
|
||||
)
|
||||
test_positions(" ", (0, 1), SpanTestData {
|
||||
byte_start: 0,
|
||||
byte_end: 1,
|
||||
line_start: 1,
|
||||
column_start: 1,
|
||||
line_end: 1,
|
||||
column_end: 2,
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bom() {
|
||||
test_positions(
|
||||
"\u{feff} ",
|
||||
(0, 1),
|
||||
SpanTestData {
|
||||
byte_start: 3,
|
||||
byte_end: 4,
|
||||
line_start: 1,
|
||||
column_start: 1,
|
||||
line_end: 1,
|
||||
column_end: 2,
|
||||
},
|
||||
)
|
||||
test_positions("\u{feff} ", (0, 1), SpanTestData {
|
||||
byte_start: 3,
|
||||
byte_end: 4,
|
||||
line_start: 1,
|
||||
column_start: 1,
|
||||
line_end: 1,
|
||||
column_end: 2,
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lf_newlines() {
|
||||
test_positions(
|
||||
"\nmod foo;\nmod bar;\n",
|
||||
(5, 12),
|
||||
SpanTestData {
|
||||
byte_start: 5,
|
||||
byte_end: 12,
|
||||
line_start: 2,
|
||||
column_start: 5,
|
||||
line_end: 3,
|
||||
column_end: 3,
|
||||
},
|
||||
)
|
||||
test_positions("\nmod foo;\nmod bar;\n", (5, 12), SpanTestData {
|
||||
byte_start: 5,
|
||||
byte_end: 12,
|
||||
line_start: 2,
|
||||
column_start: 5,
|
||||
line_end: 3,
|
||||
column_end: 3,
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn crlf_newlines() {
|
||||
test_positions(
|
||||
"\r\nmod foo;\r\nmod bar;\r\n",
|
||||
(5, 12),
|
||||
SpanTestData {
|
||||
byte_start: 6,
|
||||
byte_end: 14,
|
||||
line_start: 2,
|
||||
column_start: 5,
|
||||
line_end: 3,
|
||||
column_end: 3,
|
||||
},
|
||||
)
|
||||
test_positions("\r\nmod foo;\r\nmod bar;\r\n", (5, 12), SpanTestData {
|
||||
byte_start: 6,
|
||||
byte_end: 14,
|
||||
line_start: 2,
|
||||
column_start: 5,
|
||||
line_end: 3,
|
||||
column_end: 3,
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn crlf_newlines_with_bom() {
|
||||
test_positions(
|
||||
"\u{feff}\r\nmod foo;\r\nmod bar;\r\n",
|
||||
(5, 12),
|
||||
SpanTestData {
|
||||
byte_start: 9,
|
||||
byte_end: 17,
|
||||
line_start: 2,
|
||||
column_start: 5,
|
||||
line_end: 3,
|
||||
column_end: 3,
|
||||
},
|
||||
)
|
||||
test_positions("\u{feff}\r\nmod foo;\r\nmod bar;\r\n", (5, 12), SpanTestData {
|
||||
byte_start: 9,
|
||||
byte_end: 17,
|
||||
line_start: 2,
|
||||
column_start: 5,
|
||||
line_end: 3,
|
||||
column_end: 3,
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn span_before_crlf() {
|
||||
test_positions(
|
||||
"foo\r\nbar",
|
||||
(2, 3),
|
||||
SpanTestData {
|
||||
byte_start: 2,
|
||||
byte_end: 3,
|
||||
line_start: 1,
|
||||
column_start: 3,
|
||||
line_end: 1,
|
||||
column_end: 4,
|
||||
},
|
||||
)
|
||||
test_positions("foo\r\nbar", (2, 3), SpanTestData {
|
||||
byte_start: 2,
|
||||
byte_end: 3,
|
||||
line_start: 1,
|
||||
column_start: 3,
|
||||
line_end: 1,
|
||||
column_end: 4,
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn span_on_crlf() {
|
||||
test_positions(
|
||||
"foo\r\nbar",
|
||||
(3, 4),
|
||||
SpanTestData {
|
||||
byte_start: 3,
|
||||
byte_end: 5,
|
||||
line_start: 1,
|
||||
column_start: 4,
|
||||
line_end: 2,
|
||||
column_end: 1,
|
||||
},
|
||||
)
|
||||
test_positions("foo\r\nbar", (3, 4), SpanTestData {
|
||||
byte_start: 3,
|
||||
byte_end: 5,
|
||||
line_start: 1,
|
||||
column_start: 4,
|
||||
line_end: 2,
|
||||
column_end: 1,
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn span_after_crlf() {
|
||||
test_positions(
|
||||
"foo\r\nbar",
|
||||
(4, 5),
|
||||
SpanTestData {
|
||||
byte_start: 5,
|
||||
byte_end: 6,
|
||||
line_start: 2,
|
||||
column_start: 1,
|
||||
line_end: 2,
|
||||
column_end: 2,
|
||||
},
|
||||
)
|
||||
test_positions("foo\r\nbar", (4, 5), SpanTestData {
|
||||
byte_start: 5,
|
||||
byte_end: 6,
|
||||
line_start: 2,
|
||||
column_start: 1,
|
||||
line_end: 2,
|
||||
column_end: 2,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ use std::ops::DerefMut;
|
|||
use std::path::{Path, PathBuf};
|
||||
use std::{fmt, panic};
|
||||
|
||||
use Level::*;
|
||||
pub use codes::*;
|
||||
pub use diagnostic::{
|
||||
BugAbort, Diag, DiagArg, DiagArgMap, DiagArgName, DiagArgValue, DiagInner, DiagStyledString,
|
||||
|
@ -53,29 +54,28 @@ pub use diagnostic_impls::{
|
|||
IndicateAnonymousLifetime, SingleLabelManySpans,
|
||||
};
|
||||
pub use emitter::ColorConfig;
|
||||
use emitter::{is_case_difference, is_different, DynEmitter, Emitter};
|
||||
use emitter::{DynEmitter, Emitter, is_case_difference, is_different};
|
||||
use registry::Registry;
|
||||
use rustc_data_structures::AtomicRef;
|
||||
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,
|
||||
DiagMessage, FluentBundle, LanguageIdentifier, LazyFallbackBundle, MultiSpan, SpanLabel,
|
||||
SubdiagMessage, fallback_fluent_bundle, fluent_bundle,
|
||||
};
|
||||
use rustc_lint_defs::LintExpectationId;
|
||||
pub use rustc_lint_defs::{pluralize, Applicability};
|
||||
pub use rustc_lint_defs::{Applicability, pluralize};
|
||||
use rustc_macros::{Decodable, Encodable};
|
||||
pub use rustc_span::ErrorGuaranteed;
|
||||
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 rustc_span::{DUMMY_SP, Loc, Span};
|
||||
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;
|
||||
pub mod codes;
|
||||
|
|
|
@ -16,11 +16,11 @@ pub(crate) fn acquire_global_lock(name: &str) -> Box<dyn Any> {
|
|||
use std::ffi::CString;
|
||||
use std::io;
|
||||
|
||||
use windows::core::PCSTR;
|
||||
use windows::Win32::Foundation::{CloseHandle, HANDLE, WAIT_ABANDONED, WAIT_OBJECT_0};
|
||||
use windows::Win32::System::Threading::{
|
||||
CreateMutexA, ReleaseMutex, WaitForSingleObject, INFINITE,
|
||||
CreateMutexA, INFINITE, ReleaseMutex, WaitForSingleObject,
|
||||
};
|
||||
use windows::core::PCSTR;
|
||||
|
||||
struct Handle(HANDLE);
|
||||
|
||||
|
|
|
@ -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 rustc_error_messages::{DiagMessage, langid};
|
||||
|
||||
use crate::FluentBundle;
|
||||
use crate::error::{TranslateError, TranslateErrorKind};
|
||||
use crate::fluent_bundle::*;
|
||||
use crate::translation::Translate;
|
||||
use crate::FluentBundle;
|
||||
|
||||
struct Dummy {
|
||||
bundle: FluentBundle,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue