-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Move structures from ty/mod.rs
into their own modules
#111503
Closed
The head ref may contain hidden characters: "\u{1F338}cutify_ty\u{1F338}"
Closed
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
4cb52ff
Move `ty::Visibility` to its own little module (cute)
WaffleLapkin febb95e
Move `ty::ImplPolarity` to its own little module (cute)
WaffleLapkin 7b9ec6c
Move `ty::BoundConstness` to its own little module (cute)
WaffleLapkin 2066470
Move `ty::{Predicate, PredicateKind}` to their own little module (cute)
WaffleLapkin 83383d4
Move `ty::InstantiatedPredicates` to its own little module (cute)
WaffleLapkin 8830e66
Move `ty::{TraitPredicate, PolyTraitPredicate}` to their own little m…
WaffleLapkin e5893f4
Move `ty::{OutlivesPredicate, PolyRegionOutlivesPredicate, PolyTypeOu…
WaffleLapkin fcfdd0e
Move `ty::{PolyTraitPredicate, TraitPredicate}` to their own little m…
WaffleLapkin dde5ea5
Move `ty::{CoercePredicate, PolyCoercePredicate}` to their own little…
WaffleLapkin fb2743d
Move `ty::{PolyProjectionPredicate, ProjectionPredicate}` to their ow…
WaffleLapkin f0210a1
Move `ty::ToPredicate` to its own little module (cute)
WaffleLapkin 675b01f
Move `ty::{ParamEnv, ParamEnvAnd}` to their own little module (cute)
WaffleLapkin 33df1c9
Move `ty::{Term, TermKind}` to their own little module (cute)
WaffleLapkin 709d355
Move `ty::Ty` to its own little module (cute)
WaffleLapkin 2306e97
Move `ty::AliasRelationDirection` to its own little module (cute)
WaffleLapkin 55811e0
Move `ty::OpaqueHiddenType` to its own little module (cute)
WaffleLapkin 3e53b05
Move `ty::VariantDef` to its own little module (cute)
WaffleLapkin 9f88bf1
Move `ty::FieldDef` to its own little module (cute)
WaffleLapkin 55f1d16
Move `ty::{Placeholder, PlaceholderConst, PlaceholderRegion, Placehol…
WaffleLapkin 9ca749d
Move `ty::SymbolName` to its own little module (cute)
WaffleLapkin 4a10c11
Move/merge impls out of `ty/mod.rs`
WaffleLapkin 9303663
Move `ty::{ResolverAstLowering, ResolverGlobalCtxt, ResolverOutputs}`…
WaffleLapkin 5107cb0
Move `ty::MainDefinition` to its own little module (cute)
WaffleLapkin 8409f98
Move `ty::Clause` to its own little module (cute)
WaffleLapkin 9ef3c2f
Move `ty::CratePredicatesMap` to its own little module (cute)
WaffleLapkin f9de9fa
Move `ty::ImplTraitInTraitData` to its own little module (cute)
WaffleLapkin 9d1cfec
Move `ty::{BoundConst, CReaderCacheKey, ClosureSizeProfileData, Crate…
WaffleLapkin 4ba55d5
Rearange [pub] uses
WaffleLapkin 9175367
group `ty::coherence` in one file
WaffleLapkin 14ec3a1
group `ty::opaque` in one file
WaffleLapkin d4b6a6a
Move `BoundConst` to `ty::consts`
WaffleLapkin 181df7a
Group adt adjesent types into `ty::adt`
WaffleLapkin 33576fa
Move `rustc_middle::{ty=>}::resolver_outputs`
WaffleLapkin ca46414
Group `ty::Predicate` internals in one file
WaffleLapkin 06add87
Move `ParamTerm` to `term.rs`
WaffleLapkin 65acff8
Destribute placeholders
WaffleLapkin 8706a19
Move `InferVarInfo` to `ty_.rs`
WaffleLapkin a935652
Move `AliasRelationDirection` to `predicate.rs`
WaffleLapkin 5bb181a
Move `CReaderCacheKey` to `rustc_middle::cache`
WaffleLapkin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use rustc_hir::def_id::CrateNum; | ||
|
||
/// Contains information needed to resolve types and (in the future) look up | ||
/// the types of AST nodes. | ||
#[derive(Copy, Clone, PartialEq, Eq, Hash)] | ||
pub struct CReaderCacheKey { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is should be in |
||
pub cnum: Option<CrateNum>, | ||
pub pos: usize, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
use rustc_ast as ast; | ||
use rustc_ast::node_id::NodeMap; | ||
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet}; | ||
use rustc_data_structures::steal::Steal; | ||
use rustc_hir as hir; | ||
use rustc_hir::def::{DefKind, DocLinkResMap, LifetimeRes, Res}; | ||
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LocalDefIdMap}; | ||
use rustc_index::IndexVec; | ||
use rustc_session::lint::LintBuffer; | ||
use rustc_span::hygiene::MacroKind; | ||
use rustc_span::symbol::{Ident, Symbol}; | ||
use rustc_span::{ExpnId, Span}; | ||
|
||
use crate::metadata::ModChild; | ||
use crate::middle::privacy::EffectiveVisibilities; | ||
use crate::ty::Visibility; | ||
|
||
pub struct ResolverOutputs { | ||
pub global_ctxt: ResolverGlobalCtxt, | ||
pub ast_lowering: ResolverAstLowering, | ||
} | ||
|
||
#[derive(Debug)] | ||
pub struct ResolverGlobalCtxt { | ||
pub visibilities: FxHashMap<LocalDefId, Visibility>, | ||
/// This field is used to decide whether we should make `PRIVATE_IN_PUBLIC` a hard error. | ||
pub has_pub_restricted: bool, | ||
/// Item with a given `LocalDefId` was defined during macro expansion with ID `ExpnId`. | ||
pub expn_that_defined: FxHashMap<LocalDefId, ExpnId>, | ||
pub effective_visibilities: EffectiveVisibilities, | ||
pub extern_crate_map: FxHashMap<LocalDefId, CrateNum>, | ||
pub maybe_unused_trait_imports: FxIndexSet<LocalDefId>, | ||
pub module_children: LocalDefIdMap<Vec<ModChild>>, | ||
pub glob_map: FxHashMap<LocalDefId, FxHashSet<Symbol>>, | ||
pub main_def: Option<MainDefinition>, | ||
pub trait_impls: FxIndexMap<DefId, Vec<LocalDefId>>, | ||
/// A list of proc macro LocalDefIds, written out in the order in which | ||
/// they are declared in the static array generated by proc_macro_harness. | ||
pub proc_macros: Vec<LocalDefId>, | ||
/// Mapping from ident span to path span for paths that don't exist as written, but that | ||
/// exist under `std`. For example, wrote `str::from_utf8` instead of `std::str::from_utf8`. | ||
pub confused_type_with_std_module: FxHashMap<Span, Span>, | ||
pub doc_link_resolutions: FxHashMap<LocalDefId, DocLinkResMap>, | ||
pub doc_link_traits_in_scope: FxHashMap<LocalDefId, Vec<DefId>>, | ||
pub all_macro_rules: FxHashMap<Symbol, Res<ast::NodeId>>, | ||
} | ||
|
||
/// Resolutions that should only be used for lowering. | ||
/// This struct is meant to be consumed by lowering. | ||
#[derive(Debug)] | ||
pub struct ResolverAstLowering { | ||
pub legacy_const_generic_args: FxHashMap<DefId, Option<Vec<usize>>>, | ||
|
||
/// Resolutions for nodes that have a single resolution. | ||
pub partial_res_map: NodeMap<hir::def::PartialRes>, | ||
/// Resolutions for import nodes, which have multiple resolutions in different namespaces. | ||
pub import_res_map: NodeMap<hir::def::PerNS<Option<Res<ast::NodeId>>>>, | ||
/// Resolutions for labels (node IDs of their corresponding blocks or loops). | ||
pub label_res_map: NodeMap<ast::NodeId>, | ||
/// Resolutions for lifetimes. | ||
pub lifetimes_res_map: NodeMap<LifetimeRes>, | ||
/// Lifetime parameters that lowering will have to introduce. | ||
pub extra_lifetime_params_map: NodeMap<Vec<(Ident, ast::NodeId, LifetimeRes)>>, | ||
|
||
pub next_node_id: ast::NodeId, | ||
|
||
pub node_id_to_def_id: FxHashMap<ast::NodeId, LocalDefId>, | ||
pub def_id_to_node_id: IndexVec<LocalDefId, ast::NodeId>, | ||
|
||
pub trait_map: NodeMap<Vec<hir::TraitCandidate>>, | ||
/// A small map keeping true kinds of built-in macros that appear to be fn-like on | ||
/// the surface (`macro` items in libcore), but are actually attributes or derives. | ||
pub builtin_macro_kinds: FxHashMap<LocalDefId, MacroKind>, | ||
/// List functions and methods for which lifetime elision was successful. | ||
pub lifetime_elision_allowed: FxHashSet<ast::NodeId>, | ||
|
||
/// Lints that were emitted by the resolver and early lints. | ||
pub lint_buffer: Steal<LintBuffer>, | ||
} | ||
|
||
#[derive(Clone, Copy, Debug)] | ||
pub struct MainDefinition { | ||
pub res: Res<ast::NodeId>, | ||
pub is_import: bool, | ||
pub span: Span, | ||
} | ||
|
||
impl MainDefinition { | ||
pub fn opt_fn_def_id(self) -> Option<DefId> { | ||
if let Res::Def(DefKind::Fn, def_id) = self.res { Some(def_id) } else { None } | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make 3 imports of this?