Skip to content

Commit

Permalink
Rollup merge of #79061 - jyn514:no-pub, r=GuillaumeGomez
Browse files Browse the repository at this point in the history
Make all rustdoc functions and structs crate-private

This gives warnings when code is no longer used, which will be helpful when #77820 and #78082 land.

AFAIK no one is using this API.

r? ``@GuillaumeGomez``
cc ``@rust-lang/rustdoc``
  • Loading branch information
m-ou-se committed Nov 16, 2020
2 parents 835faa5 + 9b84c91 commit c3da682
Show file tree
Hide file tree
Showing 50 changed files with 908 additions and 909 deletions.
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

0 comments on commit c3da682

Please sign in to comment.