Commit Graph

16984 Commits

Author SHA1 Message Date
Brendan Zabarauskas
939a97f5cb Add #[inline(always)] to each operator method 2013-04-18 23:24:24 +10:00
Brendan Zabarauskas
d2a81b95c3 Implement bitwise operator traits for ints and uints 2013-04-18 20:58:58 +10:00
bors
07e087bf31 auto merge of #5890 : youknowone/rust/const-eval, r=catamorphism
This will help not to meet confusing errors.
In issue #5873, the error was "expected constant expr for vector length: Can't cast str to int".
It was originally "expected constant expr for vector length: Non-constant path in constant expr" (though still invalid error).
This patch make the original error to be printed.
2013-04-16 12:48:56 -07:00
bors
7cacd87efd auto merge of #5904 : huonw/rust/core-vec-windowed, r=thestinger
And add some documentation.
2013-04-16 06:12:55 -07:00
Huon Wilson
21723d5bdc libcore: vec::windowed iterates, not allocates. 2013-04-16 23:07:46 +10:00
bors
76e77af380 auto merge of #5901 : thestinger/rust/iterator, r=sanxiyn
Can now use them like `x.transform(|i| i + 3).zip(y.filter(|i| i % 2)`.
2013-04-15 21:03:55 -07:00
bors
16e8af9e47 auto merge of #5895 : huonw/rust/no-pub-tests, r=thestinger
This patch is a sledge hammer that moves all tests into `#[cfg(test)] mod test { .. }`, and makes them private, there were several instances of `pub mod tests { #[test] pub fn ... } `.

