Skip to content

Commit 152aace

Browse files
committed
---
yaml --- r: 73465 b: refs/heads/dist-snap c: 998cbbd h: refs/heads/master i: 73463: 405f8a7 v: v3
1 parent 0abadc9 commit 152aace

File tree

5 files changed

+234
-27
lines changed

5 files changed

+234
-27
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: b50030718cf28f2a5a81857a26b57442734fe854
10-
refs/heads/dist-snap: c302010ef0016b6e7d1d869afe489c6ff3735b7e
10+
refs/heads/dist-snap: 998cbbd7390c6472a5770687f93c7a18bf9dc59f
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/etc/ctags.rust

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
--regex-rust=/[ \t]*type[ \t]+([a-zA-Z0-9_]+)/\1/T,types/
55
--regex-rust=/[ \t]*enum[ \t]+([a-zA-Z0-9_]+)/\1/T,types/
66
--regex-rust=/[ \t]*struct[ \t]+([a-zA-Z0-9_]+)/\1/m,types/
7-
--regex-rust=/[ \t]*class[ \t]+([a-zA-Z0-9_]+)/\1/m,types/
87
--regex-rust=/[ \t]*mod[ \t]+([a-zA-Z0-9_]+)/\1/m,modules/
9-
--regex-rust=/[ \t]*const[ \t]+([a-zA-Z0-9_]+)/\1/m,consts/
8+
--regex-rust=/[ \t]*static[ \t]+([a-zA-Z0-9_]+)/\1/m,consts/
109
--regex-rust=/[ \t]*trait[ \t]+([a-zA-Z0-9_]+)/\1/m,traits/
1110
--regex-rust=/[ \t]*impl[ \t]+([a-zA-Z0-9_]+)/\1/m,impls/
12-
--regex-rust=/[ \t]*impl[ \t]+of[ \t]([a-zA-Z0-9_]+)/\1/m,impls/

branches/dist-snap/src/librustc/middle/trans/base.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,9 +1704,6 @@ pub fn create_llargs_for_fn_args(cx: fn_ctxt,
17041704
llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
17051705
}
17061706
}
1707-
ast::ty_uniq(_) => {
1708-
llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
1709-
}
17101707
_ => {}
17111708
}
17121709

