Skip to content

Commit

Permalink
Rollup merge of rust-lang#58273 - taiki-e:rename-dependency, r=matthe…
Browse files Browse the repository at this point in the history
…wjasper

Rename rustc_errors dependency in rust 2018 crates

I think this is a better solution than `use rustc_errors as errors` in `lib.rs` and `use crate::errors` in modules.

Related: rust-lang/cargo#5653

cc rust-lang#58099

r? @Centril
  • Loading branch information
Centril authored Feb 13, 2019
2 parents ecb6503 + c08b5ca commit 0bc8f6f
Show file tree
Hide file tree
Showing 65 changed files with 114 additions and 121 deletions.
2 changes: 1 addition & 1 deletion src/librustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ rustc-rayon-core = "0.1.1"
rustc_apfloat = { path = "../librustc_apfloat" }
rustc_target = { path = "../librustc_target" }
rustc_data_structures = { path = "../librustc_data_structures" }
rustc_errors = { path = "../librustc_errors" }
errors = { path = "../librustc_errors", package = "rustc_errors" }
serialize = { path = "../libserialize" }
syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" }
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/dep_graph/graph.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::errors::{Diagnostic, DiagnosticBuilder};
use errors::{Diagnostic, DiagnosticBuilder};
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
Expand Down
10 changes: 5 additions & 5 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
//! in the HIR, especially for multiple identifiers.
use crate::dep_graph::DepGraph;
use crate::errors::Applicability;
use crate::hir::{self, ParamName};
use crate::hir::HirVec;
use crate::hir::map::{DefKey, DefPathData, Definitions};
Expand All @@ -41,14 +40,15 @@ use crate::hir::GenericArg;
use crate::lint::builtin::{self, PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES,
ELIDED_LIFETIMES_IN_PATHS};
use crate::middle::cstore::CrateStore;
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::indexed_vec::IndexVec;
use rustc_data_structures::thin_vec::ThinVec;
use rustc_data_structures::sync::Lrc;
use crate::session::Session;
use crate::session::config::nightly_options;
use crate::util::common::FN_OUTPUT_NAME;
use crate::util::nodemap::{DefIdMap, NodeMap};
use errors::Applicability;
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::indexed_vec::IndexVec;
use rustc_data_structures::thin_vec::ThinVec;
use rustc_data_structures::sync::Lrc;

use std::collections::{BTreeSet, BTreeMap};
use std::fmt::Debug;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ pub use self::PrimTy::*;
pub use self::UnOp::*;
pub use self::UnsafeSource::*;

use crate::errors::FatalError;
use crate::hir::def::Def;
use crate::hir::def_id::{DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX};
use crate::util::nodemap::{NodeMap, FxHashSet};
use crate::mir::mono::Linkage;

use errors::FatalError;
use syntax_pos::{Span, DUMMY_SP, symbol::InternedString};
use syntax::source_map::Spanned;
use rustc_target::spec::abi::Abi;
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ use super::region_constraints::GenericKind;
use super::{InferCtxt, RegionVariableOrigin, SubregionOrigin, TypeTrace, ValuePairs};
use crate::infer::{self, SuppressRegionErrors};

use crate::errors::{Applicability, DiagnosticBuilder, DiagnosticStyledString};
use crate::hir;
use crate::hir::def_id::DefId;
use crate::hir::Node;
use crate::middle::region;
use std::{cmp, fmt};
use syntax_pos::{Pos, Span};
use crate::traits::{ObligationCause, ObligationCauseCode};
use crate::ty::error::TypeError;
use crate::ty::{self, subst::Subst, Region, Ty, TyCtxt, TyKind, TypeFoldable};
use errors::{Applicability, DiagnosticBuilder, DiagnosticStyledString};
use std::{cmp, fmt};
use syntax_pos::{Pos, Span};

mod note;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/error_reporting/need_type_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::infer::type_variable::TypeVariableOrigin;
use crate::ty::{self, Ty, Infer, TyVar};
use syntax::source_map::CompilerDesugaringKind;
use syntax_pos::Span;
use crate::errors::DiagnosticBuilder;
use errors::DiagnosticBuilder;

struct FindLocalByTypeVisitor<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::infer::error_reporting::nice_region_error::NiceRegionError;
use crate::ty;
use crate::util::common::ErrorReported;
use crate::errors::Applicability;
use errors::Applicability;

impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
/// When given a `ConcreteFailure` for a function with arguments containing a named region and
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::errors::DiagnosticBuilder;
use errors::DiagnosticBuilder;
use crate::hir::def_id::DefId;
use crate::infer::error_reporting::nice_region_error::NiceRegionError;
use crate::infer::lexical_region_resolve::RegionResolutionError;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::infer::error_reporting::nice_region_error::NiceRegionError;
use crate::infer::lexical_region_resolve::RegionResolutionError;
use crate::ty::{BoundRegion, FreeRegion, RegionKind};
use crate::util::common::ErrorReported;
use crate::errors::Applicability;
use errors::Applicability;

impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
/// Print the error message for lifetime errors when the return type is a static impl Trait.
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/error_reporting/note.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::infer::{self, InferCtxt, SubregionOrigin};
use crate::middle::region;
use crate::ty::{self, Region};
use crate::ty::error::TypeError;
use crate::errors::DiagnosticBuilder;
use errors::DiagnosticBuilder;

impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
pub(super) fn note_region_origin(&self,
Expand Down
19 changes: 10 additions & 9 deletions src/librustc/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,12 @@ pub use self::SubregionOrigin::*;
pub use self::ValuePairs::*;
pub use crate::ty::IntVarValue;

use arena::SyncDroplessArena;
use crate::errors::DiagnosticBuilder;
use crate::hir::def_id::DefId;
use crate::infer::canonical::{Canonical, CanonicalVarValues};
use crate::middle::free_region::RegionRelations;
use crate::middle::lang_items;
use crate::middle::region;
use rustc_data_structures::unify as ut;
use crate::session::config::BorrowckMode;
use std::cell::{Cell, Ref, RefCell, RefMut};
use std::collections::BTreeMap;
use std::fmt;
use syntax::ast;
use syntax_pos::symbol::InternedString;
use syntax_pos::{self, Span};
use crate::traits::{self, ObligationCause, PredicateObligations, TraitEngine};
use crate::ty::error::{ExpectedFound, TypeError, UnconstrainedNumeric};
use crate::ty::fold::TypeFoldable;
Expand All @@ -31,6 +22,16 @@ use crate::ty::{self, GenericParamDefKind, Ty, TyCtxt, CtxtInterners};
use crate::ty::{FloatVid, IntVid, TyVid};
use crate::util::nodemap::FxHashMap;

use arena::SyncDroplessArena;
use errors::DiagnosticBuilder;
use rustc_data_structures::unify as ut;
use std::cell::{Cell, Ref, RefCell, RefMut};
use std::collections::BTreeMap;
use std::fmt;
use syntax::ast;
use syntax_pos::symbol::InternedString;
use syntax_pos::Span;

use self::combine::CombineFields;
use self::lexical_region_resolve::LexicalRegionResolutions;
use self::outlives::env::OutlivesEnvironment;
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ mod rustc {
pub use crate::lint;
}

use rustc_errors as errors;

// FIXME(#27438): right now the unit tests of librustc don't refer to any actual
// functions generated in librustc_data_structures (all
// references are through generic functions), but statics are
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
//! compiler code, rather than using their own custom pass. Those
//! lints are all available in `rustc_lint::builtin`.
use crate::errors::{Applicability, DiagnosticBuilder};
use crate::lint::{LintPass, LateLintPass, LintArray};
use crate::session::Session;
use errors::{Applicability, DiagnosticBuilder};
use syntax::ast;
use syntax::source_map::Span;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/lint/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use std::default::Default as StdDefault;
use syntax::ast;
use syntax::edition;
use syntax_pos::{MultiSpan, Span, symbol::{LocalInternedString, Symbol}};
use crate::errors::DiagnosticBuilder;
use errors::DiagnosticBuilder;
use crate::hir;
use crate::hir::def_id::LOCAL_CRATE;
use crate::hir::intravisit as hir_visit;
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/lint/levels.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
use std::cmp;

use crate::errors::{Applicability, DiagnosticBuilder};
use crate::hir::HirId;
use crate::ich::StableHashingContext;
use crate::lint::builtin;
use crate::lint::context::CheckLintNameResult;
use crate::lint::{self, Lint, LintId, Level, LintSource};
use crate::session::Session;
use crate::util::nodemap::FxHashMap;
use errors::{Applicability, DiagnosticBuilder};
use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey,
StableHasher, StableHasherResult};
use crate::session::Session;
use syntax::ast;
use syntax::attr;
use syntax::feature_gate;
use syntax::source_map::MultiSpan;
use syntax::symbol::Symbol;
use crate::util::nodemap::FxHashMap;