(The reason for this is I was playing with using `syntax` to index code ([result so far](http://www.ug.it.usyd.edu.au/~hwil7821/rust-api/)) and it was getting some junk from the tests.)

The rustdoc commit is particularly brutal, so it's fine if that one isn't landed.
2013-04-15 20:00:56 -07:00
bors
447caf9bdb auto merge of #5899 : catamorphism/rust/copy-cops, r=catamorphism 2013-04-15 19:09:56 -07:00
Tim Chevalier
39d45b75cc rustc: Anti-copy police 2013-04-15 19:06:36 -07:00
Huon Wilson
40e3577b08 libcore: missed an import for a test 2013-04-16 12:04:49 +10:00
Daniel Micay
f82c96446f iterator: use an IteratorUtil trait 2013-04-15 21:35:41 -04:00
Daniel Micay
a581926f57 update RELEASES.txt 2013-04-15 21:09:23 -04:00
bors
442b8e5901 auto merge of #5894 : catamorphism/rust/authors, r=catamorphism 2013-04-15 17:15:56 -07:00
Huon Wilson
ef3a8ebb9b librustdoc: move tests into dedicated tests module. 2013-04-16 09:57:47 +10:00
Huon Wilson
d3be98e9f5 libcore,std,syntax,rustc: move tests into mod tests, make them private (no pub mod or pub fn). 2013-04-16 09:57:47 +10:00
Tim Chevalier
0ef3e1eb25 Update AUTHORS.txt w/ Brett Cannon, Diggory Hardy, Jack Moffitt, James Miller 2013-04-15 16:26:49 -07:00
bors
dd2c7f61a9 auto merge of #5879 : astrieanna/rust/document_std_base64, r=catamorphism
This adds examples for the methods in std::base64.

Each example is complete in the sense that you can copy-paste it into a file and compile it successfully without adding anything (imports, etc). The hardest part of figuring out how to use this was figuring out the right import statements to put at the top.
2013-04-15 16:18:52 -07:00
bors
f10cf26e25 auto merge of #5861 : catamorphism/rust/rustpkg, r=catamorphism
r? @graydon

Pulled out tests into their own modules inside the files they test,
as per the draft style guidelines.

Started a new module, path_util, for utility functions to do with
paths and directories.

Changed default_dest_dir to use a condition and return Path
instead of Option<Path>.
2013-04-15 14:48:55 -07:00
bors
6ce689d61c auto merge of #5891 : brson/rust/valgrind, r=brson
Hopefully this puts out the final fire
2013-04-15 13:54:57 -07:00
Brian Anderson
6beddb966d Make valgrind suppressions more liberal
Hopefully this puts out the final fire
2013-04-15 13:20:23 -07:00
bors
4beebc427c auto merge of #5797 : alexcrichton/rust/issue-1913, r=catamorphism
Closes #5487, #1913, and #4568

I tracked this by adding all used unsafe blocks/functions to a set on the `tcx` passed around, and then when the lint pass comes around if an unsafe block/function isn't listed in that set, it's unused.

I also removed everything from the compiler that was unused, and up to stage2 is now compiling without any known unused unsafe blocks.

I chose `unused_unsafe` as the name of the lint attribute, but there may be a better name...
2013-04-15 13:00:56 -07:00
Jeong YunWon
9b55d86e74 Prevent eval_const_expr_partial hides prior error in expr_cast arm.
This will help not to meet confusing errors.
In issue #5873, the error was "expected constant expr for vector length: Can't cast str to int".
It was originally "expected constant expr for vector length: Non-constant path in constant expr"
This patch make the original error to be printed.
2013-04-16 04:13:37 +09:00
Tim Chevalier
7881bde027 Tidy 2013-04-15 11:52:38 -07:00
bors
39e2ab5e8b auto merge of #5888 : sawrubh/rust/mybranch, r=pnkfelix 2013-04-15 11:24:57 -07:00
Saurabh Anand
672ddeac37 Modified submodules to use https instead of git for git URL 2013-04-15 22:51:24 +05:30
bors
3809a04bf7 auto merge of #5778 : jld/rust/reflect-abstract-enum, r=graydon
This takes care of one of the last remnants of assumptions about enum layout.  A type visitor is now passed a function to read a value's discriminant, then accesses fields by being passed a byte offset for each one.  The latter may not be fully general, despite the constraints imposed on representations by borrowed pointers, but works for any representations currently planned and is relatively simple.

Closes #5652.
2013-04-15 09:57:55 -07:00
bors
7b152baddf auto merge of #5881 : danluu/rust/xfail_bind_by_move, r=graydon
Update an old test to pass. I'm not 100% sure what the intent of the test was, but it's hard to see how I could have corrupted the intent of the test from the tiny changes I made.
2013-04-15 08:06:57 -07:00
Dan Luu
caa1079257 Fix xfail'd ARC test 2013-04-14 11:35:58 -04:00
Leah Hanson
b5c9990c38 Change to 4-space indents in code examples 2013-04-14 09:24:13 -04:00
bors
1ab1354937 auto merge of #5880 : Dretch/rust/signals, r=thestinger
This is a follow-up to #5761. Its purpose is to make core::libc more consistent - it currently only defines SIGKILL and SIGTERM, because they are the only values that happen to be needed by libcore.

This adds all the posix signal value constants, except for those that have different values on different architectures.

The output of the command `man 7 signal` was used to compile these signal values.
2013-04-14 06:21:54 -07:00
gareth
6994340ca0 Flesh out the SIG* constants: this adds all the posix signal
value constants, except for those that have different values
on different architectures.

The output of the command `man 7 signal` was used to
compile these signal values.
2013-04-14 14:08:22 +01:00
Leah Hanson
ced12a74cd update copyright notice on base64.rs 2013-04-14 08:01:54 -04:00
bors
79d4f1402e auto merge of #5779 : crabtw/rust/x86_64_abi, r=sanxiyn
This fixes #5754.
2013-04-14 00:03:54 -07:00
Alex Crichton
59e69aa0e7 test: remove unnecessary unsafe blocks/functions 2013-04-14 01:15:46 -04:00
Jyun-Yan You
685c4d0b76 add rust_dbg_extern_identity_TwoDoubles to prevent check-fast failure 2013-04-14 13:15:46 +08:00
Alex Crichton
8978643f92 syntax: remove unnecessary unsafe blocks/functions 2013-04-14 01:15:46 -04:00
Alex Crichton
72c24e20a9 rustc: remove unnecessary unsafe blocks/methods 2013-04-14 01:15:46 -04:00
Alex Crichton
52445129fd std: remove unused unsafe blocks/functions 2013-04-14 01:15:46 -04:00
Alex Crichton
d9595d1737 core: remove unnecessary unsafe blocks/functions 2013-04-14 01:15:46 -04:00
Alex Crichton
4bfa3c6663 Add a lint mode for unused unsafe blocks/functions 2013-04-14 01:15:46 -04:00
bors
8c2e5cceee auto merge of #5867 : dotdash/rust/reduce_reallocs, r=graydon
The foldl based implementation allocates lots of unneeded vectors.
iter::map_to_vec is already optimized to avoid these.

One place that benefits quite a lot from this is the metadata decoder, helping with compile times for tiny programs.
2013-04-13 17:15:55 -07:00
Leah Hanson
2950152dc3 Merge pull request #1 from danluu/silly_style_changes
Doc review, as requested :-).
2013-04-13 16:11:57 -07:00
bors
04cc83614d auto merge of #5864 : huonw/rust/rusti-detect-tty, r=graydon
This is a fairly large hack, just passing an extra argument through, and I can't test it at all, since rusti doesn't work here to begin with.
2013-04-13 16:09:56 -07:00
bors
715810290f auto merge of #5810 : thestinger/rust/iterator, r=graydon
The current protocol is very comparable to Python, where `.__iter__()` returns an iterator object which implements `.__next__()` and throws `StopIteration` on completion. `Option` is much cleaner than using a exceptions as a flow control hack though. It requires that the container is frozen so there's no worry about invalidating them.

Advantages over internal iterators, which are functions that are passed closures and directly implement the iteration protocol:

* Iteration is stateful, so you can interleave iteration over arbitrary containers. That's needed to implement algorithms like zip, merge, set union, set intersection, set difference and symmetric difference. I already used this internally in the `TreeMap` and `TreeSet` implementations, but regions and traits weren't solid enough to make it generic yet.
* They provide a universal, generic interface. The same trait is used for a forward/reverse iterator, an iterator over a range, etc. Internal iterators end up resulting in a trait for each possible way you could iterate.
* They can be composed with adaptors like `ZipIterator`, which also implement the same trait themselves.

The disadvantage is that they're a pain to write without support from the compiler for compiling something like `yield` to a state machine. :)

This can coexist alongside internal iterators since both can use the current `for` protocol. It's easier to write an internal iterator, but external ones are far more powerful/useful so they should probably be provided whenever possible by the standard library.

## Current issues

#5801 is somewhat annoying since explicit type hints are required.

I just wanted to get the essentials working well, so I haven't put much thought into making the naming concise (free functions vs. static `new` methods, etc.).

Making an `Iterable` trait seems like it will have to be a long-term goal, requiring type system extensions. At least without resorting to objects which would probably be unacceptably slow.
2013-04-13 14:42:57 -07:00
bors
9f337a58ce auto merge of #5869 : bjz/rust/master, r=graydon
This restores the trait that was lost in 216e85fadf. `Num` will eventually be broken up into a more fine-grained trait hierarchy in the future once a design can be agreed upon.

To contribute to the discussion about the future of Rust's numeric traits, please see issue #4819 and the [wiki page](https://github.com/mozilla/rust/wiki/Bikeshed-Numeric-Traits).

I have also switched to [implementing NumCast using macros](353ce872e2). This removes a significant number of lines of code.
2013-04-13 13:51:58 -07:00
Dan Luu
78bc10d94b Doc review, as requested :-).
Mostly just phrasing things differently, which is a matter of taste. Feel free to use or not use any of the changes I'm suggesting.

I would say this one thing should be changed, though, not necessarily the way I changed it here.

     * Convert any string (literal, `@`, `&`, `~`)
     * that contains a base64 encoded value, to the byte values it encodes.

If this structure is going to be used, either the entire clause, 'that contains a base64 encoded value', should be bracketed by commas, or the comma at the end of the clause should be removed.
2013-04-13 16:17:30 -04:00
Brendan Zabarauskas
0615fddd80 Remove unnecessary enclosing modules for NumCast impls 2013-04-14 05:27:32 +10:00
Brendan Zabarauskas
c4685477e0 Consolidate tests of numeric operations 2013-04-14 02:53:00 +10:00
Brendan Zabarauskas
ce6ee7bb04 Restore Num trait
This restores the trait that was lost in 216e85fadf. It will eventually be broken up into a more fine-grained trait hierarchy in the future once a design can be agreed upon.
2013-04-14 02:19:35 +10:00
Brendan Zabarauskas
fde6995229 Remove trailing whitespace 2013-04-14 01:25:56 +10:00