Skip to content

Commit ddc4cc1

Browse files
committedApr 26, 2017
allow maps to be made private or public
Didn't get around to removing all public access.
1 parent c98d1b3 commit ddc4cc1

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed
 

‎src/librustc/ty/maps.rs

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,11 @@ impl<'tcx> QueryDescription for queries::const_eval<'tcx> {
245245
macro_rules! define_maps {
246246
(<$tcx:tt>
247247
$($(#[$attr:meta])*
248-
pub $name:ident: $node:ident($K:ty) -> $V:ty),*) => {
248+
[$($pub:tt)*] $name:ident: $node:ident($K:ty) -> $V:ty),*) => {
249249
pub struct Maps<$tcx> {
250250
providers: IndexVec<CrateNum, Providers<$tcx>>,
251251
query_stack: RefCell<Vec<(Span, Query<$tcx>)>>,
252-
$($(#[$attr])* pub $name: RefCell<DepTrackingMap<queries::$name<$tcx>>>),*
252+
$($(#[$attr])* $($pub)* $name: RefCell<DepTrackingMap<queries::$name<$tcx>>>),*
253253
}
254254

255255
impl<$tcx> Maps<$tcx> {
@@ -412,52 +412,52 @@ macro_rules! define_maps {
412412
// the driver creates (using several `rustc_*` crates).
413413
define_maps! { <'tcx>
414414
/// Records the type of every item.
415-
pub type_of: ItemSignature(DefId) -> Ty<'tcx>,
415+
[pub] type_of: ItemSignature(DefId) -> Ty<'tcx>,
416416

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

422422
/// Maps from the def-id of a trait to the list of
423423
/// super-predicates. This is a subset of the full list of
424424
/// predicates. We store these in a separate map because we must
425425
/// evaluate them even during type conversion, often before the
426426
/// full predicates are available (note that supertraits have
427427
/// additional acyclicity requirements).
428-
pub super_predicates_of: ItemSignature(DefId) -> ty::GenericPredicates<'tcx>,
428+
[] super_predicates_of: ItemSignature(DefId) -> ty::GenericPredicates<'tcx>,
429429

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

435-
pub trait_def: ItemSignature(DefId) -> &'tcx ty::TraitDef,
436-
pub adt_def: ItemSignature(DefId) -> &'tcx ty::AdtDef,
437-
pub adt_destructor: AdtDestructor(DefId) -> Option<ty::Destructor>,
438-
pub adt_sized_constraint: SizedConstraint(DefId) -> &'tcx [Ty<'tcx>],
439-
pub adt_dtorck_constraint: DtorckConstraint(DefId) -> ty::DtorckConstraint<'tcx>,
435+
[] trait_def: ItemSignature(DefId) -> &'tcx ty::TraitDef,
436+
[] adt_def: ItemSignature(DefId) -> &'tcx ty::AdtDef,
437+
[] adt_destructor: AdtDestructor(DefId) -> Option<ty::Destructor>,
438+
[] adt_sized_constraint: SizedConstraint(DefId) -> &'tcx [Ty<'tcx>],
439+
[] adt_dtorck_constraint: DtorckConstraint(DefId) -> ty::DtorckConstraint<'tcx>,
440440

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

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

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

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

454-
pub impl_trait_ref: ItemSignature(DefId) -> Option<ty::TraitRef<'tcx>>,
455-
pub impl_polarity: ItemSignature(DefId) -> hir::ImplPolarity,
454+
[pub] impl_trait_ref: ItemSignature(DefId) -> Option<ty::TraitRef<'tcx>>,
455+
[] impl_polarity: ItemSignature(DefId) -> hir::ImplPolarity,
456456

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

462462
/// Maps from the def-id of a function/method or const/static
463463
/// to its MIR. Mutation is done at an item granularity to
@@ -466,54 +466,54 @@ define_maps! { <'tcx>
466466
///
467467
/// Note that cross-crate MIR appears to be always borrowed
468468
/// (in the `RefCell` sense) to prevent accidental mutation.
469-
pub mir: Mir(DefId) -> &'tcx RefCell<mir::Mir<'tcx>>,
469+
[pub] mir: Mir(DefId) -> &'tcx RefCell<mir::Mir<'tcx>>,
470470

471471
/// Maps DefId's that have an associated Mir to the result
472472
/// of the MIR qualify_consts pass. The actual meaning of
473473
/// the value isn't known except to the pass itself.
474-
pub mir_const_qualif: Mir(DefId) -> u8,
474+
[] mir_const_qualif: Mir(DefId) -> u8,
475475

476476
/// Records the type of each closure. The def ID is the ID of the
477477
/// expression defining the closure.
478-
pub closure_kind: ItemSignature(DefId) -> ty::ClosureKind,
478+
[] closure_kind: ItemSignature(DefId) -> ty::ClosureKind,
479479

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

484484
/// Caches CoerceUnsized kinds for impls on custom types.
485-
pub coerce_unsized_info: ItemSignature(DefId)
485+
[] coerce_unsized_info: ItemSignature(DefId)
486486
-> ty::adjustment::CoerceUnsizedInfo,
487487

488-
pub typeck_item_bodies: typeck_item_bodies_dep_node(CrateNum) -> CompileResult,
488+
[] typeck_item_bodies: typeck_item_bodies_dep_node(CrateNum) -> CompileResult,
489489

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

492-
pub coherent_trait: coherent_trait_dep_node((CrateNum, DefId)) -> (),
492+
[] coherent_trait: coherent_trait_dep_node((CrateNum, DefId)) -> (),
493493

494-
pub borrowck: BorrowCheck(DefId) -> (),
494+
[] borrowck: BorrowCheck(DefId) -> (),
495495

496496
/// Gets a complete map from all types to their inherent impls.
497497
/// Not meant to be used directly outside of coherence.
498498
/// (Defined only for LOCAL_CRATE)
499-
pub crate_inherent_impls: crate_inherent_impls_dep_node(CrateNum) -> CrateInherentImpls,
499+
[] crate_inherent_impls: crate_inherent_impls_dep_node(CrateNum) -> CrateInherentImpls,
500500

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

506506
/// Results of evaluating const items or constants embedded in
507507
/// other items (such as enum variant explicit discriminants).
508-
pub const_eval: const_eval_dep_node((DefId, &'tcx Substs<'tcx>))
508+
[] const_eval: const_eval_dep_node((DefId, &'tcx Substs<'tcx>))
509509
-> const_val::EvalResult<'tcx>,
510510

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

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

516-
pub mir_shims: mir_shim_dep_node(ty::InstanceDef<'tcx>) -> &'tcx RefCell<mir::Mir<'tcx>>
516+
[] mir_shims: mir_shim_dep_node(ty::InstanceDef<'tcx>) -> &'tcx RefCell<mir::Mir<'tcx>>
517517
}
518518

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

0 commit comments

Comments
 (0)