Skip to content

Commit 3789355

Browse files
committed
---
yaml --- r: 94967 b: refs/heads/dist-snap c: a94158c h: refs/heads/master i: 94965: 4f54763 94963: 8cc9429 94959: cc3b7d4 v: v3
1 parent 1b9665c commit 3789355

File tree

31 files changed

+968
-672
lines changed

31 files changed

+968
-672
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: c1d64297f071ea166ffbe5aea4fa5f94da3b3622
9+
refs/heads/dist-snap: a94158ce64524b7e21e6c8ec23a6b762d45926fb
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*.cpp rust
55
*.h rust
66
*.rs rust
7+
src/etc/pkg/rust-logo.ico binary
78
src/rt/msvc/* -whitespace
89
src/rt/vg/* -whitespace
910
src/rt/linenoise/* -whitespace

branches/dist-snap/RELEASES.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
Version 0.8 (October 2013)
1+
Version 0.8 (September 2013)
22
--------------------------
33

4-
* ~2100 changes, numerous bugfixes
4+
* ~2200 changes, numerous bugfixes
55

66
* Language
77
* The `for` loop syntax has changed to work with the `Iterator` trait.
2 Bytes
Binary file not shown.

branches/dist-snap/src/libextra/bitv.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ impl Bitv {
523523
* with the most significant bits of each byte coming first. Each
524524
* bit becomes true if equal to 1 or false if equal to 0.
525525
*/
526-
pub fn from_utf8(bytes: &[u8]) -> Bitv {
526+
pub fn from_bytes(bytes: &[u8]) -> Bitv {
527527
from_fn(bytes.len() * 8, |i| {
528528
let b = bytes[i / 8] as uint;
529529
let offset = i % 8;
@@ -1275,8 +1275,8 @@ mod tests {
12751275
}
12761276
12771277
#[test]
1278-
fn test_from_utf8() {
1279-
let bitv = from_utf8([0b10110110, 0b00000000, 0b11111111]);
1278+
fn test_from_bytes() {
1279+
let bitv = from_bytes([0b10110110, 0b00000000, 0b11111111]);
12801280
let str = ~"10110110" + "00000000" + "11111111";
12811281
assert_eq!(bitv.to_str(), str);
12821282
}
@@ -1302,7 +1302,7 @@ mod tests {
13021302
#[test]
13031303
fn test_to_bools() {
13041304
let bools = ~[false, false, true, false, false, true, true, false];
1305-
assert_eq!(from_utf8([0b00100110]).to_bools(), bools);
1305+
assert_eq!(from_bytes([0b00100110]).to_bools(), bools);
13061306
}
13071307
13081308
#[test]

branches/dist-snap/src/libextra/crypto/md5.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static C4: [u32, ..16] = [
156156

157157

158158
/// The MD5 Digest algorithm
159-
struct Md5 {
159+
pub struct Md5 {
160160
priv length_bytes: u64,
161161
priv buffer: FixedBuffer64,
162162
priv state: Md5State,

branches/dist-snap/src/libextra/crypto/sha2.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ impl Engine512 {
230230
}
231231

232232

233-
struct Sha512 {
233+
/// The SHA-512 hash algorithm
234+
pub struct Sha512 {
234235
priv engine: Engine512
235236
}
236237

@@ -282,7 +283,8 @@ static H512: [u64, ..8] = [
282283
];
283284

284285

285-
struct Sha384 {
286+
/// The SHA-384 hash algorithm
287+
pub struct Sha384 {
286288
priv engine: Engine512
287289
}
288290

@@ -332,7 +334,8 @@ static H384: [u64, ..8] = [
332334
];
333335

334336

335-
struct Sha512Trunc256 {
337+
/// The SHA-512 hash algorithm with digest truncated to 256 bits
338+
pub struct Sha512Trunc256 {
336339
priv engine: Engine512
337340
}
338341

@@ -380,7 +383,8 @@ static H512_TRUNC_256: [u64, ..8] = [
380383
];
381384

382385

383-
struct Sha512Trunc224 {
386+
/// The SHA-512 hash algorithm with digest truncated to 224 bits
387+
pub struct Sha512Trunc224 {
384388
priv engine: Engine512
385389
}
386390

@@ -635,7 +639,8 @@ impl Engine256 {
635639
}
636640

637641

638-
struct Sha256 {
642+
/// The SHA-256 hash algorithm
643+
pub struct Sha256 {
639644
priv engine: Engine256
640645
}
641646

@@ -687,7 +692,8 @@ static H256: [u32, ..8] = [
687692
];
688693

689694

690-
struct Sha224 {
695+
/// The SHA-224 hash algorithm
696+
pub struct Sha224 {
691697
priv engine: Engine256
692698
}
693699

branches/dist-snap/src/libextra/ringbuf.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,19 @@ impl<T> RingBuf<T> {
143143
}
144144
}
145145

146+
/// Swap elements at indices `i` and `j`
147+
///
148+
/// `i` and `j` may be equal.
149+
///
150+
/// Fails if there is no element with the given index
151+
pub fn swap(&mut self, i: uint, j: uint) {
152+
assert!(i < self.len());
153+
assert!(j < self.len());
154+
let ri = self.raw_index(i);
155+
let rj = self.raw_index(j);
156+
self.elts.swap(ri, rj);
157+
}
158+
146159
/// Return index in underlying vec for a given logical element index
147160
fn raw_index(&self, idx: uint) -> uint {
148161
raw_index(self.lo, self.elts.len(), idx)
@@ -604,6 +617,14 @@ mod tests {
604617
assert_eq!(d.elts.capacity(), 64);
605618
}
606619

620+
#[test]
621+
fn test_swap() {
622+
let mut d: RingBuf<int> = range(0, 5).collect();
623+
d.pop_front();
624+
d.swap(0, 3);
625+
assert_eq!(d.iter().map(|&x|x).collect::<~[int]>(), ~[4, 2, 3, 1]);
626+
}
627+
607628
#[test]
608629
fn test_iter() {
609630
let mut d = RingBuf::new();

branches/dist-snap/src/libextra/url.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use std::to_bytes;
2121
use std::uint;
2222

2323
#[deriving(Clone, Eq)]
24-
struct Url {
24+
pub struct Url {
2525
scheme: ~str,
2626
user: Option<UserInfo>,
2727
host: ~str,
@@ -32,7 +32,7 @@ struct Url {
3232
}
3333

3434
#[deriving(Clone, Eq)]
35-
struct UserInfo {
35+
pub struct UserInfo {
3636
user: ~str,
3737
pass: Option<~str>
3838
}

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use syntax::ast;
2525
use syntax::ast::Name;
2626
use syntax::ast_util;
2727
use syntax::codemap::Span;
28+
use syntax::visit::Visitor;
2829

2930
pub fn trans_block(bcx: @mut Block, b: &ast::Block, dest: expr::Dest) -> @mut Block {
3031
let _icx = push_ctxt("trans_block");
@@ -64,12 +65,22 @@ pub fn trans_if(bcx: @mut Block,
6465
// Drop branches that are known to be impossible
6566
if is_const(cond_val) && !is_undef(cond_val) {
6667
if const_to_uint(cond_val) == 1 {
68+
match els {
69+
Some(elexpr) => {
70+
let mut trans = TransItemVisitor { ccx: bcx.fcx.ccx };
71+
trans.visit_expr(elexpr, ());
72+
}
73+
None => {}
74+
}
6775
// if true { .. } [else { .. }]
6876
return do with_scope(bcx, thn.info(), "if_true_then") |bcx| {
6977
let bcx_out = trans_block(bcx, thn, dest);
7078
trans_block_cleanups(bcx_out, block_cleanups(bcx))
7179
}
7280
} else {
81+
let mut trans = TransItemVisitor { ccx: bcx.fcx.ccx } ;
82+
trans.visit_block(thn, ());
83+
7384
match els {
7485
// if false { .. } else { .. }
7586
Some(elexpr) => {

branches/dist-snap/src/librustc/middle/typeck/check/method.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ impl<'self> LookupContext<'self> {
372372
// to a trait and its supertraits.
373373
fn get_method_index(&self,
374374
trait_ref: @TraitRef,
375-
subtrait_id: ast::DefId,
375+
subtrait: @TraitRef,
376376
n_method: uint) -> uint {
377377
let tcx = self.tcx();
378378

@@ -382,15 +382,14 @@ impl<'self> LookupContext<'self> {
382382
// we find the trait the method came from, counting up the
383383
// methods from them.
384384
let mut method_count = 0;
385-
do ty::each_bound_trait_and_supertraits(tcx, &[trait_ref])
385+
do ty::each_bound_trait_and_supertraits(tcx, &[subtrait])
386386
|bound_ref| {
387-
if bound_ref.def_id == subtrait_id { false }
387+
if bound_ref.def_id == trait_ref.def_id { false }
388388
else {
389389
method_count += ty::trait_methods(tcx, bound_ref.def_id).len();
390390
true
391391
}
392392
};
393-
394393
return method_count + n_method;
395394
}
396395

@@ -418,9 +417,9 @@ impl<'self> LookupContext<'self> {
418417
let trait_ref = @TraitRef { def_id: did, substs: rcvr_substs.clone() };
419418

420419
do self.push_inherent_candidates_from_bounds_inner(&[trait_ref])
421-
|trait_ref, m, method_num, _bound_num| {
420+
|new_trait_ref, m, method_num, _bound_num| {
422421
let vtable_index =
423-
self.get_method_index(trait_ref, trait_ref.def_id, method_num);
422+
self.get_method_index(new_trait_ref, trait_ref, method_num);
424423
// We need to fix up the transformed self type.
425424
let transformed_self_ty =
426425
self.construct_transformed_self_ty_for_object(

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3224,14 +3224,14 @@ pub mod funcs {
32243224
#[nolink]
32253225
#[abi = "cdecl"]
32263226
pub mod glob {
3227-
use libc::types::common::c95::{c_void};
32283227
use libc::types::os::arch::c95::{c_char, c_int};
32293228
use libc::types::os::common::posix01::{glob_t};
3229+
use option::Option;
32303230

32313231
extern {
32323232
pub fn glob(pattern: *c_char,
32333233
flags: c_int,
3234-
errfunc: *c_void, // XXX callback
3234+
errfunc: Option<extern "C" fn(epath: *c_char, errno: int) -> int>,
32353235
pglob: *mut glob_t);
32363236
pub fn globfree(pglob: *mut glob_t);
32373237
}

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

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010

1111
//! Logging
1212
13+
use fmt;
1314
use option::*;
1415
use os;
1516
use rt;
1617
use rt::logging::{Logger, StdErrLogger};
17-
use send_str::SendStrOwned;
1818

1919
/// Turns on logging to stdout globally
2020
pub fn console_on() {
@@ -37,7 +37,17 @@ pub fn console_off() {
3737
rt::logging::console_off();
3838
}
3939

40-
fn newsched_log_str(msg: ~str) {
40+
#[cfg(stage0)]
41+
#[doc(hidden)]
42+
pub fn log(_level: u32, s: ~str) {
43+
// this is a terrible approximation, but it gets the job done (for stage0 at
44+
// least)
45+
::io::println(s);
46+
}
47+
48+
#[allow(missing_doc)]
49+
#[cfg(not(stage0))]
50+
pub fn log(_level: u32, args: &fmt::Arguments) {
4151
use rt::task::Task;
4252
use rt::local::Local;
4353

@@ -46,20 +56,13 @@ fn newsched_log_str(msg: ~str) {
4656
match optional_task {
4757
Some(local) => {
4858
// Use the available logger
49-
(*local).logger.log(SendStrOwned(msg));
59+
(*local).logger.log(args);
5060
}
5161
None => {
5262
// There is no logger anywhere, just write to stderr
5363
let mut logger = StdErrLogger;
54-
logger.log(SendStrOwned(msg));
64+
logger.log(args);
5565
}
5666
}
5767
}
5868
}
59-
60-
// XXX: This will change soon to not require an allocation. This is an unstable
61-
// api which should not be used outside of the macros in ext/expand.
62-
#[doc(hidden)]
63-
pub fn log(_level: u32, msg: ~str) {
64-
newsched_log_str(msg);
65-
}

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -366,19 +366,6 @@ impl<T, E> either::AsEither<E, T> for Result<T, E> {
366366
}
367367
}
368368

369-
#[inline]
370-
#[allow(missing_doc)]
371-
pub fn map_opt<T, U: ToStr, V>(o_t: &Option<T>,
372-
op: &fn(&T) -> Result<V,U>) -> Result<Option<V>,U> {
373-
match *o_t {
374-
None => Ok(None),
375-
Some(ref t) => match op(t) {
376-
Ok(v) => Ok(Some(v)),
377-
Err(e) => Err(e)
378-
}
379-
}
380-
}
381-
382369
/// Takes each element in the iterator: if it is an error, no further
383370
/// elements are taken, and the error is returned.
384371
/// Should no error occur, a vector containing the values of each Result

branches/dist-snap/src/libstd/rt/comm.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,17 @@ impl<T> ChanOne<T> {
118118
rtassert!(!rt::in_sched_context());
119119
}
120120

121+
// In order to prevent starvation of other tasks in situations
122+
// where a task sends repeatedly without ever receiving, we
123+
// occassionally yield instead of doing a send immediately.
124+
// Only doing this if we're doing a rescheduling send,
125+
// otherwise the caller is expecting not to context switch.
126+
if do_resched {
127+
// XXX: This TLS hit should be combined with other uses of the scheduler below
128+
let sched: ~Scheduler = Local::take();
129+
sched.maybe_yield();
130+
}
131+
121132
let mut this = self;
122133
let mut recvr_active = true;
123134
let packet = this.packet();

branches/dist-snap/src/libstd/rt/io/mem.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl Decorator<~[u8]> for MemReader {
128128

129129

130130
/// Writes to a fixed-size byte slice
131-
struct BufWriter<'self> {
131+
pub struct BufWriter<'self> {
132132
buf: &'self mut [u8],
133133
pos: uint
134134
}
@@ -156,7 +156,7 @@ impl<'self> Seek for BufWriter<'self> {
156156

157157

158158
/// Reads from a fixed-size byte slice
159-
struct BufReader<'self> {
159+
pub struct BufReader<'self> {
160160
buf: &'self [u8],
161161
pos: uint
162162
}

branches/dist-snap/src/libstd/rt/local_ptr.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,16 @@ pub unsafe fn unsafe_borrow<T>() -> *mut T {
129129
}
130130

131131
pub unsafe fn try_unsafe_borrow<T>() -> Option<*mut T> {
132-
let key = tls_key();
133-
let void_ptr = tls::get(key);
134-
if void_ptr.is_null() {
135-
None
136-
} else {
137-
Some(void_ptr as *mut T)
132+
match maybe_tls_key() {
133+
Some(key) => {
134+
let void_ptr = tls::get(key);
135+
if void_ptr.is_null() {
136+
None
137+
} else {
138+
Some(void_ptr as *mut T)
139+
}
140+
}
141+
None => None
138142
}
139143
}
140144

0 commit comments

Comments
 (0)