Skip to content

Commit 0188626

Browse files
committed
Improve use items in compiler/rustc_errors/src/lib.rs.
There are a bunch of them about 400 lines down, which is weird and annoying. This commit moves them up and puts them in a more sensible order.
1 parent 6555715 commit 0188626

File tree

1 file changed

+27
-30
lines changed
  • compiler/rustc_errors/src

1 file changed

+27
-30
lines changed

compiler/rustc_errors/src/lib.rs

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,43 @@ extern crate tracing;
2727

2828
extern crate self as rustc_errors;
2929

30+
pub use diagnostic::{
31+
AddToDiagnostic, DecorateLint, Diagnostic, DiagnosticArg, DiagnosticArgValue, DiagnosticId,
32+
DiagnosticStyledString, IntoDiagnosticArg, SubDiagnostic,
33+
};
34+
pub use diagnostic_builder::{
35+
BugAbort, DiagnosticBuilder, EmissionGuarantee, FatalAbort, IntoDiagnostic,
36+
};
37+
pub use diagnostic_impls::{
38+
DiagnosticArgFromDisplay, DiagnosticSymbolList, ExpectedLifetimeParameter,
39+
IndicateAnonymousLifetime, InvalidFlushedDelayedDiagnosticLevel, LabelKind,
40+
SingleLabelManySpans,
41+
};
3042
pub use emitter::ColorConfig;
43+
pub use rustc_error_messages::{
44+
fallback_fluent_bundle, fluent_bundle, DelayDm, DiagnosticMessage, FluentBundle,
45+
LanguageIdentifier, LazyFallbackBundle, MultiSpan, SpanLabel, SubdiagnosticMessage,
46+
};
47+
pub use rustc_lint_defs::{pluralize, Applicability};
48+
pub use rustc_span::fatal_error::{FatalError, FatalErrorMarker};
49+
pub use rustc_span::ErrorGuaranteed;
50+
pub use snippet::Style;
3151

32-
use rustc_lint_defs::LintExpectationId;
33-
use Level::*;
52+
// Used by external projects such as `rust-gpu`.
53+
// See https://github.com/rust-lang/rust/pull/115393.
54+
pub use termcolor::{Color, ColorSpec, WriteColor};
3455

56+
use crate::diagnostic_impls::{DelayedAtWithNewline, DelayedAtWithoutNewline};
3557
use emitter::{is_case_difference, DynEmitter, Emitter, EmitterWriter};
3658
use registry::Registry;
3759
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet};
3860
use rustc_data_structures::stable_hasher::{Hash128, StableHasher};
3961
use rustc_data_structures::sync::{Lock, Lrc};
4062
use rustc_data_structures::AtomicRef;
41-
pub use rustc_error_messages::{
42-
fallback_fluent_bundle, fluent_bundle, DelayDm, DiagnosticMessage, FluentBundle,
43-
LanguageIdentifier, LazyFallbackBundle, MultiSpan, SpanLabel, SubdiagnosticMessage,
44-
};
45-
pub use rustc_lint_defs::{pluralize, Applicability};
63+
use rustc_lint_defs::LintExpectationId;
4664
use rustc_span::source_map::SourceMap;
47-
pub use rustc_span::ErrorGuaranteed;
4865
use rustc_span::{Loc, Span, DUMMY_SP};
49-
66+
use std::backtrace::{Backtrace, BacktraceStatus};
5067
use std::borrow::Cow;
5168
use std::error::Report;
5269
use std::fmt;
@@ -56,9 +73,7 @@ use std::num::NonZeroUsize;
5673
use std::panic;
5774
use std::path::{Path, PathBuf};
5875

59-
// Used by external projects such as `rust-gpu`.
60-
// See https://github.com/rust-lang/rust/pull/115393.
61-
pub use termcolor::{Color, ColorSpec, WriteColor};
76+
use Level::*;
6277

6378
pub mod annotate_snippet_emitter_writer;
6479
mod diagnostic;
@@ -76,9 +91,6 @@ mod styled_buffer;
7691
mod tests;
7792
pub mod translation;
7893

79-
pub use diagnostic_builder::IntoDiagnostic;
80-
pub use snippet::Style;
81-
8294
pub type PErr<'a> = DiagnosticBuilder<'a, ErrorGuaranteed>;
8395
pub type PResult<'a, T> = Result<T, PErr<'a>>;
8496

@@ -387,8 +399,6 @@ impl CodeSuggestion {
387399
}
388400
}
389401

390-
pub use rustc_span::fatal_error::{FatalError, FatalErrorMarker};
391-
392402
/// Signifies that the compiler died with an explicit call to `.bug`
393403
/// or `.span_bug` rather than a failed assertion, etc.
394404
pub struct ExplicitBug;
@@ -397,19 +407,6 @@ pub struct ExplicitBug;
397407
/// rather than a failed assertion, etc.
398408
pub struct DelayedBugPanic;
399409

400-
use crate::diagnostic_impls::{DelayedAtWithNewline, DelayedAtWithoutNewline};
401-
pub use diagnostic::{
402-
AddToDiagnostic, DecorateLint, Diagnostic, DiagnosticArg, DiagnosticArgValue, DiagnosticId,
403-
DiagnosticStyledString, IntoDiagnosticArg, SubDiagnostic,
404-
};
405-
pub use diagnostic_builder::{BugAbort, DiagnosticBuilder, EmissionGuarantee, FatalAbort};
406-
pub use diagnostic_impls::{
407-
DiagnosticArgFromDisplay, DiagnosticSymbolList, ExpectedLifetimeParameter,
408-
IndicateAnonymousLifetime, InvalidFlushedDelayedDiagnosticLevel, LabelKind,
409-
SingleLabelManySpans,
410-
};
411-
use std::backtrace::{Backtrace, BacktraceStatus};
412-
413410
/// A handler deals with errors and other compiler output.
414411
/// Certain errors (fatal, bug, unimpl) may cause immediate exit,
415412
/// others log errors for later reporting.

0 commit comments

Comments
 (0)