Commit Graph

17114 Commits

Author SHA1 Message Date
Brian Anderson
93757d8185 core::rt: Clean up the thread-local scheduler code
Remove the ThreadLocalScheduler type in favor of functions.
Move everything into the sched::local module.
2013-04-14 21:53:37 -07:00
Brian Anderson
a2e5827866 core::rt: All context switches are followed by a cleanup action 2013-04-14 20:49:22 -07:00
Brian Anderson
5f52aecb1e core::rt: Schedulers only need a single cleanup_job at a time
Each context switch has up to one cleanup job and it is always
executed immediately after the context switch.
2013-04-14 19:24:43 -07:00
Brian Anderson
6b084bad25 core::rt: Insert calls to run_cleanup_tasks after all context switches 2013-04-14 18:56:22 -07:00
Brian Anderson
1cb78e736f core::rt: Rename block_running_task_and_then to deschedul_... 2013-04-14 16:12:30 -07:00
Brian Anderson
8e966216c7 core::rt: Restructure task_from_last_cleanup_job to borrow correctly
We need a number of mutable references to contexts so name it
`get_contexts` and return a tuple of all of them.
2013-04-14 16:05:16 -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
Brendan Zabarauskas
947ba206e1 Add a test to show how NumCast can be used in type parameters 2013-04-14 01:14:02 +10:00
Brendan Zabarauskas
353ce872e2 Generate NumCast impls and tests using macros 2013-04-14 01:14:02 +10:00
Brendan Zabarauskas
3ffd735b45 Clarify purpose of NumCast trait 2013-04-14 01:14:02 +10:00
Björn Steinbrink
a26d9db95f Avoid excessive allocations and copies in iter::to_vec
The foldl based implementation allocates lots of unneeded vectors.
iter::map_to_vec is already optimized to avoid these.
2013-04-13 14:29:14 +02:00
Leah Hanson
8e64b61df9 move rustdoc comments so that they attach to the functions rather than the impl blocks. 2013-04-13 08:11:39 -04:00
bors
e2d5cebe32 auto merge of #5761 : Dretch/rust/murder-death-kill, r=thestinger
As proposed in issue #5632.

I added some new stuff to libc - hopefully correctly. I only added a single signal constant (SIGKILL) because adding more seems complicated by differences between platforms - and since it is not required for issue #5632 then I figure that I can use a further pull request to flesh out the SIG* constants more.
2013-04-13 05:00:57 -07:00
Huon Wilson
c2b15345c7 librusti: only use std::rl if stdin is connected to a tty. 2013-04-13 21:30:21 +10:00
bors
d57aaae025 auto merge of #5863 : huonw/rust/rust-run-args, r=thestinger
e.g. 
```
$ cat echo.rs
fn main() {
   io::println(fmt!("%?", os::args()));
}
$ rust run echo.rs 1 2 3
~[~"./echo~", ~"1", ~"2", ~"3"]
```
2013-04-13 04:09:57 -07:00
Huon Wilson
d70f0f1a6e librust: make rust run file.rs past any extra arguments to the compiled program. 2013-04-13 21:02:43 +10:00
Daniel Micay
8bf9fc52f4 initial iterator object library 2013-04-13 05:51:14 -04:00
Jyun-Yan You
4ad8ec351a fix index out of bounds error of x86_64 ABI 2013-04-13 15:04:30 +08:00
bors
65ff441b3d auto merge of #5839 : bjz/rust/master, r=brson
r? @brson
2013-04-12 21:00:57 -07:00
Leah Hanson
27a0269501 Add comments for the implementations of from_base64 and to_base64 for . 2013-04-12 22:15:56 -04:00
Brian Anderson
a9247e07ac Suppress a bunch of valgrind errors 2013-04-12 18:49:40 -07:00
bors
16ccf9098b auto merge of #5859 : huonw/rust/gitignore, r=catamorphism 2013-04-12 16:24:57 -07:00
Huon Wilson
42b4b6771d Add some more generated files to the .gitignore file 2013-04-13 09:20:19 +10:00
Tim Chevalier
884c7c9326 rustpkg: Factor out tests; use a condition instead of returning an option
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-12 16:15:40 -07:00
bors
76f6606a8c auto merge of #5827 : nikomatsakis/rust/issue-5656-change-meaning-of-borrowed-self, r=pcwalton
See #5656 for details.

r? @pcwalton
2013-04-12 15:14:24 -07:00
bors
5bb2e8f62c auto merge of #5847 : catamorphism/rust/rustpkg, r=catamorphism
r? @graydon This is preliminary work on bringing rustpkg up to conformance with #5679
and related issues.

This change makes rustpkg infer a package ID from its containing directory,
instead of requiring name and vers attributes in the code. Many aspects of it
are incomplete; I've only tested one package (see README.txt) and one command,
"build". So far it only works for local packages.

I also removed code for several of the package commands other than "build",
replacing them with stubs that fail, since they used package IDs in ways that
didn't jibe well with the new scheme. I will re-implement the commands one
at a time.
2013-04-12 12:57:58 -07:00
Tim Chevalier
74fee15bc1 Tidy 2013-04-12 12:49:11 -07:00
Leah Hanson
2ec2d99bbd add rustdoc comments with examples for the string versions of to_base64 and from_base64 2013-04-12 09:41:07 -04:00