about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2013-07-30Add test cases for selectBen Blum-0/+254
2013-07-30Implement select() for new runtime pipes.Ben Blum-48/+310
2013-07-30std: Add from_bytes test for utf-8 using codepoints above 0xffffblake2-ppc-0/+3
2013-07-30std: Deny overlong encodings in UTF-8blake2-ppc-8/+45
An 'overlong encoding' is a codepoint encoded non-minimally using the utf-8 format. Denying these enforce each codepoint to have only one valid representation in utf-8. An example is byte sequence 0xE0 0x80 0x80 which could be interpreted as U+0, but it's an overlong encoding since the canonical form is just 0x00. Another example is 0xE0 0x80 0xAF which was previously accepted and is an overlong encoding of the solidus "/". Directory traversal characters like / and . form the most compelling argument for why this commit is security critical. Factor out common UTF-8 decoding expressions as macros. This commit will partly duplicate UTF-8 decoding, so it is now present in both fn is_utf8() and .char_range_at(); the latter using an assumption of a valid str.
2013-07-30Do not enforce two newlines after the optionsJordi Boggiano-3/+4
2013-07-30std: Disallow bytes 0xC0, 0xC1 (192, 193) in utf-8blake2-ppc-1/+1
Bytes 0xC0, 0xC1 can only be used to start 2-byte codepoint encodings, that are 'overlong encodings' of codepoints below 128. The reference given in a comment -- https://tools.ietf.org/html/rfc3629 -- does in fact already exclude these bytes, so no additional comment should be needed in the code.
2013-07-30auto merge of #8121 : thestinger/rust/offset, r=alexcrichtonbors-80/+131
Closes #8118, #7136 ~~~rust extern mod extra; use std::vec; use std::ptr; fn bench_from_elem(b: &mut extra::test::BenchHarness) { do b.iter { let v: ~[u8] = vec::from_elem(1024, 0u8); } } fn bench_set_memory(b: &mut extra::test::BenchHarness) { do b.iter { let mut v: ~[u8] = vec::with_capacity(1024); unsafe { let vp = vec::raw::to_mut_ptr(v); ptr::set_memory(vp, 0, 1024); vec::raw::set_len(&mut v, 1024); } } } fn bench_vec_repeat(b: &mut extra::test::BenchHarness) { do b.iter { let v: ~[u8] = ~[0u8, ..1024]; } } ~~~ Before: test bench_from_elem ... bench: 415 ns/iter (+/- 17) test bench_set_memory ... bench: 85 ns/iter (+/- 4) test bench_vec_repeat ... bench: 83 ns/iter (+/- 3) After: test bench_from_elem ... bench: 84 ns/iter (+/- 2) test bench_set_memory ... bench: 84 ns/iter (+/- 5) test bench_vec_repeat ... bench: 84 ns/iter (+/- 3)
2013-07-30Added str::char_offset_iter() and str::rev_char_offset_iter()Marvin Löbel-597/+592
Renamed bytes_iter to byte_iter to match other iterators Refactored str Iterators to use DoubleEnded Iterators and typedefs instead of wrapper structs Reordered the Iterator section Whitespace fixup Moved clunky `each_split_within` function to the one place in the tree where it's actually needed Replaced all block doccomments in str with line doccomments
2013-07-30auto merge of #8107 : michaelwoerister/rust/end_of_spanned, r=cmrbors-718/+713
Contiunation of naming cleanup in `libsyntax::ast`: ```rust ast::node_id => ast::NodeId ast::local_crate => ast::LOCAL_CRATE ast::crate_node_id => ast::CRATE_NODE_ID ast::blk_check_mode => ast::BlockCheckMode ast::ty_field => ast::TypeField ast::ty_method => ast::TypeMethod ``` Also moved span field directly into `TypeField` struct and cleaned up overlooked `ast::CrateConfig` renamings from last pull request. Cheers, Michael
2013-07-30implement pointer arithmetic with GEPDaniel Micay-80/+131
Closes #8118, #7136 ~~~rust extern mod extra; use std::vec; use std::ptr; fn bench_from_elem(b: &mut extra::test::BenchHarness) { do b.iter { let v: ~[u8] = vec::from_elem(1024, 0u8); } } fn bench_set_memory(b: &mut extra::test::BenchHarness) { do b.iter { let mut v: ~[u8] = vec::with_capacity(1024); unsafe { let vp = vec::raw::to_mut_ptr(v); ptr::set_memory(vp, 0, 1024); vec::raw::set_len(&mut v, 1024); } } } fn bench_vec_repeat(b: &mut extra::test::BenchHarness) { do b.iter { let v: ~[u8] = ~[0u8, ..1024]; } } ~~~ Before: test bench_from_elem ... bench: 415 ns/iter (+/- 17) test bench_set_memory ... bench: 85 ns/iter (+/- 4) test bench_vec_repeat ... bench: 83 ns/iter (+/- 3) After: test bench_from_elem ... bench: 84 ns/iter (+/- 2) test bench_set_memory ... bench: 84 ns/iter (+/- 5) test bench_vec_repeat ... bench: 84 ns/iter (+/- 3)
2013-07-29auto merge of #7223 : steveklabnik/rust/vec_initial_docs, r=pcwaltonbors-1/+47
Let's explain more of what this module is about, not just 'vectors.'
2013-07-30std: Remove macro in vec that's only used onceblake2-ppc-17/+12
2013-07-30extra: Add .rev_iter() for bitvblake2-ppc-0/+5
2013-07-30std: Implement Extendable for hashmap, str and trieblake2-ppc-21/+58
2013-07-30extra: Implement iterator::Extendableblake2-ppc-21/+51
2013-07-30extra: Implement RandomAccessIterator for RingBufblake2-ppc-15/+26
2013-07-30extra: Implement DoubleEnded and RandomAccess iterators for bitvblake2-ppc-4/+35
2013-07-30std: Remove RandomAccessIterator impl for VecMutIteratorblake2-ppc-4/+4
The RandomAccessIterator implementation is not sound for the mutable vec iterator, and makes it easy to duplicate &mut element pointers.
2013-07-30std: Tests for RandomAccessIteratorsblake2-ppc-0/+87
2013-07-30std: Implement RandomAccessIterator for iterator adaptorsblake2-ppc-18/+142
Implement RAI where possible for iterator adaptors such as Map, Enumerate, Skip, Take, Zip, Cycle (all of the requiring that the adapted iterator also implements RAI).
2013-07-30iterator: implement size_hint() for FlatMapblake2-ppc-0/+10
2013-07-30iterator: implement DoubleEndedIterator for FlatMapblake2-ppc-5/+44
2013-07-30Improve std::num module description, and fix some formattingBrendan Zabarauskas-21/+4
2013-07-30Add some missing method wrappers to std::numBrendan Zabarauskas-2/+24
2013-07-29auto merge of #8090 : blake2-ppc/rust/iterator-adaptor-names, r=pcwaltonbors-112/+111
Drop the "Iterator" suffix for the the structs in std::iterator. Filter, Zip, Chain etc. are shorter type names for when iterator pipelines need their types written out in full in return value types, so it's easier to read and write. the iterator module already forms enough namespace.
2013-07-29auto merge of #8109 : blake2-ppc/rust/extern-fn-clone, r=thestingerbors-0/+58
Implement Clone and DeepClone for functions with 0 to 8 arguments. `extern fn()` is implicitly copyable so it's simple, except there is no way to implement it generically over #n function arguments. Allows deriving of Clone on structs containing `extern "Rust" fn`.
2013-07-29Adding an initial description to vec.rs.Steve Klabnik-1/+47
Let's explain more of what this module is about, not just 'vectors.'
2013-07-29Optimize try_recv to not require the two context switches when data is ↵Ben Blum-31/+34
available.
2013-07-29Remove ChanOneHack/PortOneHack extra allocationBen Blum-50/+30
2013-07-29auto merge of #8032 : catamorphism/rust/rustpkg-tags, r=graydonbors-80/+132
r? @graydon Package IDs can now be of the form a/b/c#FOO, where (if a/b/c is a git repository) FOO is any tag in the repository. Non-numeric tags only match against package IDs with the same tag, and aren't compared linearly like numeric versions. While I was at it, refactored the code that calls `git clone`, and segregated build output properly for different packages.
2013-07-29std: Implement Clone and DeepClone for extern "Rust" fnblake2-ppc-0/+58
Implement Clone and DeepClone for functions with 0 to 8 arguments.
2013-07-29auto merge of #8003 : crnobog/rust/case-insensitive-error-prefix, r=cmrbors-1/+26
Paths are case insensitive on windows and rustc and compiletest may disagree on casing. Fixes test compile-fail/circular_modules_main on win32
2013-07-29New naming convention for ast::{node_id, local_crate, crate_node_id, ↵Michael Woerister-718/+713
blk_check_mode, ty_field, ty_method}
2013-07-29auto merge of #8085 : mrordinaire/rust/percent-p, r=huonwbors-0/+20
pull request for #8011
2013-07-29Added %p directive to fmt!, which expects *T as argumentDo Nhat Minh-0/+20
2013-07-28auto merge of #8091 : kevinmehall/rust/const-struct-base, r=alexcrichtonbors-6/+41
With an expression like static w : foo = foo { a:5, ..x }; Rust currently gives the error "constant contains unimplemented expression type". This branch implements support for constant structs with `..base`.
2013-07-29std: Rename Iterator adaptor types to drop the -Iterator suffixblake2-ppc-112/+111
Drop the "Iterator" suffix for the the structs in std::iterator. Filter, Zip, Chain etc. are shorter type names for when iterator pipelines need their types written out in full in return value types, so it's easier to read and write. the iterator module already forms enough namespace.
2013-07-28Add support for `..base` on static struct initializers.Kevin Mehall-6/+41
2013-07-29std: Implement FromIterator for ~strblake2-ppc-1/+23
FromIterator initially only implemented for Iterator<char>, which is the type of the main iterator.
2013-07-28auto merge of #8095 : jmgrosen/rust/no-iterator-prefixes, r=pcwaltonbors-89/+90
Resolves #8093
2013-07-28Refactored vec and str iterators to remove prefixesjmgrosen-89/+90
2013-07-28auto merge of #8046 : kmcallister/rust/unused-log, r=pcwaltonbors-6/+7
2013-07-28Free intermediate translation results as soon as possibleBjörn Steinbrink-6/+13
This fixes the recently introduced peak memory usage regression by freeing the intermediate results as soon as they're not required anymore instead of keeping them around for the whole compilation process. Refs #8077
2013-07-28ReaderUtil::each_byte shouldn't include EOF byte -- Issue #5056Stepan Koltsov-4/+38
2013-07-28auto merge of #8087 : Aatch/rust/atomics, r=huonwbors-2/+83
Adds a fence operation to close #8061 Also adds static initializers to for atomic types. Since the fields are private, you aren't able to have `static mut` variables that are an atomic type. Each atomic type's initializer starts at a 0-value (so unset for `AtomicFlag` and false for `AtomicBool`).
2013-07-28auto merge of #8086 : luqmana/rust/rhelp, r=Aatchbors-1/+7
#7617 While the code that was there should've been perfectly fine (and seemingly is on linux at least) there seems to be some sort of weird interaction going on with statics and vectors. I couldn't get a smaller test case to reproduce that behaviour. The for loop in `rust::usage` seemingly just goes past the end of the vector thus getting garbage which it tries to pass to malloc somewhere down the line. In any case, using a fixed length vector seems to mitigate this.
2013-07-28librust: Stop rust tool from crashing on macos.Luqman Aden-1/+7
2013-07-28Fix spelling errorsJames Miller-2/+2
2013-07-28Add static initializers for atomicsJames Miller-5/+26
2013-07-28Add an atomic fence intrinsicJames Miller-2/+62