Commit Graph

20134 Commits

Author SHA1 Message Date
Björn Steinbrink
7e97277289 transmute: Avoid double copy for immediate values
Currently, immediate values are copied into an alloca only to have an
addressable storage so that it can be used with memcpy. Obviously we
can skip the memcpy in this case.
2013-07-11 18:46:05 +02:00
bors
278ed50e0a auto merge of #7455 : nikomatsakis/rust/issue-7336-constrain-closure-lifetimes, r=pnkfelix
Constrain maximum lifetime of stack closures that capture variables to be limited by the innermost repeating scope.

Fixes #7336.

r? whomever.
2013-07-11 09:34:40 -07:00
Felix S. Klock II
3896d46c0a Fix #5270: another test I did not update properly. 2013-07-11 16:56:49 +02:00
bors
e95fcfafc7 auto merge of #7632 : gavinb/rust/7484_manpages, r=cmr
This patch updates the existing manpage and creates new pages for all of the rust command line tools. Closes #7484.
2013-07-11 07:37:36 -07:00
blake2-ppc
0f9b9a5fb7 extra: Mention extra::container::Deque trait in doc for RingBuf and DList 2013-07-11 16:17:51 +02:00
blake2-ppc
b2b88b326d dlist: Name the type DList for doubly-linked list 2013-07-11 15:54:35 +02:00
blake2-ppc
a8e7bdd142 dlist: Fix license header 2013-07-11 15:54:35 +02:00
blake2-ppc
24d2d7b5bb dlist: Implement trait Deque 2013-07-11 15:54:35 +02:00
blake2-ppc
7052371e39 extra: Rename deque::Deque to ringbuf::RingBuf and impl trait Deque
Let RingBuf have a logical name for a concrete type, and Deque is
used for the Deque trait (implemented by RingBuf and dlist).
2013-07-11 15:54:35 +02:00
blake2-ppc
6a95e49fc5 extra: Add mod container with trait Deque 2013-07-11 15:54:35 +02:00
blake2-ppc
92842d6516 dlist: Expose ListInsertion trait with insert_before and peek_next
An iterator that allows mutating the list is very useful but needs care
to not be unsound. ListIteration exposes only insert_before (used for
insert_ordered) and peek_next so far.
2013-07-11 15:54:35 +02:00
blake2-ppc
4fa69ab97c dlist: Put all tests into a tests module
The exception is the function check_links which needs access to struct
Node (which is not pub).
2013-07-11 15:54:34 +02:00
blake2-ppc
8d06efb8ea dlist: Collect a common pattern into link_with_prev() 2013-07-11 15:54:34 +02:00
blake2-ppc
7b1c57713d dlist: Introduce a struct Rawlink mimicing Option<T> for a raw pointer
Rawlink<T> holds a *mut T pointer and can convert itself to Option<&mut T>.
The null pointer is of course None.
2013-07-11 15:54:34 +02:00
blake2-ppc
f97e64083b dlist: Implement size_hint properly for all iterators 2013-07-11 15:52:21 +02:00
blake2-ppc
824bb44f92 dlist: A new implementation of an owned doubly-linked list
This is an owned sendable linked list which allows insertion and
deletion at both ends, with fast traversal through iteration, and fast
append/prepend.

It is indended to replace the previous managed DList with exposed list
nodes. It does not match it feature by feature, but DList could grow
more methods if needed.
2013-07-11 15:52:21 +02:00
bors
323ac9931b auto merge of #7708 : bcully/rust/warnings, r=thestinger
Just getting my feet wet.
2013-07-11 05:40:36 -07:00
bors
06accaf22b auto merge of #7704 : glinscott/rust/json_iter, r=erickt
This is much faster for strings, and eventually when there is a
buffered reader of some sort, will be much faster for files.

Reading example.json 100 times before was around 1.18s.
After:
- reading from string 0.68s
- reading from file 1.08s (extra time is all in io::Reader)

Also:
- fixes #7611 - error when parsing strings and we hit EOF
- updates definition of whitespace in json should only be the 4 ascii whitespace chars
2013-07-11 03:43:36 -07:00
bors
6ea0c7767d auto merge of #7693 : korenchkin/rust/fixdoc_rand, r=cmr
All of the examples were still using `core::` instead of `std::` and  needed a `use std::rand;` at the top to compile
Most of the examples had
    `rng = rand::rng();`
instead of
    `let mut rng = rand::rng();`
2013-07-11 01:37:39 -07:00
Alex Crichton
f9bf69d253 Remove all external requirements of @ from TLS
Closes #6004
2013-07-11 00:37:13 -07:00
Alex Crichton
11c63eaad2 Fix a soundness problem with get 2013-07-11 00:22:08 -07:00
Alex Crichton
e3fb7062aa Work around stage0 to remove '@' requirements from TLS 2013-07-11 00:21:26 -07:00
bors
9239d69788 auto merge of #7691 : nikomatsakis/rust/vec-split-method, r=thestinger
I don't think we have this yet. This makes `&mut [T]` much more flexible.

r? @strcat (or whomever)
2013-07-10 23:37:40 -07:00
Daniel Micay
00da76dfbe vec: rm inline(never) hack
just avoid giving an inline hint in the first place
2013-07-11 02:17:08 -04:00
Daniel Micay
fd5f8d90c5 iterator: add DoubleEndedIterator concept
This implements the trait for vector iterators, replacing the reverse
iterator types. The methods will stay, for implementing the future
reverse Iterable traits and convenience.

