Skip to content

Commit ec6f983

Browse files
varkoryodaldevoid
andcommitted
Rename typarams to param_names
Co-Authored-By: Gabriel Smith <[email protected]>
1 parent 0f88167 commit ec6f983

File tree

6 files changed

+37
-37
lines changed

6 files changed

+37
-37
lines changed

src/librustc/hir/print.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -591,12 +591,12 @@ impl<'a> State<'a> {
591591
self.s.word(";")?;
592592
self.end()?; // end the outer cbox
593593
}
594-
hir::ItemKind::Fn(ref decl, header, ref typarams, body) => {
594+
hir::ItemKind::Fn(ref decl, header, ref param_names, body) => {
595595
self.head("")?;
596596
self.print_fn(decl,
597597
header,
598598
Some(item.ident.name),
599-
typarams,
599+
param_names,
600600
&item.vis,
601601
&[],
602602
Some(body))?;

src/librustdoc/clean/auto_trait.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
435435
let new_ty = match &poly_trait.trait_ {
436436
&Type::ResolvedPath {
437437
ref path,
438-
ref typarams,
438+
ref param_names,
439439
ref did,
440440
ref is_generic,
441441
} => {
@@ -469,7 +469,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
469469

470470
Type::ResolvedPath {
471471
path: new_path,
472-
typarams: typarams.clone(),
472+
param_names: param_names.clone(),
473473
did: did.clone(),
474474
is_generic: *is_generic,
475475
}
@@ -669,7 +669,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
669669
match **trait_ {
670670
Type::ResolvedPath {
671671
path: ref trait_path,
672-
ref typarams,
672+
ref param_names,
673673
ref did,
674674
ref is_generic,
675675
} => {
@@ -724,7 +724,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
724724
PolyTrait {
725725
trait_: Type::ResolvedPath {
726726
path: new_trait_path,
727-
typarams: typarams.clone(),
727+
param_names: param_names.clone(),
728728
did: did.clone(),
729729
is_generic: *is_generic,
730730
},

src/librustdoc/clean/mod.rs

+16-16
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ impl<'a, 'tcx> Clean<GenericBound> for (&'a ty::TraitRef<'tcx>, Vec<TypeBinding>
11761176
PolyTrait {
11771177
trait_: ResolvedPath {
11781178
path,
1179-
typarams: None,
1179+
param_names: None,
11801180
did: trait_ref.def_id,
11811181
is_generic: false,
11821182
},
@@ -2244,7 +2244,7 @@ pub enum Type {
22442244
/// Structs/enums/traits (most that'd be an `hir::TyKind::Path`).
22452245
ResolvedPath {
22462246
path: Path,
2247-
typarams: Option<Vec<GenericBound>>,
2247+
param_names: Option<Vec<GenericBound>>,
22482248
did: DefId,
22492249
/// `true` if is a `T::Name` path for associated types.
22502250
is_generic: bool,
@@ -2706,15 +2706,15 @@ impl Clean<Type> for hir::Ty {
27062706
}
27072707
TyKind::TraitObject(ref bounds, ref lifetime) => {
27082708
match bounds[0].clean(cx).trait_ {
2709-
ResolvedPath { path, typarams: None, did, is_generic } => {
2709+
ResolvedPath { path, param_names: None, did, is_generic } => {
27102710
let mut bounds: Vec<self::GenericBound> = bounds[1..].iter().map(|bound| {
27112711
self::GenericBound::TraitBound(bound.clean(cx),
27122712
hir::TraitBoundModifier::None)
27132713
}).collect();
27142714
if !lifetime.is_elided() {
27152715
bounds.push(self::GenericBound::Outlives(lifetime.clean(cx)));
27162716
}
2717-
ResolvedPath { path, typarams: Some(bounds), did, is_generic, }
2717+
ResolvedPath { path, param_names: Some(bounds), did, is_generic, }
27182718
}
27192719
_ => Infer // shouldn't happen
27202720
}
@@ -2781,7 +2781,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
27812781
None, false, vec![], substs);
27822782
ResolvedPath {
27832783
path,
2784-
typarams: None,
2784+
param_names: None,
27852785
did,
27862786
is_generic: false,
27872787
}
@@ -2792,7 +2792,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
27922792
None, false, vec![], InternalSubsts::empty());
27932793
ResolvedPath {
27942794
path: path,
2795-
typarams: None,
2795+
param_names: None,
27962796
did: did,
27972797
is_generic: false,
27982798
}
@@ -2813,8 +2813,8 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
28132813

28142814
inline::record_extern_fqn(cx, did, TypeKind::Trait);
28152815

2816-
let mut typarams = vec![];
2817-
reg.clean(cx).map(|b| typarams.push(GenericBound::Outlives(b)));
2816+
let mut param_names = vec![];
2817+
reg.clean(cx).map(|b| param_names.push(GenericBound::Outlives(b)));
28182818
for did in dids {
28192819
let empty = cx.tcx.intern_substs(&[]);
28202820
let path = external_path(cx, &cx.tcx.item_name(did).as_str(),
@@ -2823,13 +2823,13 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
28232823
let bound = GenericBound::TraitBound(PolyTrait {
28242824
trait_: ResolvedPath {
28252825
path,
2826-
typarams: None,
2826+
param_names: None,
28272827
did,
28282828
is_generic: false,
28292829
},
28302830
generic_params: Vec::new(),
28312831
}, hir::TraitBoundModifier::None);
2832-
typarams.push(bound);
2832+
param_names.push(bound);
28332833
}
28342834

28352835
let mut bindings = vec![];
@@ -2844,7 +2844,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
28442844
false, bindings, substs);
28452845
ResolvedPath {
28462846
path,
2847-
typarams: Some(typarams),
2847+
param_names: Some(param_names),
28482848
did,
28492849
is_generic: false,
28502850
}
@@ -3294,8 +3294,8 @@ impl Clean<PathSegment> for hir::PathSegment {
32943294

32953295
fn strip_type(ty: Type) -> Type {
32963296
match ty {
3297-
Type::ResolvedPath { path, typarams, did, is_generic } => {
3298-
Type::ResolvedPath { path: strip_path(&path), typarams, did, is_generic }
3297+
Type::ResolvedPath { path, param_names, did, is_generic } => {
3298+
Type::ResolvedPath { path: strip_path(&path), param_names, did, is_generic }
32993299
}
33003300
Type::Tuple(inner_tys) => {
33013301
Type::Tuple(inner_tys.iter().map(|t| strip_type(t.clone())).collect())
@@ -3955,7 +3955,7 @@ fn resolve_type(cx: &DocContext<'_>,
39553955
_ => false,
39563956
};
39573957
let did = register_def(&*cx, path.def);
3958-
ResolvedPath { path: path, typarams: None, did: did, is_generic: is_generic }
3958+
ResolvedPath { path: path, param_names: None, did: did, is_generic: is_generic }
39593959
}
39603960

39613961
pub fn register_def(cx: &DocContext<'_>, def: Def) -> DefId {
@@ -4381,9 +4381,9 @@ impl From<GenericBound> for SimpleBound {
43814381
match bound.clone() {
43824382
GenericBound::Outlives(l) => SimpleBound::Outlives(l),
43834383
GenericBound::TraitBound(t, mod_) => match t.trait_ {
4384-
Type::ResolvedPath { path, typarams, .. } => {
4384+
Type::ResolvedPath { path, param_names, .. } => {
43854385
SimpleBound::TraitBound(path.segments,
4386-
typarams
4386+
param_names
43874387
.map_or_else(|| Vec::new(), |v| v.iter()
43884388
.map(|p| SimpleBound::from(p.clone()))
43894389
.collect()),

src/librustdoc/html/format.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -521,8 +521,8 @@ fn primitive_link(f: &mut fmt::Formatter<'_>,
521521

522522
/// Helper to render type parameters
523523
fn tybounds(w: &mut fmt::Formatter<'_>,
524-
typarams: &Option<Vec<clean::GenericBound>>) -> fmt::Result {
525-
match *typarams {
524+
param_names: &Option<Vec<clean::GenericBound>>) -> fmt::Result {
525+
match *param_names {
526526
Some(ref params) => {
527527
for param in params {
528528
write!(w, " + ")?;
@@ -559,13 +559,13 @@ fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter<'_>, use_absolute: bool) ->
559559
clean::Generic(ref name) => {
560560
f.write_str(name)
561561
}
562-
clean::ResolvedPath{ did, ref typarams, ref path, is_generic } => {
563-
if typarams.is_some() {
562+
clean::ResolvedPath{ did, ref param_names, ref path, is_generic } => {
563+
if param_names.is_some() {
564564
f.write_str("dyn ")?;
565565
}
566566
// Paths like T::Output and Self::Output should be rendered with all segments
567567
resolved_path(f, did, path, is_generic, use_absolute)?;
568-
tybounds(f, typarams)
568+
tybounds(f, param_names)
569569
}
570570
clean::Infer => write!(f, "_"),
571571
clean::Primitive(prim) => primitive_link(f, prim, prim.as_str()),
@@ -663,7 +663,7 @@ fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter<'_>, use_absolute: bool) ->
663663
}
664664
}
665665
}
666-
clean::ResolvedPath { typarams: Some(ref v), .. } if !v.is_empty() => {
666+
clean::ResolvedPath { param_names: Some(ref v), .. } if !v.is_empty() => {
667667
write!(f, "{}{}{}(", amp, lt, m)?;
668668
fmt_type(&ty, f, use_absolute)?;
669669
write!(f, ")")
@@ -717,7 +717,7 @@ fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter<'_>, use_absolute: bool) ->
717717
// the ugliness comes from inlining across crates where
718718
// everything comes in as a fully resolved QPath (hard to
719719
// look at).
720-
box clean::ResolvedPath { did, ref typarams, .. } => {
720+
box clean::ResolvedPath { did, ref param_names, .. } => {
721721
match href(did) {
722722
Some((ref url, _, ref path)) if !f.alternate() => {
723723
write!(f,
@@ -731,8 +731,8 @@ fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter<'_>, use_absolute: bool) ->
731731
_ => write!(f, "{}", name)?,
732732
}
733733

734-
// FIXME: `typarams` are not rendered, and this seems bad?
735-
drop(typarams);
734+
// FIXME: `param_names` are not rendered, and this seems bad?
735+
drop(param_names);
736736
Ok(())
737737
}
738738
_ => {
@@ -771,7 +771,7 @@ fn fmt_impl(i: &clean::Impl,
771771
fmt::Display::fmt(ty, f)?;
772772
} else {
773773
match *ty {
774-
clean::ResolvedPath { typarams: None, ref path, is_generic: false, .. } => {
774+
clean::ResolvedPath { param_names: None, ref path, is_generic: false, .. } => {
775775
let last = path.segments.last().unwrap();
776776
fmt::Display::fmt(&last.name, f)?;
777777
fmt::Display::fmt(&last.args, f)?;

src/librustdoc/html/render.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ pub struct Cache {
271271
/// Mapping of typaram ids to the name of the type parameter. This is used
272272
/// when pretty-printing a type (so pretty-printing doesn't have to
273273
/// painfully maintain a context like this)
274-
pub typarams: FxHashMap<DefId, String>,
274+
pub param_names: FxHashMap<DefId, String>,
275275

276276
/// Maps a type ID to all known implementations for that type. This is only
277277
/// recognized for intra-crate `ResolvedPath` types, and is used to print
@@ -635,7 +635,7 @@ pub fn run(mut krate: clean::Crate,
635635
deref_mut_trait_did,
636636
owned_box_did,
637637
masked_crates: mem::replace(&mut krate.masked_crates, Default::default()),
638-
typarams: external_typarams,
638+
param_names: external_param_names,
639639
aliases: Default::default(),
640640
};
641641

@@ -1751,7 +1751,7 @@ impl<'a> Cache {
17511751
clean::GenericParamDefKind::Lifetime => {}
17521752
clean::GenericParamDefKind::Type { did, .. } |
17531753
clean::GenericParamDefKind::Const { did, .. } => {
1754-
self.typarams.insert(did, param.name.clone());
1754+
self.param_names.insert(did, param.name.clone());
17551755
}
17561756
}
17571757
}

src/libsyntax/print/pprust.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1263,13 +1263,13 @@ impl<'a> State<'a> {
12631263
self.s.word(";")?;
12641264
self.end()?; // end the outer cbox
12651265
}
1266-
ast::ItemKind::Fn(ref decl, header, ref typarams, ref body) => {
1266+
ast::ItemKind::Fn(ref decl, header, ref param_names, ref body) => {
12671267
self.head("")?;
12681268
self.print_fn(
12691269
decl,
12701270
header,
12711271
Some(item.ident),
1272-
typarams,
1272+
param_names,
12731273
&item.vis
12741274
)?;
12751275
self.s.word(" ")?;

0 commit comments

Comments
 (0)