branches/dist-snap/src/librustdoc/markdown_pass.rs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,16 +451,32 @@ fn write_variants(
451451
fn write_variant(ctxt: &Ctxt, doc: doc::VariantDoc) {
452452
assert!(doc.sig.is_some());
453453
let sig = (&doc.sig).get();
454+
455+
// space out list items so they all end up within paragraph elements
456+
ctxt.w.put_line(~"");
457+
454458
match copy doc.desc {
455459
Some(desc) => {
456-
ctxt.w.put_line(fmt!("* `%s` - %s", sig, desc));
460+
ctxt.w.put_line(list_item_indent(fmt!("* `%s` - %s", sig, desc)));
457461
}
458462
None => {
459463
ctxt.w.put_line(fmt!("* `%s`", sig));
460464
}
461465
}
462466
}
463467

468+
fn list_item_indent(item: &str) -> ~str {
469+
let mut indented = ~[];
470+
for str::each_line_any(item) |line| {
471+
indented.push(line);
472+
}
473+
474+
// separate markdown elements within `*` lists must be indented by four
475+
// spaces, or they will escape the list context. indenting everything
476+
// seems fine though.
477+
str::connect_slices(indented, "\n ")
478+
}
479+
464480
fn write_trait(ctxt: &Ctxt, doc: doc::TraitDoc) {
465481
write_common(ctxt, doc.desc(), doc.sections());
466482
write_methods(ctxt, doc.methods);
@@ -807,7 +823,9 @@ mod test {
807823
assert!(str::contains(
808824
markdown,
809825
"\n\n#### Variants\n\
826+
\n\
810827
\n* `b` - test\
828+
\n\
811829
\n* `c` - test\n\n"));
812830
}
813831

@@ -817,7 +835,24 @@ mod test {
817835
assert!(str::contains(
818836
markdown,
819837
"\n\n#### Variants\n\
838+
\n\
820839
\n* `b`\
840+
\n\
841+
\n* `c`\n\n"));
842+
}
843+
844+
#[test]
845+
fn should_write_variant_list_with_indent() {
846+
let markdown = render(
847+
~"enum a { #[doc = \"line 1\\n\\nline 2\"] b, c }");
848+
assert!(str::contains(
849+
markdown,
850+
"\n\n#### Variants\n\
851+
\n\
852+
\n* `b` - line 1\
853+
\n \
854+
\n line 2\
855+
\n\
821856
\n* `c`\n\n"));
822857
}
823858

@@ -827,7 +862,9 @@ mod test {
827862
assert!(str::contains(
828863
markdown,
829864
"\n\n#### Variants\n\
865+
\n\
830866
\n* `b(int)`\
867+
\n\
831868
\n* `c(int)` - a\n\n"));
832869
}
833870

branches/dist-snap/src/libstd/bool.rs

Lines changed: 194 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,45 +8,190 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Boolean logic
11+
/*!
12+
13+
The `bool` module contains useful code to help work with boolean values.
14+
15+
A quick summary:
16+
17+
## Trait implementations for `bool`
18+
19+
Implementations of the following traits:
20+
21+
* `FromStr`
22+
* `Ord`
23+
* `TotalOrd`
24+
* `Eq`
25+
26+
## Various functions to compare `bool`s
27+
28+
All of the standard comparison functions one would expect: `and`, `eq`, `or`,
29+
and more.
30+
31+
Also, a few conversion functions: `to_bit` and `to_str`.
32+
33+
Finally, some inquries into the nature of truth: `is_true` and `is_false`.
34+
35+
*/
1236

1337
#[cfg(not(test))]
1438
use cmp::{Eq, Ord, TotalOrd, Ordering};
1539
use option::{None, Option, Some};
1640
use from_str::FromStr;
1741

18-
/// Negation / inverse
42+
/**
43+
* Negation of a boolean value.
44+
*
45+
* # Examples
46+
* ~~~
47+
* rusti> core::bool::not(true)
48+
* false
49+
* ~~~
50+
* rusti> core::bool::not(false)
51+
* true
52+
* ~~~
53+
*/
1954
pub fn not(v: bool) -> bool { !v }
2055

21-
/// Conjunction
56+
/**
57+
* Conjunction of two boolean values.
58+
*
59+
* # Examples
60+
* ~~~
61+
* rusti> core::bool::and(true, false)
62+
* false
63+
* ~~~
64+
* rusti> core::bool::and(true, true)
65+
* true
66+
* ~~~
67+
*/
2268
pub fn and(a: bool, b: bool) -> bool { a && b }
2369

24-
/// Disjunction
70+
/**
71+
* Disjunction of two boolean values.
72+
*
73+
* # Examples
74+
* ~~~
75+
* rusti> core::bool::or(true, false)
76+
* true
77+
* ~~~
78+
* rusti> core::bool::or(false, false)
79+
* false
80+
* ~~~
81+
*/
2582
pub fn or(a: bool, b: bool) -> bool { a || b }
2683

2784
/**
28-
* Exclusive or
29-
*
30-
* Identical to `or(and(a, not(b)), and(not(a), b))`
31-
*/
85+
* An 'exclusive or' of two boolean values.
86+
*
87+
* 'exclusive or' is identical to `or(and(a, not(b)), and(not(a), b))`.
88+
*
89+
* # Examples
90+
* ~~~
91+
* rusti> core::bool::xor(true, false)
92+
* true
93+
* ~~~
94+
* rusti> core::bool::xor(true, true)
95+
* false
96+
* ~~~
97+
*/
3298
pub fn xor(a: bool, b: bool) -> bool { (a && !b) || (!a && b) }
3399

34-
/// Implication in the logic, i.e. from `a` follows `b`
100+
/**
101+
* Implication between two boolean values.
102+
*
103+
* Implication is often phrased as 'if a then b.'
104+
*
105+
* 'if a then b' is equivalent to `!a || b`.
106+
*
107+
* # Examples
108+
* ~~~
109+
* rusti> core::bool::implies(true, true)
110+
* true
111+
* ~~~
112+
* rusti> core::bool::implies(true, false)
113+
* false
114+
* ~~~
115+
*/
35116
pub fn implies(a: bool, b: bool) -> bool { !a || b }
36117

37-
/// true if truth values `a` and `b` are indistinguishable in the logic
118+
/**
119+
* Equality between two boolean values.
120+
*
121+
* Two booleans are equal if they have the same value.
122+
*
123+
* # Examples
124+
* ~~~
125+
* rusti> core::bool::eq(false, true)
126+
* false
127+
* ~~~
128+
* rusti> core::bool::eq(false, false)
129+
* true
130+
* ~~~
131+
*/
38132
pub fn eq(a: bool, b: bool) -> bool { a == b }
39133

40-
/// true if truth values `a` and `b` are distinguishable in the logic
134+
/**
135+
* Non-equality between two boolean values.
136+
*
137+
* Two booleans are not equal if they have different values.
138+
*
139+
* # Examples
140+
* ~~~
141+
* rusti> core::bool::ne(false, true)
142+
* true
143+
* ~~~
144+
* rusti> core::bool::ne(false, false)
145+
* false
146+
* ~~~
147+
*/
41148
pub fn ne(a: bool, b: bool) -> bool { a != b }
42149

43-
/// true if `v` represents truth in the logic
150+
/**
151+
* Is a given boolean value true?
152+
*
153+
* # Examples
154+
* ~~~
155+
* rusti> core::bool::is_true(true)
156+
* true
157+
* ~~~
158+
* rusti> core::bool::is_true(false)
159+
* false
160+
* ~~~
161+
*/
44162
pub fn is_true(v: bool) -> bool { v }
45163

46-
/// true if `v` represents falsehood in the logic
164+
/**
165+
* Is a given boolean value false?
166+
*
167+
* # Examples
168+
* ~~~
169+
* rusti> core::bool::is_false(false)
170+
* true
171+
* ~~~
172+
* rusti> core::bool::is_false(true)
173+
* false
174+
* ~~~
175+
*/
47176
pub fn is_false(v: bool) -> bool { !v }
48177

49-
/// Parse logic value from `s`
178+
/**
179+
* Parse a `bool` from a `str`.
180+
*
181+
* Yields an `Option<bool>`, because `str` may or may not actually be parseable.
182+
*
183+
* # Examples
184+
* ~~~
185+
* rusti> FromStr::from_str::<bool>("true")
186+
* Some(true)
187+
* ~~~
188+
* rusti> FromStr::from_str::<bool>("false")
189+
* Some(false)
190+
* ~~~
191+
* rusti> FromStr::from_str::<bool>("not even a boolean")
192+
* None
193+
* ~~~
194+
*/
50195
impl FromStr for bool {
51196
fn from_str(s: &str) -> Option<bool> {
52197
match s {
@@ -57,19 +202,49 @@ impl FromStr for bool {
57202
}
58203
}
59204

60-
/// Convert `v` into a string
205+
/**
206+
* Convert a `bool` to a `str`.
207+
*
208+
* # Examples
209+
* ~~~
210+
* rusti> std::bool::to_str(true)
211+
* "true"
212+
* ~~~
213+
* rusti> std::bool::to_str(false)
214+
* "false"
215+
* ~~~
216+
*/
61217
pub fn to_str(v: bool) -> ~str { if v { ~"true" } else { ~"false" } }
62218

63219
/**
64-
* Iterates over all truth values by passing them to `blk` in an unspecified
65-
* order
66-
*/
220+
* Iterates over all truth values, passing them to the given block.
221+
*
222+
* There are no guarantees about the order values will be given.
223+
*
224+
* # Examples
225+
* ~~~
226+
* do core::bool::all_values |x: bool| {
227+
* println(core::bool::to_str(x));
228+
* }
229+
* ~~~
230+
*/
67231
pub fn all_values(blk: &fn(v: bool)) {
68232
blk(true);
69233
blk(false);
70234
}
71235

72-
/// converts truth value to an 8 bit byte
236+
/**
237+
* Convert a `bool` to a `u8`.
238+
*
239+
* # Examples
240+
* ~~~
241+
* rusti> std::bool::to_bit(true)
242+
* 1
243+
* ~~~
244+
* rusti> std::bool::to_bit(false)
245+
* 0
246+
* ~~~
247+
*/
73248
#[inline(always)]
74249
pub fn to_bit(v: bool) -> u8 { if v { 1u8 } else { 0u8 } }
75250

0 commit comments

Comments
 (0)