Skip to content

Commit c3da682

Browse files
authored
Rollup merge of rust-lang#79061 - jyn514:no-pub, r=GuillaumeGomez
Make all rustdoc functions and structs crate-private This gives warnings when code is no longer used, which will be helpful when rust-lang#77820 and rust-lang#78082 land. AFAIK no one is using this API. r? ``@GuillaumeGomez`` cc ``@rust-lang/rustdoc``
2 parents 835faa5 + 9b84c91 commit c3da682

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+908
-909
lines changed

src/librustdoc/clean/auto_trait.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ struct RegionDeps<'tcx> {
2020
smaller: FxHashSet<RegionTarget<'tcx>>,
2121
}
2222

23-
pub struct AutoTraitFinder<'a, 'tcx> {
24-
pub cx: &'a core::DocContext<'tcx>,
25-
pub f: auto_trait::AutoTraitFinder<'tcx>,
23+
crate struct AutoTraitFinder<'a, 'tcx> {
24+
crate cx: &'a core::DocContext<'tcx>,
25+
crate f: auto_trait::AutoTraitFinder<'tcx>,
2626
}
2727

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

3232
AutoTraitFinder { cx, f }
3333
}
3434

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

4040
debug!("get_auto_trait_impls({:?})", ty);

src/librustdoc/clean/blanket_impl.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ use rustc_span::DUMMY_SP;
99

1010
use super::*;
1111

12-
pub struct BlanketImplFinder<'a, 'tcx> {
13-
pub cx: &'a core::DocContext<'tcx>,
12+
crate struct BlanketImplFinder<'a, 'tcx> {
13+
crate cx: &'a core::DocContext<'tcx>,
1414
}
1515

1616
impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
17-
pub fn new(cx: &'a core::DocContext<'tcx>) -> Self {
17+
crate fn new(cx: &'a core::DocContext<'tcx>) -> Self {
1818
BlanketImplFinder { cx }
1919
}
2020

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

2626
debug!("get_blanket_impls({:?})", ty);

src/librustdoc/clean/cfg.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use crate::html::escape::Escape;
2020
mod tests;
2121

2222
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
23-
pub enum Cfg {
23+
crate enum Cfg {
2424
/// Accepts all configurations.
2525
True,
2626
/// Denies all configurations.
@@ -36,9 +36,9 @@ pub enum Cfg {
3636
}
3737

3838
#[derive(PartialEq, Debug)]
39-
pub struct InvalidCfgError {
40-
pub msg: &'static str,
41-
pub span: Span,
39+
crate struct InvalidCfgError {
40+
crate msg: &'static str,
41+
crate span: Span,
4242
}
4343

4444
impl Cfg {
@@ -59,7 +59,7 @@ impl Cfg {
5959
///
6060
/// If the content is not properly formatted, it will return an error indicating what and where
6161
/// the error is.
62-
pub fn parse(cfg: &MetaItem) -> Result<Cfg, InvalidCfgError> {
62+
crate fn parse(cfg: &MetaItem) -> Result<Cfg, InvalidCfgError> {
6363
let name = match cfg.ident() {
6464
Some(ident) => ident.name,
6565
None => {
@@ -102,7 +102,7 @@ impl Cfg {
102102
///
103103
/// Equivalent to `attr::cfg_matches`.
104104
// FIXME: Actually make use of `features`.
105-
pub fn matches(&self, parse_sess: &ParseSess, features: Option<&Features>) -> bool {
105+
crate fn matches(&self, parse_sess: &ParseSess, features: Option<&Features>) -> bool {
106106
match *self {
107107
Cfg::False => false,
108108
Cfg::True => true,

src/librustdoc/clean/mod.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
44
mod auto_trait;
55
mod blanket_impl;
6-
pub mod cfg;
7-
pub mod inline;
6+
crate mod cfg;
7+
crate mod inline;
88
mod simplify;
9-
pub mod types;
10-
pub mod utils;
9+
crate mod types;
10+
crate mod utils;
1111

1212
use rustc_ast as ast;
1313
use rustc_attr as attr;
@@ -39,18 +39,18 @@ use crate::doctree;
3939

4040
use utils::*;
4141

42-
pub use utils::{get_auto_trait_and_blanket_impls, krate, register_res};
42+
crate use utils::{get_auto_trait_and_blanket_impls, krate, register_res};
4343

44-
pub use self::types::FnRetTy::*;
45-
pub use self::types::ItemKind::*;
46-
pub use self::types::SelfTy::*;
47-
pub use self::types::Type::*;
48-
pub use self::types::Visibility::{Inherited, Public};
49-
pub use self::types::*;
44+
crate use self::types::FnRetTy::*;
45+
crate use self::types::ItemKind::*;
46+
crate use self::types::SelfTy::*;
47+
crate use self::types::Type::*;
48+
crate use self::types::Visibility::{Inherited, Public};
49+
crate use self::types::*;
5050

5151
const FN_OUTPUT_NAME: &str = "Output";
5252

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

src/librustdoc/clean/simplify.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::clean::GenericArgs as PP;
2121
use crate::clean::WherePredicate as WP;
2222
use crate::core::DocContext;
2323

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

77-
pub fn merge_bounds(
77+
crate fn merge_bounds(
7878
cx: &clean::DocContext<'_>,
7979
bounds: &mut Vec<clean::GenericBound>,
8080
trait_did: DefId,

0 commit comments

Comments
 (0)