Skip to content

Commit be01416

Browse files
Dretchbrson
authored andcommitted
convert doc-attributes to doc-comments using ./src/etc/sugarise-doc-comments.py (and manually tweaking) - for issue #2498
1 parent bfa43ca commit be01416

Some content is hidden

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

123 files changed

+4983
-5046
lines changed

src/libcore/arc.rs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
#[doc = "An atomically reference counted wrapper that can be used to
2-
share immutable data between tasks."]
1+
/**
2+
* An atomically reference counted wrapper that can be used to
3+
* share immutable data between tasks.
4+
*/
35

46
import comm::{port, chan, methods};
57
import sys::methods;
@@ -41,7 +43,7 @@ class arc_destruct<T> {
4143

4244
type arc<T: const> = arc_destruct<T>;
4345

44-
#[doc="Create an atomically reference counted wrapper."]
46+
/// Create an atomically reference counted wrapper.
4547
fn arc<T: const>(-data: T) -> arc<T> {
4648
let data = ~{mut count: 1, data: data};
4749
unsafe {
@@ -50,8 +52,10 @@ fn arc<T: const>(-data: T) -> arc<T> {
5052
}
5153
}
5254

53-
#[doc="Access the underlying data in an atomically reference counted
54-
wrapper."]
55+
/**
56+
* Access the underlying data in an atomically reference counted
57+
* wrapper.
58+
*/
5559
fn get<T: const>(rc: &a.arc<T>) -> &a.T {
5660
unsafe {
5761
let ptr: ~arc_data<T> = unsafe::reinterpret_cast((*rc).data);
@@ -62,11 +66,13 @@ fn get<T: const>(rc: &a.arc<T>) -> &a.T {
6266
}
6367
}
6468

65-
#[doc="Duplicate an atomically reference counted wrapper.
66-
67-
The resulting two `arc` objects will point to the same underlying data
68-
object. However, one of the `arc` objects can be sent to another task,
69-
allowing them to share the underlying data."]
69+
/**
70+
* Duplicate an atomically reference counted wrapper.
71+
*
72+
* The resulting two `arc` objects will point to the same underlying data
73+
* object. However, one of the `arc` objects can be sent to another task,
74+
* allowing them to share the underlying data.
75+
*/
7076
fn clone<T: const>(rc: &arc<T>) -> arc<T> {
7177
unsafe {
7278
let ptr: ~arc_data<T> = unsafe::reinterpret_cast((*rc).data);

src/libcore/bool.rs

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,43 @@
11
// -*- rust -*-
22

3-
#[doc = "Boolean logic"];
3+
//! Boolean logic
44
55
export not, and, or, xor, implies;
66
export eq, ne, is_true, is_false;
77
export from_str, to_str, all_values, to_bit;
88

9-
#[doc = "Negation / inverse"]
9+
/// Negation / inverse
1010
pure fn not(v: bool) -> bool { !v }
1111

12-
#[doc = "Conjunction"]
12+
/// Conjunction
1313
pure fn and(a: bool, b: bool) -> bool { a && b }
1414

15-
#[doc = "Disjunction"]
15+
/// Disjunction
1616
pure fn or(a: bool, b: bool) -> bool { a || b }
1717

18-
#[doc = "
19-
Exclusive or
20-
21-
Identical to `or(and(a, not(b)), and(not(a), b))`
22-
"]
18+
/**
19+
* Exclusive or
20+
*
21+
* Identical to `or(and(a, not(b)), and(not(a), b))`
22+
*/
2323
pure fn xor(a: bool, b: bool) -> bool { (a && !b) || (!a && b) }
2424

25-
#[doc = "Implication in the logic, i.e. from `a` follows `b`"]
25+
/// Implication in the logic, i.e. from `a` follows `b`
2626
pure fn implies(a: bool, b: bool) -> bool { !a || b }
2727

28-
#[doc = "
29-
true if truth values `a` and `b` are indistinguishable in the logic
30-
"]
28+
/// true if truth values `a` and `b` are indistinguishable in the logic
3129
pure fn eq(a: bool, b: bool) -> bool { a == b }
3230

33-
#[doc = "true if truth values `a` and `b` are distinguishable in the logic"]
31+
/// true if truth values `a` and `b` are distinguishable in the logic
3432
pure fn ne(a: bool, b: bool) -> bool { a != b }
3533

36-
#[doc = "true if `v` represents truth in the logic"]
34+
/// true if `v` represents truth in the logic
3735
pure fn is_true(v: bool) -> bool { v }
3836

39-
#[doc = "true if `v` represents falsehood in the logic"]
37+
/// true if `v` represents falsehood in the logic
4038
pure fn is_false(v: bool) -> bool { !v }
4139

42-
#[doc = "Parse logic value from `s`"]
40+
/// Parse logic value from `s`
4341
pure fn from_str(s: str) -> option<bool> {
4442
alt check s {
4543
"true" { some(true) }
@@ -48,19 +46,19 @@ pure fn from_str(s: str) -> option<bool> {
4846
}
4947
}
5048

51-
#[doc = "Convert `v` into a string"]
49+
/// Convert `v` into a string
5250
pure fn to_str(v: bool) -> str { if v { "true" } else { "false" } }
5351

54-
#[doc = "
55-
Iterates over all truth values by passing them to `blk` in an unspecified
56-
order
57-
"]
52+
/**
53+
* Iterates over all truth values by passing them to `blk` in an unspecified
54+
* order
55+
*/
5856
fn all_values(blk: fn(v: bool)) {
5957
blk(true);
6058
blk(false);
6159
}
6260

63-
#[doc = "converts truth value to an 8 bit byte"]
61+
/// converts truth value to an 8 bit byte
6462
pure fn to_bit(v: bool) -> u8 { if v { 1u8 } else { 0u8 } }
6563

6664
#[test]

src/libcore/box.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
#[doc = "Operations on shared box types"];
1+
//! Operations on shared box types
22
33
export ptr_eq;
44

55
pure fn ptr_eq<T>(a: @T, b: @T) -> bool {
6-
#[doc = "Determine if two shared boxes point to the same object"];
6+
//! Determine if two shared boxes point to the same object
77
unsafe { ptr::addr_of(*a) == ptr::addr_of(*b) }
88
}
99

src/libcore/char.rs

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#[doc = "Utilities for manipulating the char type"];
1+
//! Utilities for manipulating the char type
22
33
/*
44
Lu Uppercase_Letter an uppercase letter
@@ -46,72 +46,72 @@ import is_XID_start = unicode::derived_property::XID_Start;
4646
import is_XID_continue = unicode::derived_property::XID_Continue;
4747

4848

49-
#[doc = "
50-
Indicates whether a character is in lower case, defined
51-
in terms of the Unicode General Category 'Ll'
52-
"]
49+
/**
50+
* Indicates whether a character is in lower case, defined
51+
* in terms of the Unicode General Category 'Ll'
52+
*/
5353
pure fn is_lowercase(c: char) -> bool {
5454
ret unicode::general_category::Ll(c);
5555
}
5656

57-
#[doc = "
58-
Indicates whether a character is in upper case, defined
59-
in terms of the Unicode General Category 'Lu'.
60-
"]
57+
/**
58+
* Indicates whether a character is in upper case, defined
59+
* in terms of the Unicode General Category 'Lu'.
60+
*/
6161
pure fn is_uppercase(c: char) -> bool {
6262
ret unicode::general_category::Lu(c);
6363
}
6464

65-
#[doc = "
66-
Indicates whether a character is whitespace, defined in
67-
terms of the Unicode General Categories 'Zs', 'Zl', 'Zp'
68-
additional 'Cc'-category control codes in the range [0x09, 0x0d]/~
69-
"]
65+
/**
66+
* Indicates whether a character is whitespace, defined in
67+
* terms of the Unicode General Categories 'Zs', 'Zl', 'Zp'
68+
* additional 'Cc'-category control codes in the range [0x09, 0x0d]
69+
*/
7070
pure fn is_whitespace(c: char) -> bool {
7171
ret ('\x09' <= c && c <= '\x0d')
7272
|| unicode::general_category::Zs(c)
7373
|| unicode::general_category::Zl(c)
7474
|| unicode::general_category::Zp(c);
7575
}
7676

77-
#[doc = "
78-
Indicates whether a character is alphanumeric, defined
79-
in terms of the Unicode General Categories 'Nd',
80-
'Nl', 'No' and the Derived Core Property 'Alphabetic'.
81-
"]
77+
/**
78+
* Indicates whether a character is alphanumeric, defined
79+
* in terms of the Unicode General Categories 'Nd',
80+
* 'Nl', 'No' and the Derived Core Property 'Alphabetic'.
81+
*/
8282
pure fn is_alphanumeric(c: char) -> bool {
8383
ret unicode::derived_property::Alphabetic(c) ||
8484
unicode::general_category::Nd(c) ||
8585
unicode::general_category::Nl(c) ||
8686
unicode::general_category::No(c);
8787
}
8888

89-
#[doc = "Indicates whether the character is an ASCII character"]
89+
/// Indicates whether the character is an ASCII character
9090
pure fn is_ascii(c: char) -> bool {
9191
c - ('\x7F' & c) == '\x00'
9292
}
9393

94-
#[doc = "Indicates whether the character is numeric (Nd, Nl, or No)"]
94+
/// Indicates whether the character is numeric (Nd, Nl, or No)
9595
pure fn is_digit(c: char) -> bool {
9696
ret unicode::general_category::Nd(c) ||
9797
unicode::general_category::Nl(c) ||
9898
unicode::general_category::No(c);
9999
}
100100

101-
#[doc = "
102-
Convert a char to the corresponding digit.
103-
104-
# Safety note
105-
106-
This function fails if `c` is not a valid char
107-
108-
# Return value
109-
110-
If `c` is between '0' and '9', the corresponding value
111-
between 0 and 9. If `c` is 'a' or 'A', 10. If `c` is
112-
'b' or 'B', 11, etc. Returns none if the char does not
113-
refer to a digit in the given radix.
114-
"]
101+
/**
102+
* Convert a char to the corresponding digit.
103+
*
104+
* # Safety note
105+
*
106+
* This function fails if `c` is not a valid char
107+
*
108+
* # Return value
109+
*
110+
* If `c` is between '0' and '9', the corresponding value
111+
* between 0 and 9. If `c` is 'a' or 'A', 10. If `c` is
112+
* 'b' or 'B', 11, etc. Returns none if the char does not
113+
* refer to a digit in the given radix.
114+
*/
115115
pure fn to_digit(c: char, radix: uint) -> option<uint> {
116116
let val = alt c {
117117
'0' to '9' { c as uint - ('0' as uint) }
@@ -123,15 +123,15 @@ pure fn to_digit(c: char, radix: uint) -> option<uint> {
123123
else { none }
124124
}
125125

126-
#[doc = "
127-
Return the hexadecimal unicode escape of a char.
128-
129-
The rules are as follows:
130-
131-
- chars in [0,0xff]/~ get 2-digit escapes: `\\xNN`
132-
- chars in [0x100,0xffff]/~ get 4-digit escapes: `\\uNNNN`
133-
- chars above 0x10000 get 8-digit escapes: `\\UNNNNNNNN`
134-
"]
126+
/**
127+
* Return the hexadecimal unicode escape of a char.
128+
*
129+
* The rules are as follows:
130+
*
131+
* - chars in [0,0xff] get 2-digit escapes: `\\xNN`
132+
* - chars in [0x100,0xffff] get 4-digit escapes: `\\uNNNN`
133+
* - chars above 0x10000 get 8-digit escapes: `\\UNNNNNNNN`
134+
*/
135135
fn escape_unicode(c: char) -> str {
136136
let s = u32::to_str(c as u32, 16u);
137137
let (c, pad) = (if c <= '\xff' { ('x', 2u) }
@@ -145,18 +145,18 @@ fn escape_unicode(c: char) -> str {
145145
ret out;
146146
}
147147

148-
#[doc = "
149-
Return a 'default' ASCII and C++11-like char-literal escape of a char.
150-
151-
The default is chosen with a bias toward producing literals that are
152-
legal in a variety of languages, including C++11 and similar C-family
153-
languages. The exact rules are:
154-
155-
- Tab, CR and LF are escaped as '\t', '\r' and '\n' respectively.
156-
- Single-quote, double-quote and backslash chars are backslash-escaped.
157-
- Any other chars in the range [0x20,0x7e]/~ are not escaped.
158-
- Any other chars are given hex unicode escapes; see `escape_unicode`.
159-
"]
148+
/**
149+
* Return a 'default' ASCII and C++11-like char-literal escape of a char.
150+
*
151+
* The default is chosen with a bias toward producing literals that are
152+
* legal in a variety of languages, including C++11 and similar C-family
153+
* languages. The exact rules are:
154+
*
155+
* - Tab, CR and LF are escaped as '\t', '\r' and '\n' respectively.
156+
* - Single-quote, double-quote and backslash chars are backslash-escaped.
157+
* - Any other chars in the range [0x20,0x7e] are not escaped.
158+
* - Any other chars are given hex unicode escapes; see `escape_unicode`.
159+
*/
160160
fn escape_default(c: char) -> str {
161161
alt c {
162162
'\t' { "\\t" }
@@ -170,13 +170,13 @@ fn escape_default(c: char) -> str {
170170
}
171171
}
172172

173-
#[doc = "
174-
Compare two chars
175-
176-
# Return value
177-
178-
-1 if a < b, 0 if a == b, +1 if a > b
179-
"]
173+
/**
174+
* Compare two chars
175+
*
176+
* # Return value
177+
*
178+
* -1 if a < b, 0 if a == b, +1 if a > b
179+
*/
180180
pure fn cmp(a: char, b: char) -> int {
181181
ret if b > a { -1 }
182182
else if b < a { 1 }

src/libcore/cmp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#[doc="Interfaces used for comparison."]
1+
/// Interfaces used for comparison.
22
33
iface ord {
44
fn lt(&&other: self) -> bool;

0 commit comments

Comments
 (0)