Skip to content

Commit caa4135

Browse files
committed
Change const to static
1 parent cb3dd21 commit caa4135

File tree

6 files changed

+43
-43
lines changed

6 files changed

+43
-43
lines changed

src/librustdoc/doc.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub struct CrateDoc {
5454
pub enum ItemTag {
5555
ModTag(ModDoc),
5656
NmodTag(NmodDoc),
57-
ConstTag(ConstDoc),
57+
StaticTag(StaticDoc),
5858
FnTag(FnDoc),
5959
EnumTag(EnumDoc),
6060
TraitTag(TraitDoc),
@@ -95,7 +95,7 @@ pub struct NmodDoc {
9595
index: Option<Index>
9696
}
9797

98-
pub type ConstDoc = SimpleItemDoc;
98+
pub type StaticDoc = SimpleItemDoc;
9999

100100
pub type FnDoc = SimpleItemDoc;
101101

@@ -214,8 +214,8 @@ impl ModDoc {
214214
md!(FnTag)
215215
}
216216

217-
pub fn consts(&self) -> ~[ConstDoc] {
218-
md!(ConstTag)
217+
pub fn statics(&self) -> ~[StaticDoc] {
218+
md!(StaticTag)
219219
}
220220

221221
pub fn enums(&self) -> ~[EnumDoc] {
@@ -249,7 +249,7 @@ pub trait PageUtils {
249249
fn mods(&self) -> ~[ModDoc];
250250
fn nmods(&self) -> ~[NmodDoc];
251251
fn fns(&self) -> ~[FnDoc];
252-
fn consts(&self) -> ~[ConstDoc];
252+
fn statics(&self) -> ~[StaticDoc];
253253
fn enums(&self) -> ~[EnumDoc];
254254
fn traits(&self) -> ~[TraitDoc];
255255
fn impls(&self) -> ~[ImplDoc];
@@ -270,8 +270,8 @@ impl PageUtils for ~[Page] {
270270
pu!(FnTag)
271271
}
272272

273-
fn consts(&self) -> ~[ConstDoc] {
274-
pu!(ConstTag)
273+
fn statics(&self) -> ~[StaticDoc] {
274+
pu!(StaticTag)
275275
}
276276

277277
fn enums(&self) -> ~[EnumDoc] {
@@ -301,7 +301,7 @@ impl Item for ItemTag {
301301
&doc::ModTag(ref doc) => doc.item.clone(),
302302
&doc::NmodTag(ref doc) => doc.item.clone(),
303303
&doc::FnTag(ref doc) => doc.item.clone(),
304-
&doc::ConstTag(ref doc) => doc.item.clone(),
304+
&doc::StaticTag(ref doc) => doc.item.clone(),
305305
&doc::EnumTag(ref doc) => doc.item.clone(),
306306
&doc::TraitTag(ref doc) => doc.item.clone(),
307307
&doc::ImplTag(ref doc) => doc.item.clone(),

src/librustdoc/extract.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ fn moddoc_from_mod(
101101
))
102102
}
103103
ast::item_static(*) => {
104-
Some(doc::ConstTag(
105-
constdoc_from_const(ItemDoc)
104+
Some(doc::StaticTag(
105+
staticdoc_from_static(ItemDoc)
106106
))
107107
}
108108
ast::item_enum(enum_definition, _) => {
@@ -165,7 +165,7 @@ fn fndoc_from_fn(itemdoc: doc::ItemDoc) -> doc::FnDoc {
165165
}
166166
}
167167

168-
fn constdoc_from_const(itemdoc: doc::ItemDoc) -> doc::ConstDoc {
168+
fn staticdoc_from_static(itemdoc: doc::ItemDoc) -> doc::StaticDoc {
169169
doc::SimpleItemDoc {
170170
item: itemdoc,
171171
sig: None
@@ -356,10 +356,10 @@ mod test {
356356
}
357357
358358
#[test]
359-
fn should_extract_const_name_and_id() {
359+
fn should_extract_static_name_and_id() {
360360
let doc = mk_doc(@"static a: int = 0;");
361-
assert!(doc.cratemod().consts()[0].id() != 0);
362-
assert!(doc.cratemod().consts()[0].name_() == ~"a");
361+
assert!(doc.cratemod().statics()[0].id() != 0);
362+
assert!(doc.cratemod().statics()[0].name_() == ~"a");
363363
}
364364
365365
#[test]

src/librustdoc/fold.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct Fold<T> {
2121
fold_mod: FoldMod<T>,
2222
fold_nmod: FoldNmod<T>,
2323
fold_fn: FoldFn<T>,
24-
fold_const: FoldConst<T>,
24+
fold_static: FoldStatic<T>,
2525
fold_enum: FoldEnum<T>,
2626
fold_trait: FoldTrait<T>,
2727
fold_impl: FoldImpl<T>,
@@ -39,7 +39,7 @@ impl<T:Clone> Clone for Fold<T> {
3939
fold_mod: self.fold_mod,
4040
fold_nmod: self.fold_nmod,
4141
fold_fn: self.fold_fn,
42-
fold_const: self.fold_const,
42+
fold_static: self.fold_static,
4343
fold_enum: self.fold_enum,
4444
fold_trait: self.fold_trait,
4545
fold_impl: self.fold_impl,
@@ -55,7 +55,7 @@ type FoldItem<T> = @fn(fold: &Fold<T>, doc: doc::ItemDoc) -> doc::ItemDoc;
5555
type FoldMod<T> = @fn(fold: &Fold<T>, doc: doc::ModDoc) -> doc::ModDoc;
5656
type FoldNmod<T> = @fn(fold: &Fold<T>, doc: doc::NmodDoc) -> doc::NmodDoc;
5757
type FoldFn<T> = @fn(fold: &Fold<T>, doc: doc::FnDoc) -> doc::FnDoc;
58-
type FoldConst<T> = @fn(fold: &Fold<T>, doc: doc::ConstDoc) -> doc::ConstDoc;
58+
type FoldStatic<T> = @fn(fold: &Fold<T>, doc: doc::StaticDoc) -> doc::StaticDoc;
5959
type FoldEnum<T> = @fn(fold: &Fold<T>, doc: doc::EnumDoc) -> doc::EnumDoc;
6060
type FoldTrait<T> = @fn(fold: &Fold<T>, doc: doc::TraitDoc) -> doc::TraitDoc;
6161
type FoldImpl<T> = @fn(fold: &Fold<T>, doc: doc::ImplDoc) -> doc::ImplDoc;
@@ -73,7 +73,7 @@ fn mk_fold<T>(
7373
fold_mod: FoldMod<T>,
7474
fold_nmod: FoldNmod<T>,
7575
fold_fn: FoldFn<T>,
76-
fold_const: FoldConst<T>,
76+
fold_static: FoldStatic<T>,
7777
fold_enum: FoldEnum<T>,
7878
fold_trait: FoldTrait<T>,
7979
fold_impl: FoldImpl<T>,
@@ -88,7 +88,7 @@ fn mk_fold<T>(
8888
fold_mod: fold_mod,
8989
fold_nmod: fold_nmod,
9090
fold_fn: fold_fn,
91-
fold_const: fold_const,
91+
fold_static: fold_static,
9292
fold_enum: fold_enum,
9393
fold_trait: fold_trait,
9494
fold_impl: fold_impl,
@@ -106,7 +106,7 @@ pub fn default_any_fold<T:Clone>(ctxt: T) -> Fold<T> {
106106
|f, d| default_any_fold_mod(f, d),
107107
|f, d| default_any_fold_nmod(f, d),
108108
|f, d| default_seq_fold_fn(f, d),
109-
|f, d| default_seq_fold_const(f, d),
109+
|f, d| default_seq_fold_static(f, d),
110110
|f, d| default_seq_fold_enum(f, d),
111111
|f, d| default_seq_fold_trait(f, d),
112112
|f, d| default_seq_fold_impl(f, d),
@@ -124,7 +124,7 @@ pub fn default_seq_fold<T:Clone>(ctxt: T) -> Fold<T> {
124124
|f, d| default_seq_fold_mod(f, d),
125125
|f, d| default_seq_fold_nmod(f, d),
126126
|f, d| default_seq_fold_fn(f, d),
127-
|f, d| default_seq_fold_const(f, d),
127+
|f, d| default_seq_fold_static(f, d),
128128
|f, d| default_seq_fold_enum(f, d),
129129
|f, d| default_seq_fold_trait(f, d),
130130
|f, d| default_seq_fold_impl(f, d),
@@ -142,7 +142,7 @@ pub fn default_par_fold<T:Clone>(ctxt: T) -> Fold<T> {
142142
|f, d| default_par_fold_mod(f, d),
143143
|f, d| default_par_fold_nmod(f, d),
144144
|f, d| default_seq_fold_fn(f, d),
145-
|f, d| default_seq_fold_const(f, d),
145+
|f, d| default_seq_fold_static(f, d),
146146
|f, d| default_seq_fold_enum(f, d),
147147
|f, d| default_seq_fold_trait(f, d),
148148
|f, d| default_seq_fold_impl(f, d),
@@ -272,8 +272,8 @@ pub fn fold_ItemTag<T>(fold: &Fold<T>, doc: doc::ItemTag) -> doc::ItemTag {
272272
doc::FnTag(FnDoc) => {
273273
doc::FnTag((fold.fold_fn)(fold, FnDoc))
274274
}
275-
doc::ConstTag(ConstDoc) => {
276-
doc::ConstTag((fold.fold_const)(fold, ConstDoc))
275+
doc::StaticTag(StaticDoc) => {
276+
doc::StaticTag((fold.fold_static)(fold, StaticDoc))
277277
}
278278
doc::EnumTag(EnumDoc) => {
279279
doc::EnumTag((fold.fold_enum)(fold, EnumDoc))
@@ -303,10 +303,10 @@ pub fn default_seq_fold_fn<T>(
303303
}
304304
}
305305

306-
pub fn default_seq_fold_const<T>(
306+
pub fn default_seq_fold_static<T>(
307307
fold: &Fold<T>,
308-
doc: doc::ConstDoc
309-
) -> doc::ConstDoc {
308+
doc: doc::StaticDoc
309+
) -> doc::StaticDoc {
310310
doc::SimpleItemDoc {
311311
item: (fold.fold_item)(fold, doc.item.clone()),
312312
.. doc
@@ -374,7 +374,7 @@ fn default_fold_should_produce_same_doc() {
374374
}
375375

376376
#[test]
377-
fn default_fold_should_produce_same_consts() {
377+
fn default_fold_should_produce_same_statics() {
378378
let source = @"static a: int = 0;";
379379
let ast = parse::from_str(source);
380380
let doc = extract::extract(ast, ~"");

src/librustdoc/markdown_pass.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ fn write_item_(ctxt: &Ctxt, doc: doc::ItemTag, write_header: bool) {
321321
doc::ModTag(ModDoc) => write_mod(ctxt, ModDoc),
322322
doc::NmodTag(nModDoc) => write_nmod(ctxt, nModDoc),
323323
doc::FnTag(FnDoc) => write_fn(ctxt, FnDoc),
324-
doc::ConstTag(ConstDoc) => write_const(ctxt, ConstDoc),
324+
doc::StaticTag(StaticDoc) => write_static(ctxt, StaticDoc),
325325
doc::EnumTag(EnumDoc) => write_enum(ctxt, EnumDoc),
326326
doc::TraitTag(TraitDoc) => write_trait(ctxt, TraitDoc),
327327
doc::ImplTag(ImplDoc) => write_impl(ctxt, ImplDoc),
@@ -409,9 +409,9 @@ fn code_block(s: ~str) -> ~str {
409409
~~~", s)
410410
}
411411

412-
fn write_const(
412+
fn write_static(
413413
ctxt: &Ctxt,
414-
doc: doc::ConstDoc
414+
doc: doc::StaticDoc
415415
) {
416416
write_sig(ctxt, doc.sig.clone());
417417
write_common(ctxt, doc.desc(), doc.sections());
@@ -775,13 +775,13 @@ mod test {
775775
}
776776

777777
#[test]
778-
fn should_write_const_header() {
778+
fn should_write_static_header() {
779779
let markdown = render(~"static a: bool = true;");
780780
assert!(markdown.contains("## Static `a`\n\n"));
781781
}
782782

783783
#[test]
784-
fn should_write_const_description() {
784+
fn should_write_static_description() {
785785
let markdown = render(
786786
~"#[doc = \"b\"]\
787787
static a: bool = true;");

src/librustdoc/sort_item_type_pass.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn mk_pass() -> Pass {
1818
fn by_score(item1: &doc::ItemTag, item2: &doc::ItemTag) -> bool {
1919
fn score(item: &doc::ItemTag) -> int {
2020
match *item {
21-
doc::ConstTag(_) => 0,
21+
doc::StaticTag(_) => 0,
2222
doc::TyTag(_) => 1,
2323
doc::EnumTag(_) => 2,
2424
doc::StructTag(_) => 3,
@@ -43,7 +43,7 @@ fn test() {
4343

4444
let source =
4545
~"mod imod { } \
46-
static iconst: int = 0; \
46+
static istatic: int = 0; \
4747
fn ifn() { } \
4848
enum ienum { ivar } \
4949
trait itrait { fn a(); } \
@@ -54,7 +54,7 @@ fn test() {
5454
let doc = extract::from_srv(srv.clone(), ~"");
5555
let doc = (mk_pass().f)(srv.clone(), doc);
5656
// hidden __std_macros module at the start.
57-
assert_eq!(doc.cratemod().items[0].name_(), ~"iconst");
57+
assert_eq!(doc.cratemod().items[0].name_(), ~"istatic");
5858
assert_eq!(doc.cratemod().items[1].name_(), ~"itype");
5959
assert_eq!(doc.cratemod().items[2].name_(), ~"ienum");
6060
assert_eq!(doc.cratemod().items[3].name_(), ~"istruct");

src/librustdoc/tystr_pass.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub fn run(
3939
let fold = Fold {
4040
ctxt: srv.clone(),
4141
fold_fn: fold_fn,
42-
fold_const: fold_const,
42+
fold_static: fold_static,
4343
fold_enum: fold_enum,
4444
fold_trait: fold_trait,
4545
fold_impl: fold_impl,
@@ -93,10 +93,10 @@ fn get_fn_sig(srv: astsrv::Srv, fn_id: doc::AstId) -> Option<~str> {
9393
}
9494
}
9595

96-
fn fold_const(
96+
fn fold_static(
9797
fold: &fold::Fold<astsrv::Srv>,
98-
doc: doc::ConstDoc
99-
) -> doc::ConstDoc {
98+
doc: doc::StaticDoc
99+
) -> doc::StaticDoc {
100100
let srv = fold.ctxt.clone();
101101

102102
doc::SimpleItemDoc {
@@ -109,7 +109,7 @@ fn fold_const(
109109
}, _) => {
110110
pprust::ty_to_str(ty, extract::interner())
111111
}
112-
_ => fail!("fold_const: id not bound to a const item")
112+
_ => fail!("fold_static: id not bound to a static item")
113113
}
114114
}}),
115115
.. doc
@@ -384,9 +384,9 @@ mod test {
384384
}
385385
386386
#[test]
387-
fn should_add_const_types() {
387+
fn should_add_static_types() {
388388
let doc = mk_doc(~"static a: bool = true;");
389-
assert!(doc.cratemod().consts()[0].sig == Some(~"bool"));
389+
assert!(doc.cratemod().statics()[0].sig == Some(~"bool"));
390390
}
391391
392392
#[test]

0 commit comments

Comments
 (0)