pub struct LintLevelSets {
list: Vec<LintSet>,
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/lint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ pub use self::LintSource::*;

use rustc_data_structures::sync::{self, Lrc};

use crate::errors::{DiagnosticBuilder, DiagnosticId};
use crate::hir::def_id::{CrateNum, LOCAL_CRATE};
use crate::hir::intravisit;
use crate::hir;
use crate::lint::builtin::{BuiltinLintDiagnostics, DUPLICATE_MATCHER_BINDING_NAME};
use crate::lint::builtin::parser::{QUESTION_MARK_MACRO_SEP, ILL_FORMED_ATTRIBUTE_INPUT};
use crate::session::{Session, DiagnosticMessageId};
use crate::ty::TyCtxt;
use crate::ty::query::Providers;
use crate::util::nodemap::NodeMap;
use errors::{DiagnosticBuilder, DiagnosticId};
use std::{hash, ptr};
use syntax::ast;
use syntax::source_map::{MultiSpan, ExpnFormat};
use syntax::early_buffered_lints::BufferedEarlyLintId;
use syntax::edition::Edition;
use syntax::symbol::Symbol;
use syntax_pos::Span;
use crate::ty::TyCtxt;
use crate::ty::query::Providers;
use crate::util::nodemap::NodeMap;

pub use crate::lint::context::{LateContext, EarlyContext, LintContext, LintStore,
check_crate, check_ast_crate, CheckLintNameResult,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/lib_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
// (unlike lang features), which means we need to collect them instead.

use crate::ty::TyCtxt;
use crate::hir::intravisit::{self, NestedVisitorMap, Visitor};
use syntax::symbol::Symbol;
use syntax::ast::{Attribute, MetaItem, MetaItemKind};
use syntax_pos::Span;
use crate::hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc_data_structures::fx::{FxHashSet, FxHashMap};
use crate::errors::DiagnosticId;
use errors::DiagnosticId;

pub struct LibFeatures {
// A map from feature to stabilisation version.
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/liveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ use crate::hir::Node;
use crate::ty::{self, TyCtxt};
use crate::ty::query::Providers;
use crate::lint;
use crate::errors::Applicability;
use crate::util::nodemap::{NodeMap, HirIdMap, HirIdSet};

use errors::Applicability;
use std::collections::{BTreeMap, VecDeque};
use std::{fmt, u32};
use std::io::prelude::*;
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/resolve_lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ use crate::hir::map::Map;
use crate::hir::{GenericArg, GenericParam, ItemLocalId, LifetimeName, Node, ParamName};
use crate::ty::{self, DefIdTree, GenericParamDefKind, TyCtxt};

use crate::errors::{Applicability, DiagnosticBuilder};
use crate::rustc::lint;
use rustc_data_structures::sync::Lrc;
use crate::session::Session;
use crate::util::nodemap::{DefIdMap, FxHashMap, FxHashSet, NodeMap, NodeSet};
use errors::{Applicability, DiagnosticBuilder};
use rustc_data_structures::sync::Lrc;
use std::borrow::Cow;
use std::cell::Cell;
use std::mem::replace;
Expand All @@ -23,7 +24,6 @@ use syntax::attr;
use syntax::ptr::P;
use syntax::symbol::keywords;
use syntax_pos::Span;
use crate::util::nodemap::{DefIdMap, FxHashMap, FxHashSet, NodeMap, NodeSet};

use crate::hir::intravisit::{self, NestedVisitorMap, Visitor};
use crate::hir::{self, GenericParamKind, LifetimeParamKind};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/mir/interpret/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use super::{RawConst, Pointer, InboundsCheck, ScalarMaybeUndef};
use backtrace::Backtrace;

use crate::ty::query::TyCtxtAt;
use crate::errors::DiagnosticBuilder;
use errors::DiagnosticBuilder;

use syntax_pos::{Pos, Span};
use syntax::ast;
Expand Down
3 changes: 1 addition & 2 deletions src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use syntax::parse;
use syntax::symbol::Symbol;
use syntax::feature_gate::UnstableFeatures;

use crate::errors::{ColorConfig, FatalError, Handler};
use errors::{ColorConfig, FatalError, Handler};

use getopts;
use std::collections::{BTreeMap, BTreeSet};
Expand Down Expand Up @@ -2569,7 +2569,6 @@ mod dep_tracking {

#[cfg(test)]
mod tests {
use crate::errors;
use getopts;
use crate::lint;
use crate::middle::cstore;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use rustc_data_structures::sync::{
Ordering::SeqCst,
};

use crate::errors::{self, DiagnosticBuilder, DiagnosticId, Applicability};
use crate::errors::emitter::{Emitter, EmitterWriter};
use errors::{DiagnosticBuilder, DiagnosticId, Applicability};
use errors::emitter::{Emitter, EmitterWriter};
use syntax::ast::{self, NodeId};
use syntax::edition::Edition;
use syntax::feature_gate::{self, AttributeType};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/traits/coherence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub struct OverlapResult<'tcx> {
pub involves_placeholder: bool,
}

pub fn add_placeholder_note(err: &mut crate::errors::DiagnosticBuilder<'_>) {
pub fn add_placeholder_note(err: &mut errors::DiagnosticBuilder<'_>) {
err.note(&format!(
"this behavior recently changed as a result of a bug fix; \
see rust-lang/rust#56105 for details"
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/traits/error_reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@ use super::{
Overflow,
};

use crate::errors::{Applicability, DiagnosticBuilder};
use crate::hir;
use crate::hir::Node;
use crate::hir::def_id::DefId;
use crate::infer::{self, InferCtxt};
use crate::infer::type_variable::TypeVariableOrigin;
use std::fmt;
use syntax::ast;
use crate::session::DiagnosticMessageId;
use crate::ty::{self, AdtKind, ToPredicate, ToPolyTraitRef, Ty, TyCtxt, TypeFoldable};
use crate::ty::GenericParamDefKind;
Expand All @@ -35,6 +32,9 @@ use crate::ty::subst::Subst;
use crate::ty::SubtypePredicate;
use crate::util::nodemap::{FxHashMap, FxHashSet};

use errors::{Applicability, DiagnosticBuilder};
use std::fmt;
use syntax::ast;
use syntax_pos::{DUMMY_SP, Span, ExpnInfo, ExpnFormat};

impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/traits/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl IntercrateAmbiguityCause {
/// See #23980 for details.
pub fn add_intercrate_ambiguity_hint<'a, 'tcx>(
&self,
err: &mut crate::errors::DiagnosticBuilder<'_>,
err: &mut errors::DiagnosticBuilder<'_>,
) {
err.note(&self.intercrate_ambiguity_hint());
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
use crate::dep_graph::DepGraph;
use crate::dep_graph::{self, DepNode, DepConstructor};
use crate::errors::DiagnosticBuilder;
use crate::session::Session;
use crate::session::config::{BorrowckMode, OutputFilenames};
use crate::session::config::CrateType;
Expand Down Expand Up @@ -43,6 +42,7 @@ use crate::ty::{BoundVar, BindingMode};
use crate::ty::CanonicalPolyFnSig;
use crate::util::nodemap::{DefIdMap, DefIdSet, ItemLocalMap};
use crate::util::nodemap::{FxHashMap, FxHashSet};
use errors::DiagnosticBuilder;
use rustc_data_structures::interner::HashInterner;
use smallvec::SmallVec;
use rustc_data_structures::stable_hasher::{HashStable, hash_stable_hashmap,
Expand Down Expand Up @@ -1816,7 +1816,7 @@ pub mod tls {
use std::ptr;
use syntax_pos;
use crate::ty::query;
use crate::errors::{Diagnostic, TRACK_DIAGNOSTICS};
use errors::{Diagnostic, TRACK_DIAGNOSTICS};
use rustc_data_structures::OnDrop;
use rustc_data_structures::sync::{self, Lrc, Lock};
use rustc_data_structures::thin_vec::ThinVec;
Expand Down
Loading

0 comments on commit 0bc8f6f

Please sign in to comment.