diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs index cad7b2a1e57b9..226370fccadde 100644 --- a/compiler/rustc_hir_analysis/src/collect.rs +++ b/compiler/rustc_hir_analysis/src/collect.rs @@ -57,7 +57,7 @@ mod type_of; /////////////////////////////////////////////////////////////////////////// -pub fn provide(providers: &mut Providers) { +pub(crate) fn provide(providers: &mut Providers) { resolve_bound_vars::provide(providers); *providers = Providers { type_of: type_of::type_of, @@ -122,7 +122,7 @@ pub fn provide(providers: &mut Providers) { /// `ItemCtxt` is parameterized by a `DefId` that it uses to satisfy /// `probe_ty_param_bounds` requests, drawing the information from /// the HIR (`hir::Generics`), recursively. -pub struct ItemCtxt<'tcx> { +pub(crate) struct ItemCtxt<'tcx> { tcx: TyCtxt<'tcx>, item_def_id: LocalDefId, tainted_by_errors: Cell>, @@ -148,7 +148,7 @@ impl<'v> Visitor<'v> for HirPlaceholderCollector { } } -pub struct CollectItemTypesVisitor<'tcx> { +pub(crate) struct CollectItemTypesVisitor<'tcx> { pub tcx: TyCtxt<'tcx>, } @@ -364,19 +364,19 @@ fn bad_placeholder<'cx, 'tcx>( } impl<'tcx> ItemCtxt<'tcx> { - pub fn new(tcx: TyCtxt<'tcx>, item_def_id: LocalDefId) -> ItemCtxt<'tcx> { + pub(crate) fn new(tcx: TyCtxt<'tcx>, item_def_id: LocalDefId) -> ItemCtxt<'tcx> { ItemCtxt { tcx, item_def_id, tainted_by_errors: Cell::new(None) } } - pub fn lower_ty(&self, hir_ty: &hir::Ty<'tcx>) -> Ty<'tcx> { + pub(crate) fn lower_ty(&self, hir_ty: &hir::Ty<'tcx>) -> Ty<'tcx> { self.lowerer().lower_ty(hir_ty) } - pub fn hir_id(&self) -> hir::HirId { + pub(crate) fn hir_id(&self) -> hir::HirId { self.tcx.local_def_id_to_hir_id(self.item_def_id) } - pub fn node(&self) -> hir::Node<'tcx> { + pub(crate) fn node(&self) -> hir::Node<'tcx> { self.tcx.hir_node(self.hir_id()) } diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs index bc7d4365eeef4..f77bba89d8cfe 100644 --- a/compiler/rustc_hir_analysis/src/lib.rs +++ b/compiler/rustc_hir_analysis/src/lib.rs @@ -83,12 +83,11 @@ pub mod autoderef; mod bounds; mod check_unused; mod coherence; -mod delegation; -pub mod hir_ty_lowering; -// FIXME: This module shouldn't be public. -pub mod collect; +mod collect; mod constrained_generic_params; +mod delegation; mod errors; +pub mod hir_ty_lowering; pub mod hir_wf_check; mod impl_wf_check; mod outlives; @@ -104,7 +103,8 @@ use rustc_middle::ty::{self, Const, Ty, TyCtxt}; use rustc_span::Span; use rustc_trait_selection::traits; -use self::hir_ty_lowering::{FeedConstTy, HirTyLowerer}; +pub use crate::collect::suggest_impl_trait; +use crate::hir_ty_lowering::{FeedConstTy, HirTyLowerer}; rustc_fluent_macro::fluent_messages! { "../messages.ftl" } diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs index d432199f03735..bfab2e341b0c3 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs @@ -31,12 +31,12 @@ use crate::{CoroutineTypes, Diverges, EnclosingBreakables, TypeckRootCtxt}; /// functions, closures, and `const`s, including performing type inference /// with [`InferCtxt`]. /// -/// This is in contrast to [`ItemCtxt`], which is used to type-check item *signatures* -/// and thus does not perform type inference. +/// This is in contrast to `rustc_hir_analysis::collect::ItemCtxt`], which is +/// used to type-check item *signatures* and thus does not perform type +/// inference. /// -/// See [`ItemCtxt`]'s docs for more. +/// See `ItemCtxt`'s docs for more. /// -/// [`ItemCtxt`]: rustc_hir_analysis::collect::ItemCtxt /// [`InferCtxt`]: infer::InferCtxt pub(crate) struct FnCtxt<'a, 'tcx> { pub(super) body_id: LocalDefId, diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs index aea2e0fd3a300..60f9265bfcc0d 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs @@ -12,8 +12,8 @@ use rustc_hir::{ GenericBound, HirId, Node, PatExpr, PatExprKind, Path, QPath, Stmt, StmtKind, TyKind, WherePredicateKind, expr_needs_parens, }; -use rustc_hir_analysis::collect::suggest_impl_trait; use rustc_hir_analysis::hir_ty_lowering::HirTyLowerer; +use rustc_hir_analysis::suggest_impl_trait; use rustc_middle::lint::in_external_macro; use rustc_middle::middle::stability::EvalResult; use rustc_middle::span_bug;