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

Make all rustdoc functions and structs crate-private #79061

Merged
merged 4 commits into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 5 additions & 5 deletions src/librustdoc/clean/auto_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ struct RegionDeps<'tcx> {
smaller: FxHashSet<RegionTarget<'tcx>>,
}

pub struct AutoTraitFinder<'a, 'tcx> {
pub cx: &'a core::DocContext<'tcx>,
pub f: auto_trait::AutoTraitFinder<'tcx>,
crate struct AutoTraitFinder<'a, 'tcx> {
crate cx: &'a core::DocContext<'tcx>,
crate f: auto_trait::AutoTraitFinder<'tcx>,
}

impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
pub fn new(cx: &'a core::DocContext<'tcx>) -> Self {
crate fn new(cx: &'a core::DocContext<'tcx>) -> Self {
let f = auto_trait::AutoTraitFinder::new(cx.tcx);

AutoTraitFinder { cx, f }
}

// FIXME(eddyb) figure out a better way to pass information about
// parametrization of `ty` than `param_env_def_id`.
pub fn get_auto_trait_impls(&self, ty: Ty<'tcx>, param_env_def_id: DefId) -> Vec<Item> {
crate fn get_auto_trait_impls(&self, ty: Ty<'tcx>, param_env_def_id: DefId) -> Vec<Item> {
let param_env = self.cx.tcx.param_env(param_env_def_id);

debug!("get_auto_trait_impls({:?})", ty);
Expand Down
8 changes: 4 additions & 4 deletions src/librustdoc/clean/blanket_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ use rustc_span::DUMMY_SP;

use super::*;

pub struct BlanketImplFinder<'a, 'tcx> {
pub cx: &'a core::DocContext<'tcx>,
crate struct BlanketImplFinder<'a, 'tcx> {
crate cx: &'a core::DocContext<'tcx>,
}

impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
pub fn new(cx: &'a core::DocContext<'tcx>) -> Self {
crate fn new(cx: &'a core::DocContext<'tcx>) -> Self {
BlanketImplFinder { cx }
}

// FIXME(eddyb) figure out a better way to pass information about
// parametrization of `ty` than `param_env_def_id`.
pub fn get_blanket_impls(&self, ty: Ty<'tcx>, param_env_def_id: DefId) -> Vec<Item> {
crate fn get_blanket_impls(&self, ty: Ty<'tcx>, param_env_def_id: DefId) -> Vec<Item> {
let param_env = self.cx.tcx.param_env(param_env_def_id);

debug!("get_blanket_impls({:?})", ty);
Expand Down
12 changes: 6 additions & 6 deletions src/librustdoc/clean/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::html::escape::Escape;
mod tests;

#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum Cfg {
crate enum Cfg {
/// Accepts all configurations.
True,
/// Denies all configurations.
Expand All @@ -36,9 +36,9 @@ pub enum Cfg {
}

#[derive(PartialEq, Debug)]
pub struct InvalidCfgError {
pub msg: &'static str,
pub span: Span,
crate struct InvalidCfgError {
crate msg: &'static str,
crate span: Span,
}

impl Cfg {
Expand All @@ -59,7 +59,7 @@ impl Cfg {
///
/// If the content is not properly formatted, it will return an error indicating what and where
/// the error is.
pub fn parse(cfg: &MetaItem) -> Result<Cfg, InvalidCfgError> {
crate fn parse(cfg: &MetaItem) -> Result<Cfg, InvalidCfgError> {
let name = match cfg.ident() {
Some(ident) => ident.name,
None => {
Expand Down Expand Up @@ -102,7 +102,7 @@ impl Cfg {
///
/// Equivalent to `attr::cfg_matches`.
// FIXME: Actually make use of `features`.
pub fn matches(&self, parse_sess: &ParseSess, features: Option<&Features>) -> bool {
crate fn matches(&self, parse_sess: &ParseSess, features: Option<&Features>) -> bool {
match *self {
Cfg::False => false,
Cfg::True => true,
Expand Down
24 changes: 12 additions & 12 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

mod auto_trait;
mod blanket_impl;
pub mod cfg;
pub mod inline;
crate mod cfg;
crate mod inline;
mod simplify;
pub mod types;
pub mod utils;
crate mod types;
crate mod utils;

use rustc_ast as ast;
use rustc_attr as attr;
Expand Down Expand Up @@ -39,18 +39,18 @@ use crate::doctree;

use utils::*;

pub use utils::{get_auto_trait_and_blanket_impls, krate, register_res};
crate use utils::{get_auto_trait_and_blanket_impls, krate, register_res};

pub use self::types::FnRetTy::*;
pub use self::types::ItemKind::*;
pub use self::types::SelfTy::*;
pub use self::types::Type::*;
pub use self::types::Visibility::{Inherited, Public};
pub use self::types::*;
crate use self::types::FnRetTy::*;
crate use self::types::ItemKind::*;
crate use self::types::SelfTy::*;
crate use self::types::Type::*;
crate use self::types::Visibility::{Inherited, Public};
crate use self::types::*;

const FN_OUTPUT_NAME: &str = "Output";

pub trait Clean<T> {
crate trait Clean<T> {
fn clean(&self, cx: &DocContext<'_>) -> T;
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/clean/simplify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::clean::GenericArgs as PP;
use crate::clean::WherePredicate as WP;
use crate::core::DocContext;

pub fn where_clauses(cx: &DocContext<'_>, clauses: Vec<WP>) -> Vec<WP> {
crate fn where_clauses(cx: &DocContext<'_>, clauses: Vec<WP>) -> Vec<WP> {
// First, partition the where clause into its separate components
let mut params: BTreeMap<_, Vec<_>> = BTreeMap::new();
let mut lifetimes = Vec::new();
Expand Down Expand Up @@ -74,7 +74,7 @@ pub fn where_clauses(cx: &DocContext<'_>, clauses: Vec<WP>) -> Vec<WP> {
clauses
}

pub fn merge_bounds(
crate fn merge_bounds(
cx: &clean::DocContext<'_>,
bounds: &mut Vec<clean::GenericBound>,
trait_did: DefId,
Expand Down
Loading