Skip to content

Commit 04e3a6e

Browse files
committed
allow maps to be made private or public
Didn't get around to removing all public access.
1 parent b67338b commit 04e3a6e

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

src/librustc/ty/maps.rs

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,11 @@ impl<'tcx> QueryDescription for queries::symbol_name<'tcx> {
267267
macro_rules! define_maps {
268268
(<$tcx:tt>
269269
$($(#[$attr:meta])*
270-
pub $name:ident: $node:ident($K:ty) -> $V:ty),*) => {
270+
[$($pub:tt)*] $name:ident: $node:ident($K:ty) -> $V:ty),*) => {
271271
pub struct Maps<$tcx> {
272272
providers: IndexVec<CrateNum, Providers<$tcx>>,
273273
query_stack: RefCell<Vec<(Span, Query<$tcx>)>>,
274-
$($(#[$attr])* pub $name: RefCell<DepTrackingMap<queries::$name<$tcx>>>),*
274+
$($(#[$attr])* $($pub)* $name: RefCell<DepTrackingMap<queries::$name<$tcx>>>),*
275275
}
276276

277277
impl<$tcx> Maps<$tcx> {
@@ -434,52 +434,52 @@ macro_rules! define_maps {
434434
// the driver creates (using several `rustc_*` crates).
435435
define_maps! { <'tcx>
436436
/// Records the type of every item.
437-
pub type_of: ItemSignature(DefId) -> Ty<'tcx>,
437+
[pub] type_of: ItemSignature(DefId) -> Ty<'tcx>,
438438

439439
/// Maps from the def-id of an item (trait/struct/enum/fn) to its
440440
/// associated generics and predicates.
441-
pub generics_of: ItemSignature(DefId) -> &'tcx ty::Generics,
442-
pub predicates_of: ItemSignature(DefId) -> ty::GenericPredicates<'tcx>,
441+
[] generics_of: ItemSignature(DefId) -> &'tcx ty::Generics,
442+
[] predicates_of: ItemSignature(DefId) -> ty::GenericPredicates<'tcx>,
443443

444444
/// Maps from the def-id of a trait to the list of
445445
/// super-predicates. This is a subset of the full list of
446446
/// predicates. We store these in a separate map because we must
447447
/// evaluate them even during type conversion, often before the
448448
/// full predicates are available (note that supertraits have
449449
/// additional acyclicity requirements).
450-
pub super_predicates_of: ItemSignature(DefId) -> ty::GenericPredicates<'tcx>,
450+
[] super_predicates_of: ItemSignature(DefId) -> ty::GenericPredicates<'tcx>,
451451

452452
/// To avoid cycles within the predicates of a single item we compute
453453
/// per-type-parameter predicates for resolving `T::AssocTy`.
454-
pub type_param_predicates: TypeParamPredicates((DefId, DefId))
454+
[] type_param_predicates: TypeParamPredicates((DefId, DefId))
455455
-> ty::GenericPredicates<'tcx>,
456456

457-
pub trait_def: ItemSignature(DefId) -> &'tcx ty::TraitDef,
458-
pub adt_def: ItemSignature(DefId) -> &'tcx ty::AdtDef,
459-
pub adt_destructor: AdtDestructor(DefId) -> Option<ty::Destructor>,
460-
pub adt_sized_constraint: SizedConstraint(DefId) -> &'tcx [Ty<'tcx>],
461-
pub adt_dtorck_constraint: DtorckConstraint(DefId) -> ty::DtorckConstraint<'tcx>,
457+
[] trait_def: ItemSignature(DefId) -> &'tcx ty::TraitDef,
458+
[] adt_def: ItemSignature(DefId) -> &'tcx ty::AdtDef,
459+
[] adt_destructor: AdtDestructor(DefId) -> Option<ty::Destructor>,
460+
[] adt_sized_constraint: SizedConstraint(DefId) -> &'tcx [Ty<'tcx>],
461+
[] adt_dtorck_constraint: DtorckConstraint(DefId) -> ty::DtorckConstraint<'tcx>,
462462

463463
/// True if this is a foreign item (i.e., linked via `extern { ... }`).
464-
pub is_foreign_item: IsForeignItem(DefId) -> bool,
464+
[] is_foreign_item: IsForeignItem(DefId) -> bool,
465465

466466
/// Maps from def-id of a type or region parameter to its
467467
/// (inferred) variance.
468-
pub variances_of: ItemSignature(DefId) -> Rc<Vec<ty::Variance>>,
468+
[pub] variances_of: ItemSignature(DefId) -> Rc<Vec<ty::Variance>>,
469469

470470
/// Maps from an impl/trait def-id to a list of the def-ids of its items
471-
pub associated_item_def_ids: AssociatedItemDefIds(DefId) -> Rc<Vec<DefId>>,
471+
[] associated_item_def_ids: AssociatedItemDefIds(DefId) -> Rc<Vec<DefId>>,
472472

473473
/// Maps from a trait item to the trait item "descriptor"
474-
pub associated_item: AssociatedItems(DefId) -> ty::AssociatedItem,
474+
[] associated_item: AssociatedItems(DefId) -> ty::AssociatedItem,
475475

476-
pub impl_trait_ref: ItemSignature(DefId) -> Option<ty::TraitRef<'tcx>>,
477-
pub impl_polarity: ItemSignature(DefId) -> hir::ImplPolarity,
476+
[pub] impl_trait_ref: ItemSignature(DefId) -> Option<ty::TraitRef<'tcx>>,
477+
[] impl_polarity: ItemSignature(DefId) -> hir::ImplPolarity,
478478

479479
/// Maps a DefId of a type to a list of its inherent impls.
480480
/// Contains implementations of methods that are inherent to a type.
481481
/// Methods in these implementations don't need to be exported.
482-
pub inherent_impls: InherentImpls(DefId) -> Rc<Vec<DefId>>,
482+
[] inherent_impls: InherentImpls(DefId) -> Rc<Vec<DefId>>,
483483

484484
/// Maps from the def-id of a function/method or const/static
485485
/// to its MIR. Mutation is done at an item granularity to
@@ -488,57 +488,57 @@ define_maps! { <'tcx>
488488
///
489489
/// Note that cross-crate MIR appears to be always borrowed
490490
/// (in the `RefCell` sense) to prevent accidental mutation.
491-
pub mir: Mir(DefId) -> &'tcx RefCell<mir::Mir<'tcx>>,
491+
[pub] mir: Mir(DefId) -> &'tcx RefCell<mir::Mir<'tcx>>,
492492

493493
/// Maps DefId's that have an associated Mir to the result
494494
/// of the MIR qualify_consts pass. The actual meaning of
495495
/// the value isn't known except to the pass itself.
496-
pub mir_const_qualif: Mir(DefId) -> u8,
496+
[] mir_const_qualif: Mir(DefId) -> u8,
497497

498498
/// Records the type of each closure. The def ID is the ID of the
499499
/// expression defining the closure.
500-
pub closure_kind: ItemSignature(DefId) -> ty::ClosureKind,
500+
[] closure_kind: ItemSignature(DefId) -> ty::ClosureKind,
501501

502502
/// Records the type of each closure. The def ID is the ID of the
503503
/// expression defining the closure.
504-
pub closure_type: ItemSignature(DefId) -> ty::PolyFnSig<'tcx>,
504+
[] closure_type: ItemSignature(DefId) -> ty::PolyFnSig<'tcx>,
505505

506506
/// Caches CoerceUnsized kinds for impls on custom types.
507-
pub coerce_unsized_info: ItemSignature(DefId)
507+
[] coerce_unsized_info: ItemSignature(DefId)
508508
-> ty::adjustment::CoerceUnsizedInfo,
509509

510-
pub typeck_item_bodies: typeck_item_bodies_dep_node(CrateNum) -> CompileResult,
510+
[] typeck_item_bodies: typeck_item_bodies_dep_node(CrateNum) -> CompileResult,
511511

512-
pub typeck_tables_of: TypeckTables(DefId) -> &'tcx ty::TypeckTables<'tcx>,
512+
[] typeck_tables_of: TypeckTables(DefId) -> &'tcx ty::TypeckTables<'tcx>,
513513

514-
pub coherent_trait: coherent_trait_dep_node((CrateNum, DefId)) -> (),
514+
[] coherent_trait: coherent_trait_dep_node((CrateNum, DefId)) -> (),
515515

516-
pub borrowck: BorrowCheck(DefId) -> (),
516+
[] borrowck: BorrowCheck(DefId) -> (),
517517

518518
/// Gets a complete map from all types to their inherent impls.
519519
/// Not meant to be used directly outside of coherence.
520520
/// (Defined only for LOCAL_CRATE)
521-
pub crate_inherent_impls: crate_inherent_impls_dep_node(CrateNum) -> CrateInherentImpls,
521+
[] crate_inherent_impls: crate_inherent_impls_dep_node(CrateNum) -> CrateInherentImpls,
522522

523523
/// Checks all types in the krate for overlap in their inherent impls. Reports errors.
524524
/// Not meant to be used directly outside of coherence.
525525
/// (Defined only for LOCAL_CRATE)
526-
pub crate_inherent_impls_overlap_check: crate_inherent_impls_dep_node(CrateNum) -> (),
526+
[] crate_inherent_impls_overlap_check: crate_inherent_impls_dep_node(CrateNum) -> (),
527527

528528
/// Results of evaluating const items or constants embedded in
529529
/// other items (such as enum variant explicit discriminants).
530-
pub const_eval: const_eval_dep_node((DefId, &'tcx Substs<'tcx>))
530+
[] const_eval: const_eval_dep_node((DefId, &'tcx Substs<'tcx>))
531531
-> const_val::EvalResult<'tcx>,
532532

533533
/// Performs the privacy check and computes "access levels".
534-
pub privacy_access_levels: PrivacyAccessLevels(CrateNum) -> Rc<AccessLevels>,
534+
[] privacy_access_levels: PrivacyAccessLevels(CrateNum) -> Rc<AccessLevels>,
535535

536-
pub reachable_set: reachability_dep_node(CrateNum) -> Rc<NodeSet>,
536+
[] reachable_set: reachability_dep_node(CrateNum) -> Rc<NodeSet>,
537537

538-
pub mir_shims: mir_shim_dep_node(ty::InstanceDef<'tcx>) -> &'tcx RefCell<mir::Mir<'tcx>>,
538+
[] mir_shims: mir_shim_dep_node(ty::InstanceDef<'tcx>) -> &'tcx RefCell<mir::Mir<'tcx>>,
539539

540-
pub def_symbol_name: SymbolName(DefId) -> ty::SymbolName,
541-
pub symbol_name: symbol_name_dep_node(ty::Instance<'tcx>) -> ty::SymbolName
540+
[] def_symbol_name: SymbolName(DefId) -> ty::SymbolName,
541+
[] symbol_name: symbol_name_dep_node(ty::Instance<'tcx>) -> ty::SymbolName
542542
}
543543

544544
fn coherent_trait_dep_node((_, def_id): (CrateNum, DefId)) -> DepNode<DefId> {

0 commit comments

Comments
 (0)