Skip to content

Commit 0abadc9

Browse files
committed
---
yaml --- r: 73464 b: refs/heads/dist-snap c: c302010 h: refs/heads/master v: v3
1 parent 405f8a7 commit 0abadc9

File tree

4 files changed

+24
-233
lines changed

4 files changed

+24
-233
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: f5d4ea84f5f38c230235a2bab142bfb55d6febdc
10+
refs/heads/dist-snap: c302010ef0016b6e7d1d869afe489c6ff3735b7e
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,6 +1704,9 @@ 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+
}
17071710
_ => {}
17081711
}
17091712

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

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -451,32 +451,16 @@ 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-
458454
match copy doc.desc {
459455
Some(desc) => {
460-
ctxt.w.put_line(list_item_indent(fmt!("* `%s` - %s", sig, desc)));
456+
ctxt.w.put_line(fmt!("* `%s` - %s", sig, desc));
461457
}
462458
None => {
463459
ctxt.w.put_line(fmt!("* `%s`", sig));
464460
}
465461
}
466462
}
467463

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-
480464
fn write_trait(ctxt: &Ctxt, doc: doc::TraitDoc) {
481465
write_common(ctxt, doc.desc(), doc.sections());
482466
write_methods(ctxt, doc.methods);
@@ -823,9 +807,7 @@ mod test {
823807
assert!(str::contains(
824808
markdown,
825809
"\n\n#### Variants\n\
826-
\n\
827810
\n* `b` - test\
828-
\n\
829811
\n* `c` - test\n\n"));
830812
}
831813

@@ -835,24 +817,7 @@ mod test {
835817
assert!(str::contains(
836818
markdown,
837819
"\n\n#### Variants\n\
838-
\n\
839820
\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\
856821
\n* `c`\n\n"));
857822
}
858823

@@ -862,9 +827,7 @@ mod test {
862827
assert!(str::contains(
863828
markdown,
864829
"\n\n#### Variants\n\
865-
\n\
866830
\n* `b(int)`\
867-
\n\
868831
\n* `c(int)` - a\n\n"));
869832
}
870833

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

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

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-
*/
11+
//! Boolean logic
3612
3713
#[cfg(not(test))]
3814
use cmp::{Eq, Ord, TotalOrd, Ordering};
3915
use option::{None, Option, Some};
4016
use from_str::FromStr;
4117

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-
*/
18+
/// Negation / inverse
5419
pub fn not(v: bool) -> bool { !v }
5520

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-
*/
21+
/// Conjunction
6822
pub fn and(a: bool, b: bool) -> bool { a && b }
6923

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-
*/
24+
/// Disjunction
8225
pub fn or(a: bool, b: bool) -> bool { a || b }
8326

8427
/**
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-
*/
28+
* Exclusive or
29+
*
30+
* Identical to `or(and(a, not(b)), and(not(a), b))`
31+
*/
9832
pub fn xor(a: bool, b: bool) -> bool { (a && !b) || (!a && b) }
9933

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-
*/
34+
/// Implication in the logic, i.e. from `a` follows `b`
11635
pub fn implies(a: bool, b: bool) -> bool { !a || b }
11736

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-
*/
37+
/// true if truth values `a` and `b` are indistinguishable in the logic
13238
pub fn eq(a: bool, b: bool) -> bool { a == b }
13339

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-
*/
40+
/// true if truth values `a` and `b` are distinguishable in the logic
14841
pub fn ne(a: bool, b: bool) -> bool { a != b }
14942

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-
*/
43+
/// true if `v` represents truth in the logic
16244
pub fn is_true(v: bool) -> bool { v }
16345

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-
*/
46+
/// true if `v` represents falsehood in the logic
17647
pub fn is_false(v: bool) -> bool { !v }
17748

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-
*/
49+
/// Parse logic value from `s`
19550
impl FromStr for bool {
19651
fn from_str(s: &str) -> Option<bool> {
19752
match s {
@@ -202,49 +57,19 @@ impl FromStr for bool {
20257
}
20358
}
20459

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-
*/
60+
/// Convert `v` into a string
21761
pub fn to_str(v: bool) -> ~str { if v { ~"true" } else { ~"false" } }
21862

21963
/**
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-
*/
64+
* Iterates over all truth values by passing them to `blk` in an unspecified
65+
* order
66+
*/
23167
pub fn all_values(blk: &fn(v: bool)) {
23268
blk(true);
23369
blk(false);
23470
}
23571

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-
*/
72+
/// converts truth value to an 8 bit byte
24873
#[inline(always)]
24974
pub fn to_bit(v: bool) -> u8 { if v { 1u8 } else { 0u8 } }
25075

0 commit comments

Comments
 (0)