This can also be trivially implemented for circular buffers and other
variants of arrays like strings and `SmallIntMap`/`SmallIntSet`.

The `DoubleEndedIterator` trait will allow for implementing algorithms
like in-place reverse on generic mutable iterators.

The naming (`Range` vs. `Iterator`, `Bidirectional` vs. `DoubleEnded`)
can be bikeshedded in the future.
2013-07-11 01:31:01 -04:00
Brendan Cully
990dc435aa unused variable 2013-07-10 22:23:09 -07:00
Brendan Cully
202fcb29bd unnecessarily mutable variables 2013-07-10 22:12:30 -07:00
Brendan Cully
e6e4f52bcf remove unused imports 2013-07-10 22:08:50 -07:00
bors
495741498c auto merge of #7690 : kevinmehall/rust/document-c_void, r=huonw
I added documentation for when to use and not to use `c_void`, since it tripped me up when I started. (See issue #7627)
2013-07-10 21:40:39 -07:00
Seo Sanghyeon
f20c78c984 Add a compile-fail test for qualification lint 2013-07-11 12:54:06 +09:00
Gary Linscott
f091a1e075 Convert json Reader to iterators
This is much faster for strings, and eventually when there is a
buffered reader of some sort.

Reading example.json 100 times before was around 1.18s.
After:
- reading from string 0.68s
- reading from file 1.08s (extra time is all in io::Reader)
2013-07-10 23:08:13 -04:00
bors
9b5d523126 auto merge of #7683 : alexcrichton/rust/issue-7625, r=thestinger
Closes #7625
2013-07-10 17:13:50 -07:00
bors
e7040e8a24 auto merge of #7698 : nikomatsakis/rust/issue-2951-type-parameter-names, r=cmr
Fixes #2951
2013-07-10 14:37:39 -07:00
bors
90db8628c5 auto merge of #7631 : MarkJr94/rust/ptr_arithmetic, r=thestinger
Added Add and Sub traits for pointer arithmetic. Any type that is a ```std::num::Int``` can be added to or subtracted from a pointer. Also my additions did not require any unsafe code, and the operators themselves are safe. Fixes #2122.
2013-07-10 11:46:41 -07:00
Niko Matsakis
4412df20ae Add an identifier to TypeParameterDefs and use it to pretty print type parameters 2013-07-10 14:42:53 -04:00
Corey Richardson
26f0a55f76 fix test 2013-07-10 13:14:31 -04:00
Corey Richardson
8dc6445e38 Change the assert_eq message to be more verbose.
Closes #6221
2013-07-10 13:12:10 -04:00
Seo Sanghyeon
2bc06b40ba Implement SIMD arithmetics 2013-07-10 23:35:59 +09:00
Niko Matsakis
9ee5ce2215 Add a mut_split() method for dividing one &mut [T] into two 2013-07-10 10:03:29 -04:00
korenchkin
3cb3d754a5 Fixed examples
The examples were still using `core::` instead of `std::`
All of the examples needed a `use std::rand;` at the top to compile
Most of the examples had
    `rng = rand::rng();`
instead of
    `let mut rng = rand::rng();`
2013-07-10 15:49:39 +02:00
Kevin Mehall
663a9597b2 Document std::libc::c_void. 2013-07-10 08:55:14 -04:00
=Mark Sinclair
294999c350 Added overloaded Add and Sub traits for pointer arithmetic
Implemented ptr arithmetic for *T and *mut T. Tests passing
2013-07-10 06:34:00 -04:00
bors
8fa09736ef auto merge of #7658 : excepttheweasel/rust/mut_default_param_list_issue_7483, r=pcwalton 2013-07-10 03:25:28 -07:00
Seo Sanghyeon
f81986031c Add a lint to detect unnecessarily qualified names 2013-07-10 19:09:03 +09:00
bors
8a7b636649 auto merge of #7637 : pnkfelix/rust/fsk-guard-against-stale-libraries-issue3225-safeguarded, r=graydon
When building Rust libraries (e.g. librustc, libstd, etc), checks for
and verbosely removes previous build products before invoking rustc.
(Also, when Make variable VERBOSE is defined, it will list all of the
libraries matching the object library's glob after the rustc
invocation has completed.)

When installing Rust libraries, checks for previous libraries in
target install directory, but does not remove them.

The thinking behind these two different modes of operation is that the
installation target, unlike the build tree, is not under the control
of this infrastructure and it is not up to this Makefile to decide if
the previous libraries should be removed.

Fixes #3225 (at least in terms of mitigating the multiple library
problem by proactively warning the user about it.)
2013-07-10 01:10:29 -07:00
Daniel Micay
b5e9194836 Merge pull request #7682 from thestinger/vec
vec::with_capacity: do one alloc for non-managed + ptr module improvements
2013-07-10 01:06:34 -07:00
Felix S. Klock II
db0a13b986 Switch over to new range_rev semantics; fix #5270. 2013-07-10 09:35:35 +02:00
Felix S. Klock II
3c19f1bca8 Refactored int/uint range code in preparation for change to range_rev semantics.
Also added unit tests of range code to test refactoring.  The
num-range-rev.rs test will need to be updated when the range_rev
semantics change.
2013-07-10 09:35:35 +02:00
Alex Crichton
6d4d2c9a33 Don't loop infinitely on 0-size structs in repr
Closes #7625
2013-07-10 00:07:03 -07:00
Daniel Micay
6f5be9063d ptr: optimize {swap,replace,read}_ptr 2013-07-09 22:44:11 -04:00