Skip to content
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

Remove some imports to the rustc crate #69920

Merged
merged 2 commits into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
use direct imports for rustc::{lint, session}.
  • Loading branch information
Centril committed Mar 16, 2020
commit 4392a8b73c3f51315c593344f4e7386ebc6e78e5
10 changes: 10 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3625,6 +3625,7 @@ dependencies = [
"rustc_data_structures",
"rustc_hir",
"rustc_metadata",
"rustc_session",
"rustc_span",
"rustc_target",
]
Expand Down Expand Up @@ -3678,6 +3679,7 @@ dependencies = [
"rustc_parse",
"rustc_plugin_impl",
"rustc_save_analysis",
"rustc_session",
"rustc_span",
"rustc_target",
"serialize",
Expand Down Expand Up @@ -3792,6 +3794,7 @@ dependencies = [
"rustc_hir",
"rustc_index",
"rustc_macros",
"rustc_session",
"rustc_span",
"rustc_target",
"smallvec 1.0.0",
Expand Down Expand Up @@ -3904,6 +3907,7 @@ dependencies = [
"rustc_expand",
"rustc_hir",
"rustc_index",
"rustc_session",
"rustc_span",
"rustc_target",
"serialize",
Expand Down Expand Up @@ -3934,6 +3938,7 @@ dependencies = [
"rustc_infer",
"rustc_lexer",
"rustc_macros",
"rustc_session",
"rustc_span",
"rustc_target",
"rustc_trait_selection",
Expand Down Expand Up @@ -4014,6 +4019,7 @@ dependencies = [
"rustc_hir",
"rustc_lint",
"rustc_metadata",
"rustc_session",
"rustc_span",
]

Expand All @@ -4028,6 +4034,7 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_hir",
"rustc_session",
"rustc_span",
"rustc_typeck",
]
Expand Down Expand Up @@ -4069,6 +4076,7 @@ dependencies = [
"rustc_data_structures",
"rustc_hir",
"rustc_parse",
"rustc_session",
"rustc_span",
"serde_json",
]
Expand Down Expand Up @@ -4175,6 +4183,7 @@ dependencies = [
"rustc_data_structures",
"rustc_hir",
"rustc_infer",
"rustc_session",
"rustc_span",
"rustc_target",
"rustc_trait_selection",
Expand All @@ -4194,6 +4203,7 @@ dependencies = [
"rustc_hir",
"rustc_index",
"rustc_infer",
"rustc_session",
"rustc_span",
"rustc_target",
"rustc_trait_selection",
Expand Down
5 changes: 2 additions & 3 deletions src/librustc/ich/hcx.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use crate::hir::map::definitions::Definitions;
use crate::hir::map::DefPathHash;
use crate::hir::map::definitions::{DefPathHash, Definitions};
use crate::ich::{self, CachingSourceMapView};
use crate::middle::cstore::CrateStore;
use crate::session::Session;
use crate::ty::{fast_reject, TyCtxt};

use rustc_ast::ast;
Expand All @@ -11,6 +9,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_data_structures::sync::Lrc;
use rustc_hir as hir;
use rustc_hir::def_id::{DefId, DefIndex};
use rustc_session::Session;
use rustc_span::source_map::SourceMap;
use rustc_span::symbol::Symbol;
use rustc_span::{BytePos, SourceFile};
Expand Down
1 change: 0 additions & 1 deletion src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ pub mod infer;
pub mod lint;
pub mod middle;
pub mod mir;
pub use rustc_session as session;
pub mod traits;
pub mod ty;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_errors::{pluralize, Applicability, DiagnosticBuilder, DiagnosticId};
use rustc_hir::HirId;
pub use rustc_session::lint::{builtin, Level, Lint, LintId, LintPass};
use rustc_session::lint::{builtin, Level, Lint, LintId};
use rustc_session::{DiagnosticMessageId, Session};
use rustc_span::hygiene::MacroKind;
use rustc_span::source_map::{DesugaringKind, ExpnKind, MultiSpan};
Expand Down
18 changes: 9 additions & 9 deletions src/librustc/middle/cstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
//! are *mostly* used as a part of that interface, but these should
//! probably get a better home if someone can find one.

use crate::hir::map as hir_map;
use crate::hir::map::definitions::{DefKey, DefPathTable};
use crate::session::search_paths::PathKind;
use crate::session::CrateDisambiguator;
pub use self::NativeLibraryKind::*;

use crate::hir::map::definitions::{DefKey, DefPath, DefPathHash, DefPathTable};
use crate::ty::TyCtxt;

use rustc_ast::ast;
Expand All @@ -14,15 +13,16 @@ use rustc_data_structures::svh::Svh;
use rustc_data_structures::sync::{self, MetadataRef};
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
use rustc_macros::HashStable;
use rustc_session::search_paths::PathKind;
pub use rustc_session::utils::NativeLibraryKind;
use rustc_session::CrateDisambiguator;
use rustc_span::symbol::Symbol;
use rustc_span::Span;
use rustc_target::spec::Target;

use std::any::Any;
use std::path::{Path, PathBuf};

pub use self::NativeLibraryKind::*;
pub use rustc_session::utils::NativeLibraryKind;

// lonely orphan structs and enums looking for a better home

/// Where a crate came from on the local filesystem. One of these three options
Expand Down Expand Up @@ -197,8 +197,8 @@ pub trait CrateStore {

// resolve
fn def_key(&self, def: DefId) -> DefKey;
fn def_path(&self, def: DefId) -> hir_map::DefPath;
fn def_path_hash(&self, def: DefId) -> hir_map::DefPathHash;
fn def_path(&self, def: DefId) -> DefPath;
fn def_path_hash(&self, def: DefId) -> DefPathHash;
fn def_path_table(&self, cnum: CrateNum) -> &DefPathTable;

// "queries" used in resolve that aren't tracked for incremental compilation
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/dependency_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! For all the gory details, see the provider of the `dependency_formats`
//! query.

use crate::session::config;
use rustc_session::config;

/// A list of dependencies for a certain crate type.
///
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
//! this via an attribute on the crate like `#![recursion_limit="22"]`. This pass
//! just peeks and looks for that attribute.

use crate::session::Session;
use core::num::IntErrorKind;
use rustc::bug;
use rustc_ast::ast;
use rustc_data_structures::sync::Once;
use rustc_session::Session;
use rustc_span::symbol::{sym, Symbol};

use rustc_data_structures::sync::Once;
use std::num::IntErrorKind;

pub fn update_limits(sess: &Session, krate: &ast::Crate) {
update_limit(sess, krate, &sess.recursion_limit, sym::recursion_limit, 128);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

pub use self::StabilityLevel::*;

use crate::session::{DiagnosticMessageId, Session};
use crate::ty::{self, TyCtxt};
use rustc_ast::ast::CRATE_NODE_ID;
use rustc_attr::{self as attr, ConstStability, Deprecation, RustcDeprecation, Stability};
Expand All @@ -17,6 +16,7 @@ use rustc_hir::{self, HirId};
use rustc_session::lint::builtin::{DEPRECATED, DEPRECATED_IN_FUTURE, SOFT_UNSTABLE};
use rustc_session::lint::{BuiltinLintDiagnostics, Lint, LintBuffer};
use rustc_session::parse::feature_err_issue;
use rustc_session::{DiagnosticMessageId, Session};
use rustc_span::symbol::{sym, Symbol};
use rustc_span::{MultiSpan, Span};

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/mir/mono.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::dep_graph::{DepConstructor, DepNode, WorkProduct, WorkProductId};
use crate::ich::{Fingerprint, NodeIdHashingMode, StableHashingContext};
use crate::session::config::OptLevel;
use crate::ty::print::obsolete::DefPathBasedNames;
use crate::ty::{subst::InternalSubsts, Instance, InstanceDef, SymbolName, TyCtxt};
use rustc_attr::InlineAttr;
Expand All @@ -9,6 +8,7 @@ use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
use rustc_hir::HirId;
use rustc_session::config::OptLevel;
use rustc_span::source_map::Span;
use rustc_span::symbol::Symbol;
use std::fmt;
Expand Down
34 changes: 14 additions & 20 deletions src/librustc/ty/layout.rs
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
use crate::session::{self, DataTypeKind};
use crate::ich::StableHashingContext;
use crate::mir::{GeneratorLayout, GeneratorSavedLocal};
use crate::ty::subst::Subst;
use crate::ty::{self, subst::SubstsRef, ReprOptions, Ty, TyCtxt, TypeFoldable};

use rustc_ast::ast::{self, Ident, IntTy, UintTy};
use rustc_attr as attr;
use rustc_span::DUMMY_SP;

use std::cmp;
use std::fmt;
use std::iter;
use std::mem;
use std::ops::Bound;

use crate::ich::StableHashingContext;
use crate::mir::{GeneratorLayout, GeneratorSavedLocal};
use crate::ty::subst::Subst;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_hir as hir;
use rustc_index::bit_set::BitSet;
use rustc_index::vec::{Idx, IndexVec};

use rustc_session::{DataTypeKind, FieldInfo, SizeKind, VariantInfo};
use rustc_span::DUMMY_SP;
use rustc_target::abi::call::{
ArgAbi, ArgAttribute, ArgAttributes, Conv, FnAbi, PassMode, Reg, RegKind,
};
pub use rustc_target::abi::*;
use rustc_target::spec::{abi::Abi as SpecAbi, HasTargetSpec};

use std::cmp;
use std::fmt;
use std::iter;
use std::mem;
use std::ops::Bound;

pub trait IntegerExt {
fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx>, signed: bool) -> Ty<'tcx>;
fn from_attr<C: HasDataLayout>(cx: &C, ity: attr::IntType) -> Integer;
Expand Down Expand Up @@ -1648,7 +1646,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
if min_size < field_end {
min_size = field_end;
}
session::FieldInfo {
FieldInfo {
name: name.to_string(),
offset: offset.bytes(),
size: field_layout.size.bytes(),
Expand All @@ -1658,13 +1656,9 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
})
.collect();

session::VariantInfo {
VariantInfo {
name: n.map(|n| n.to_string()),
kind: if layout.is_unsized() {
session::SizeKind::Min
} else {
session::SizeKind::Exact
},
kind: if layout.is_unsized() { SizeKind::Min } else { SizeKind::Exact },
align: layout.align.abi.bytes(),
size: if min_size.bytes() == 0 { layout.size.bytes() } else { min_size.bytes() },
fields: field_info,
Expand Down
3 changes: 1 addition & 2 deletions src/librustc/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ pub use self::Variance::*;
use crate::arena::Arena;
use crate::hir::exports::ExportMap;
use crate::hir::map as hir_map;

use crate::ich::Fingerprint;
use crate::ich::StableHashingContext;
use crate::infer::canonical::Canonical;
Expand All @@ -19,7 +18,6 @@ use crate::middle::resolve_lifetime::ObjectLifetimeDefault;
use crate::mir::interpret::ErrorHandled;
use crate::mir::GeneratorLayout;
use crate::mir::ReadOnlyBodyAndCache;
use crate::session::DataTypeKind;
use crate::traits::{self, Reveal};
use crate::ty;
use crate::ty::layout::VariantIdx;
Expand All @@ -42,6 +40,7 @@ use rustc_hir::{Constness, GlobMap, Node, TraitMap};
use rustc_index::vec::{Idx, IndexVec};
use rustc_macros::HashStable;
use rustc_serialize::{self, Encodable, Encoder};
use rustc_session::DataTypeKind;
use rustc_span::hygiene::ExpnId;
use rustc_span::symbol::{kw, sym, Symbol};
use rustc_span::Span;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/ty/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ use crate::mir::interpret::GlobalId;
use crate::mir::interpret::{ConstEvalRawResult, ConstEvalResult, ConstValue};
use crate::mir::interpret::{LitToConstError, LitToConstInput};
use crate::mir::mono::CodegenUnit;
use crate::session::config::{EntryFnType, OptLevel, OutputFilenames, SymbolManglingVersion};
use crate::session::CrateDisambiguator;
use crate::traits::query::{
CanonicalPredicateGoal, CanonicalProjectionGoal, CanonicalTyGoal,
CanonicalTypeOpAscribeUserTypeGoal, CanonicalTypeOpEqGoal, CanonicalTypeOpNormalizeGoal,
Expand Down Expand Up @@ -49,6 +47,8 @@ use rustc_hir::def::DefKind;
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, DefIndex};
use rustc_hir::{Crate, HirIdSet, ItemLocalId, TraitCandidate};
use rustc_index::vec::IndexVec;
use rustc_session::config::{EntryFnType, OptLevel, OutputFilenames, SymbolManglingVersion};
use rustc_session::CrateDisambiguator;
use rustc_target::spec::PanicStrategy;

use rustc_ast::ast;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/query/on_disk_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use crate::hir::map::definitions::DefPathHash;
use crate::ich::{CachingSourceMapView, Fingerprint};
use crate::mir::interpret::{AllocDecodingSession, AllocDecodingState};
use crate::mir::{self, interpret};
use crate::session::{CrateDisambiguator, Session};
use crate::ty::codec::{self as ty_codec, TyDecoder, TyEncoder};
use crate::ty::context::TyCtxt;
use crate::ty::{self, Ty};
Expand All @@ -19,6 +18,7 @@ use rustc_serialize::{
opaque, Decodable, Decoder, Encodable, Encoder, SpecializedDecoder, SpecializedEncoder,
UseSpecializedDecodable, UseSpecializedEncodable,
};
use rustc_session::{CrateDisambiguator, Session};
use rustc_span::hygiene::{ExpnId, SyntaxContext};
use rustc_span::source_map::{SourceMap, StableSourceFileId};
use rustc_span::{BytePos, SourceFile, Span, DUMMY_SP};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_ast_lowering/path.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use super::{AnonymousLifetimeMode, ImplTraitContext, LoweringContext, ParamMode};
use super::{GenericArgsCtor, ParenthesizedGenericArgs};

use rustc::lint::builtin::ELIDED_LIFETIMES_IN_PATHS;
use rustc::span_bug;
use rustc_ast::ast::{self, *};
use rustc_errors::{struct_span_err, Applicability};
use rustc_hir as hir;
use rustc_hir::def::{DefKind, PartialRes, Res};
use rustc_hir::def_id::DefId;
use rustc_hir::GenericArg;
use rustc_session::lint::builtin::ELIDED_LIFETIMES_IN_PATHS;
use rustc_session::lint::BuiltinLintDiagnostics;
use rustc_span::Span;

Expand Down
4 changes: 2 additions & 2 deletions src/librustc_codegen_llvm/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
use std::ffi::CString;

use rustc::middle::codegen_fn_attrs::CodegenFnAttrFlags;
use rustc::session::config::{OptLevel, Sanitizer};
use rustc::session::Session;
use rustc::ty::layout::HasTyCtxt;
use rustc::ty::query::Providers;
use rustc::ty::{self, Ty, TyCtxt};
Expand All @@ -13,6 +11,8 @@ use rustc_data_structures::const_cstr;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::small_c_str::SmallCStr;
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
use rustc_session::config::{OptLevel, Sanitizer};
use rustc_session::Session;
use rustc_target::abi::call::Conv;
use rustc_target::spec::PanicStrategy;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/back/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use std::str;

use crate::llvm::archive_ro::{ArchiveRO, Child};
use crate::llvm::{self, ArchiveKind};
use rustc::session::Session;
use rustc_codegen_ssa::back::archive::{find_library, ArchiveBuilder};
use rustc_codegen_ssa::{looks_like_rust_object_file, METADATA_FILENAME, RLIB_BYTECODE_EXTENSION};
use rustc_session::Session;
use rustc_span::symbol::Symbol;

struct ArchiveConfig<'a> {
Expand Down
Loading