]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoauto merge of #12286 : sfackler/rust/no-conditions, r=alexcrichton
bors [Sat, 15 Feb 2014 11:56:27 +0000 (03:56 -0800)]
auto merge of #12286 : sfackler/rust/no-conditions, r=alexcrichton

10 years agoauto merge of #12283 : kballard/rust/env-args-bytes, r=erickt
bors [Sat, 15 Feb 2014 10:36:27 +0000 (02:36 -0800)]
auto merge of #12283 : kballard/rust/env-args-bytes, r=erickt

Change `os::args()` and `os::env()` to use `str::from_utf8_lossy()`.
Add new functions `os::args_as_bytes()` and `os::env_as_bytes()` to retrieve the args/env as byte vectors instead.

The existing methods were left returning strings because I expect that the common use-case is to want string handling.

Fixes #7188.

10 years agoauto merge of #12230 : DaGenix/rust/io-decorator-changes, r=sfackler
bors [Sat, 15 Feb 2014 07:46:29 +0000 (23:46 -0800)]
auto merge of #12230 : DaGenix/rust/io-decorator-changes, r=sfackler

I created RefReader and RefWriter structs that wrap a mutable reference to a Reader or Writer value. This works exactly like the ByRef struct in the iter module and allows passing a reference to a Reader or Writer to function expecting a Reader or Writer by value with the caller retaining ownership to the original value.

I also modified LimitReader to take the wrapped Reader by value instead of by reference.

@sfackler

10 years agoRemove broken link to old conditions tutorial
Steven Fackler [Sat, 15 Feb 2014 07:44:31 +0000 (23:44 -0800)]
Remove broken link to old conditions tutorial

10 years agoUpdate LimitReader to take the Reader to wrap by value
Palmer Cox [Fri, 14 Feb 2014 04:28:11 +0000 (23:28 -0500)]
Update LimitReader to take the Reader to wrap by value

10 years agoCreate RefReader and RefWriter adaptor structs
Palmer Cox [Fri, 14 Feb 2014 04:27:53 +0000 (23:27 -0500)]
Create RefReader and RefWriter adaptor structs

RefReader and RefWriter allow a caller to pass a Reader or Writer
instance by reference to generic functions that are expecting arguments
by value.

10 years agoUse str::from_utf8_lossy() for os::env() and friends
Kevin Ballard [Fri, 14 Feb 2014 23:18:51 +0000 (15:18 -0800)]
Use str::from_utf8_lossy() for os::env() and friends

Parse the environment by default with from_utf8_lossy. Also provide
byte-vector equivalents (e.g. os::env_as_bytes()).

Unfortunately, setenv() can't have a byte-vector equivalent because of
Windows support, unless we want to define a setenv_bytes() that fails
under Windows for non-UTF8 (or non-UTF16).

10 years agoUse str::from_utf8_lossy() in os::args(), add os::args_as_bytes()
Kevin Ballard [Fri, 14 Feb 2014 22:42:40 +0000 (14:42 -0800)]
Use str::from_utf8_lossy() in os::args(), add os::args_as_bytes()

os::args() was using str::raw::from_c_str(), which would assert if the
C-string wasn't valid UTF-8. Switch to using from_utf8_lossy() instead,
and add a separate function os::args_as_bytes() that returns the ~[u8]
byte-vectors instead.

10 years agoAdd c_str::CString.as_bytes_no_nul()
Kevin Ballard [Fri, 14 Feb 2014 23:42:35 +0000 (15:42 -0800)]
Add c_str::CString.as_bytes_no_nul()

10 years agoauto merge of #12274 : brson/rust/mkfiles, r=alexcrichton
bors [Sat, 15 Feb 2014 04:51:26 +0000 (20:51 -0800)]
auto merge of #12274 : brson/rust/mkfiles, r=alexcrichton

I've been working on binary installers and ended up taking this detour, which does a few things:

* It expands the documentation on the build system with new comments in Makefile.in
* It displays some of that documentation via `make help`
* Removes some unused and broken snapshot code
* Adds `NO_MKFILE_DEPS` to convenience makefile hacking
* Moves almost all of Makefile.in to files in `mk/`

The documentation provided by `make help` and its implementation are somewhat quirky.

10 years agoauto merge of #12276 : alexcrichton/rust/issue-8449, r=kballard
bors [Sat, 15 Feb 2014 03:31:28 +0000 (19:31 -0800)]
auto merge of #12276 : alexcrichton/rust/issue-8449, r=kballard

This was just waiting for compiler-rt support, which was added in #12027

Closes #8449

10 years agoEnable 64-bit checked multiplication on 32-bit
Alex Crichton [Fri, 14 Feb 2014 20:54:15 +0000 (12:54 -0800)]
Enable 64-bit checked multiplication on 32-bit

This was just waiting for compiler-rt support, which was added in #12027

Closes #8449

10 years agomk: Address review feedback
Brian Anderson [Sat, 15 Feb 2014 03:17:50 +0000 (19:17 -0800)]
mk: Address review feedback

10 years agoauto merge of #12277 : alexcrichton/rust/fix-rustdoc-render, r=huonw
bors [Sat, 15 Feb 2014 01:51:29 +0000 (17:51 -0800)]
auto merge of #12277 : alexcrichton/rust/fix-rustdoc-render, r=huonw

The std macros used to be injected with a filename of "<std-macros>", but macros
are now injected with a filename of "<{} macros>" where `{}` is filled in with
the crate name. This updates rustdoc to understand this new system so it'll
render source more frequently.

10 years agomk: Move version info to top of main.mk
Brian Anderson [Fri, 14 Feb 2014 19:24:22 +0000 (11:24 -0800)]
mk: Move version info to top of main.mk

Just so it's easier to find.

10 years agomk: Improve build system help commands
Brian Anderson [Fri, 14 Feb 2014 11:34:18 +0000 (03:34 -0800)]
mk: Improve build system help commands

10 years agomk: Add NO_MKFILE_DEPS for turning off rebuild from makefile changes
Brian Anderson [Fri, 14 Feb 2014 08:10:06 +0000 (00:10 -0800)]
mk: Add NO_MKFILE_DEPS for turning off rebuild from makefile changes

10 years agomk: Move most of Makefile.in to .mk files
Brian Anderson [Fri, 14 Feb 2014 07:55:49 +0000 (23:55 -0800)]
mk: Move most of Makefile.in to .mk files

Because the build system treats Makefile.in and the .mk files slightly
differently (.in is copied, .mk are included), this makes the system
more uniform. Fewer build system changes will require a complete
reconfigure.

10 years agomk: Remove the concept of 'snapshot transitions'
Brian Anderson [Fri, 14 Feb 2014 07:25:07 +0000 (23:25 -0800)]
mk: Remove the concept of 'snapshot transitions'

This way of doing snapshots hasn't been used since 2011.

10 years agomk: Add some serious documentation and 'make help'
Brian Anderson [Fri, 14 Feb 2014 05:22:08 +0000 (21:22 -0800)]
mk: Add some serious documentation and 'make help'

'make help' is implemented in a fairly ridiculous way, using awk
to parse comments out of Makefile.in and displaying them.

10 years agoauto merge of #12271 : kballard/rust/vim-extern-crate, r=huonw
bors [Fri, 14 Feb 2014 23:51:29 +0000 (15:51 -0800)]
auto merge of #12271 : kballard/rust/vim-extern-crate, r=huonw

10 years agoAdd crate keyword to gedit language spec
Kevin Ballard [Fri, 14 Feb 2014 23:37:22 +0000 (15:37 -0800)]
Add crate keyword to gedit language spec

10 years agoAdd crate to emacs and kate modefiles
Kevin Ballard [Fri, 14 Feb 2014 22:36:37 +0000 (14:36 -0800)]
Add crate to emacs and kate modefiles

10 years agoauto merge of #12195 : kballard/rust/rustdoc-strip-impls-of-stripped, r=cmr
bors [Fri, 14 Feb 2014 21:36:35 +0000 (13:36 -0800)]
auto merge of #12195 : kballard/rust/rustdoc-strip-impls-of-stripped, r=cmr

Strip trait impls for types that are stripped either due to the strip-hidden or strip-private passes.

This fixes the search index including trait methods on stripped structs (which breaks searching), and it also removes private types from the implementors list of a trait.

Fixes #9981 and #11439.

10 years agoUpdate restrictions on rustdoc source rendering
Alex Crichton [Fri, 14 Feb 2014 21:11:36 +0000 (13:11 -0800)]
Update restrictions on rustdoc source rendering

The std macros used to be injected with a filename of "<std-macros>", but macros
are now injected with a filename of "<{} macros>" where `{}` is filled in with
the crate name. This updates rustdoc to understand this new system so it'll
render source more frequently.

10 years agoauto merge of #12267 : alexcrichton/rust/rollup, r=alexcrichton
bors [Fri, 14 Feb 2014 20:21:51 +0000 (12:21 -0800)]
auto merge of #12267 : alexcrichton/rust/rollup, r=alexcrichton

The last commit has the closed PRs

10 years agoAdd CheckedDiv to vim syntax
Kevin Ballard [Fri, 14 Feb 2014 20:02:18 +0000 (12:02 -0800)]
Add CheckedDiv to vim syntax

10 years agoUpdate vim syntax for extern crate
Kevin Ballard [Fri, 14 Feb 2014 19:27:53 +0000 (11:27 -0800)]
Update vim syntax for extern crate

10 years agoTest fixes and rebase conflicts from rollups
Alex Crichton [Fri, 14 Feb 2014 16:42:23 +0000 (08:42 -0800)]
Test fixes and rebase conflicts from rollups

PRs closed as part of this:

Closes #12212 r=alexcrichton
Closes #12215 r=brson
Closes #12246 r=pcwalton
Closes #12247 r=cmr
Closes #12251 r=brson
Closes #12255 r=alexcrichton
Closes #12257 r=alexcrichton
Closes #12258 r=huonw
Closes #12259 r=huonw
Closes #12263 r=kballard
Closes #12269 r=alexcrichton

10 years agotutorial: stronger wording in build instructions
Corey Richardson [Fri, 14 Feb 2014 18:55:30 +0000 (13:55 -0500)]
tutorial: stronger wording in build instructions

10 years agorustdoc: Strip impls of traits on #[doc(hidden)] types
Kevin Ballard [Tue, 11 Feb 2014 22:42:23 +0000 (14:42 -0800)]
rustdoc: Strip impls of traits on #[doc(hidden)] types

In the strip-hidden pass, record all types that were stripped, and make
a second pass stripping all impls of traits for these types.

10 years agorustdoc: Strip impls of stripped private types
Kevin Ballard [Tue, 11 Feb 2014 22:29:23 +0000 (14:29 -0800)]
rustdoc: Strip impls of stripped private types

In strip-private, also strip impls of traits for private types. This
fixes the search index so searching for "drop", "eq", etc doesn't throw
an exception.

10 years agoAdd MKFILE_DEPS to compiler-rt target
Alex Crichton [Fri, 14 Feb 2014 16:13:19 +0000 (08:13 -0800)]
Add MKFILE_DEPS to compiler-rt target

Currently when you run `make -jN` it's likely that you'll remove compiler-rt and
then it won't get cp'd back into the right place. I believe the reason for this
is that the compiler-rt library target never got updated so make decided it
never needed to copy the files back into place. The files were all there at the
beginning of `make`, but then we may clean out the stage0 versions if we unzip
the snapshot again.

10 years agoauto merge of #12205 : alexcrichton/rust/nodefaultlibs, r=brson
bors [Fri, 14 Feb 2014 18:41:45 +0000 (10:41 -0800)]
auto merge of #12205 : alexcrichton/rust/nodefaultlibs, r=brson

This will hopefully bring us closer to #11937. We're still using gcc's idea of
"startup files", but this should prevent us from leaking in dependencies that we
don't quite want (libgcc for example once compiler-rt is what we use).

10 years agoInvoke gcc with -nodefaultlibs
Alex Crichton [Tue, 4 Feb 2014 16:37:07 +0000 (08:37 -0800)]
Invoke gcc with -nodefaultlibs

This will hopefully bring us closer to #11937. We're still using gcc's idea of
"startup files", but this should prevent us from leaking in dependencies that we
don't quite want (libgcc for example once compiler-rt is what we use).

10 years agoRemoved the obsolete ast::CallSugar (previously used by `do`).
Eduard Burtescu [Fri, 14 Feb 2014 08:28:32 +0000 (10:28 +0200)]
Removed the obsolete ast::CallSugar (previously used by `do`).

10 years agoExpand ItemDecorator extensions in all contexts
Steven Fackler [Fri, 14 Feb 2014 06:57:43 +0000 (22:57 -0800)]
Expand ItemDecorator extensions in all contexts

Now that fold_item can return multiple items, this is pretty trivial. It
also recursively expands generated items so ItemDecorators can generate
items that are tagged with ItemDecorators!

Closes #4913

10 years agoAdd test for #8860
Edward Wang [Fri, 14 Feb 2014 05:27:05 +0000 (13:27 +0800)]
Add test for #8860

10 years agoRemoved libextra dependency from libsyntax.
HeroesGrave [Fri, 14 Feb 2014 03:51:26 +0000 (16:51 +1300)]
Removed libextra dependency from libsyntax.

10 years agoAdd function doc comments for extra::url::*
Dave Hodder [Thu, 13 Feb 2014 22:28:22 +0000 (22:28 +0000)]
Add function doc comments for extra::url::*

10 years agoEnsure an error is raised on infinite recursion
Flavio Percoco [Thu, 13 Feb 2014 20:19:03 +0000 (21:19 +0100)]
Ensure an error is raised on infinite recursion

10 years agoDon't copy &Trait and &mut Trait to temporaries for every call.
Eduard Burtescu [Thu, 13 Feb 2014 19:52:53 +0000 (21:52 +0200)]
Don't copy &Trait and &mut Trait to temporaries for every call.

10 years agoextra: Capture stdout/stderr of tests by default
Alex Crichton [Wed, 12 Feb 2014 18:25:09 +0000 (10:25 -0800)]
extra: Capture stdout/stderr of tests by default

When tests fail, their stdout and stderr is printed as part of the summary, but
this helps suppress failure messages from #[should_fail] tests and generally
clean up the output of the test runner.

10 years agoreturn value/use extra::test::black_box in benchmarks
lpy [Wed, 12 Feb 2014 15:39:21 +0000 (23:39 +0800)]
return value/use extra::test::black_box in benchmarks

10 years agoauto merge of #12207 : alexcrichton/rust/up-llvm, r=sfackler
bors [Fri, 14 Feb 2014 15:26:40 +0000 (07:26 -0800)]
auto merge of #12207 : alexcrichton/rust/up-llvm, r=sfackler

Includes an upstream commit by pcwalton to improve codegen of our enums getting
moved around.

This also introduces a new commit on top of our stack of patches to fix a mingw32 build issue. I have submitted the patch upstream: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140210/204653.html

I verified that this builds on the try bots, which amazes me because I think that c++11 is turned on now, but I guess we're still lucky!

Closes #10613 (pcwalton's patch landed)
Closes #11992 (llvm has removed these options)

10 years agoUpgrade LLVM
Alex Crichton [Thu, 6 Feb 2014 19:29:28 +0000 (11:29 -0800)]
Upgrade LLVM

Includes an upstream commit by pcwalton to improve codegen of our enums getting
moved around.

10 years agoauto merge of #12234 : sfackler/rust/restructure-item-decorator, r=huonw
bors [Fri, 14 Feb 2014 14:11:43 +0000 (06:11 -0800)]
auto merge of #12234 : sfackler/rust/restructure-item-decorator, r=huonw

The old method of building up a list of items and threading it through
all of the decorators was unwieldy and not really scalable as
non-deriving ItemDecorators become possible. The API is now that the
decorator gets an immutable reference to the item it's attached to, and
a callback that it can pass new items to. If we want to add syntax
extensions that can modify the item they're attached to, we can add that
later, but I think it'll have to be separate from ItemDecorator to avoid
strange ordering issues.

@huonw

10 years agoauto merge of #12192 : luqmana/rust/fix-cross, r=alexcrichton
bors [Fri, 14 Feb 2014 09:41:46 +0000 (01:41 -0800)]
auto merge of #12192 : luqmana/rust/fix-cross, r=alexcrichton

Fix some fall out from the big command line option changes.

10 years agoauto merge of #12186 : alexcrichton/rust/no-sleep-2, r=brson
bors [Fri, 14 Feb 2014 08:26:47 +0000 (00:26 -0800)]
auto merge of #12186 : alexcrichton/rust/no-sleep-2, r=brson

Any single-threaded task benchmark will spend a good chunk of time in `kqueue()` on osx and `epoll()` on linux, and the reason for this is that each time a task is terminated it will hit the syscall. When a task terminates, it context switches back to the scheduler thread, and the scheduler thread falls out of `run_sched_once` whenever it figures out that it did some work.

If we know that `epoll()` will return nothing, then we can continue to do work locally (only while there's work to be done). We must fall back to `epoll()` whenever there's active I/O in order to check whether it's ready or not, but without that (which is largely the case in benchmarks), we can prevent the costly syscall and can get a nice speedup.

I've separated the commits into preparation for this change and then the change itself, the last commit message has more details.

10 years agoauto merge of #12162 : eddyb/rust/ast-map-cheap-path, r=nikomatsakis
bors [Fri, 14 Feb 2014 07:06:46 +0000 (23:06 -0800)]
auto merge of #12162 : eddyb/rust/ast-map-cheap-path, r=nikomatsakis

10 years agoRefactored ast_map and friends, mainly to have Paths without storing them.
Eduard Burtescu [Fri, 14 Feb 2014 05:07:09 +0000 (07:07 +0200)]
Refactored ast_map and friends, mainly to have Paths without storing them.

10 years agoTweak ItemDecorator API
Steven Fackler [Thu, 13 Feb 2014 07:53:52 +0000 (23:53 -0800)]
Tweak ItemDecorator API

The old method of building up a list of items and threading it through
all of the decorators was unwieldy and not really scalable as
non-deriving ItemDecorators become possible. The API is now that the
decorator gets an immutable reference to the item it's attached to, and
a callback that it can pass new items to. If we want to add syntax
extensions that can modify the item they're attached to, we can add that
later, but I think it'll have to be separate from ItemDecorator to avoid
strange ordering issues.

10 years agoauto merge of #12256 : brson/rust/android, r=alexcrichton
bors [Fri, 14 Feb 2014 05:51:52 +0000 (21:51 -0800)]
auto merge of #12256 : brson/rust/android, r=alexcrichton

Android bot has been having some problems. A few details in the commits.

10 years agoStop looping on error waiting for android test results
Brian Anderson [Fri, 14 Feb 2014 05:19:06 +0000 (21:19 -0800)]
Stop looping on error waiting for android test results

These seem to be causing iloops on the bots. Let's rather see the errors.

10 years agocompiletest: Run all android tests serially
Brian Anderson [Fri, 14 Feb 2014 05:17:02 +0000 (21:17 -0800)]
compiletest: Run all android tests serially

This is an attempt to isolate test failures on the bots. It may also
eliminate problems with the emulators breaking by reducing the chance
of OOM.

10 years agoauto merge of #12172 : alexcrichton/rust/green-improvements, r=brson
bors [Fri, 14 Feb 2014 04:36:55 +0000 (20:36 -0800)]
auto merge of #12172 : alexcrichton/rust/green-improvements, r=brson

These commits pick off some low-hanging fruit which were slowing down spawning green threads. The major speedup comes from fixing a bug in stack caching where we never used any cached stacks!

The program I used to benchmark is at the end. It was compiled with `rustc --opt-level=3 bench.rs --test` and run as `RUST_THREADS=1 ./bench --bench`. I chose to use `RUST_THREADS=1` due to #11730 as the profiles I was getting interfered too much when all the schedulers were in play (and shouldn't be after #11730 is fixed). All of the units below are in ns/iter as reported by `--bench` (lower is better).

|               | green | native | raw    |
| ------------- | ----- | ------ | ------ |
| osx before    | 12699 | 24030  | 19734  |
| linux before  | 10223 | 125983 | 122647 |
| osx after     |  3847 | 25771  | 20835  |
| linux after   |  2631 | 135398 | 122765 |

Note that this is *not* a benchmark of spawning green tasks vs native tasks. I put in the native numbers just to get a ballpark of where green tasks are. This is benchmark is *clearly* benefiting from stack caching. Also, OSX is clearly not 5x faster than linux, I think my VM is just much slower.

All in all, this ended up being a nice 4x speedup for spawning a green task when you're using a cached stack.

```rust
extern mod extra;
extern mod native;
use std::rt::thread::Thread;

#[bench]
fn green(bh: &mut extra::test::BenchHarness) {
    let (p, c) = SharedChan::new();
    bh.iter(|| {
        let c = c.clone();
        spawn(proc() {
            c.send(());
        });
        p.recv();
    });
}

#[bench]
fn native(bh: &mut extra::test::BenchHarness) {
    let (p, c) = SharedChan::new();
    bh.iter(|| {
        let c = c.clone();
        native::task::spawn(proc() {
            c.send(());
        });
        p.recv();
    });
}

#[bench]
fn raw(bh: &mut extra::test::BenchHarness) {
    bh.iter(|| {
        Thread::start(proc() {}).join()
    });
}
```

10 years agoRemove two allocations from spawning a green task
Alex Crichton [Tue, 11 Feb 2014 00:13:50 +0000 (16:13 -0800)]
Remove two allocations from spawning a green task

Two unfortunate allocations were wrapping a proc() in a proc() with
GreenTask::build_start_wrapper, and then boxing this proc in a ~proc() inside of
Context::new(). Both of these allocations were a direct result from two
conditions:

1. The Context::new() function has a nice api of taking a procedure argument to
   start up a new context with. This inherently required an allocation by
   build_start_wrapper because extra code needed to be run around the edges of a
   user-provided proc() for a new task.

2. The initial bootstrap code only understood how to pass one argument to the
   next function. By modifying the assembly and entry points to understand more
   than one argument, more information is passed through in registers instead of
   allocating a pointer-sized context.

This is sadly where I end up throwing mips under a bus because I have no idea
what's going on in the mips context switching code and don't know how to modify
it.

Closes #7767
cc #11389

10 years agoDon't require an allocation for on_exit messages
Alex Crichton [Mon, 10 Feb 2014 22:49:56 +0000 (14:49 -0800)]
Don't require an allocation for on_exit messages

Instead, use an enum to allow running both a procedure and sending the task
result over a channel. I expect the common case to be sending on a channel (e.g.
task::try), so don't require an extra allocation in the common case.

cc #11389

10 years agoDon't allocate in LocalHeap::new()
Alex Crichton [Mon, 10 Feb 2014 22:41:57 +0000 (14:41 -0800)]
Don't allocate in LocalHeap::new()

One of these is allocated for every task, trying to cut down on allocations

cc #11389

10 years agoFix a bug where cached stacks weren't re-used
Alex Crichton [Mon, 10 Feb 2014 22:17:10 +0000 (14:17 -0800)]
Fix a bug where cached stacks weren't re-used

The condition was the wrong direction and it also didn't take equality into
account. Tests were added for both cases.

For the small benchmark of `task::try(proc() {}).unwrap()`, this takes the
iteration time on OSX from 15119 ns/iter to 6179 ns/iter (timed with
RUST_THREADS=1)

cc #11389

10 years agoauto merge of #12061 : pongad/rust/delorderable, r=cmr
bors [Fri, 14 Feb 2014 03:16:59 +0000 (19:16 -0800)]
auto merge of #12061 : pongad/rust/delorderable, r=cmr

#12057

10 years agoRemoved num::Orderable
Michael Darakananda [Thu, 6 Feb 2014 07:34:33 +0000 (02:34 -0500)]
Removed num::Orderable

10 years agoauto merge of #12017 : FlaPer87/rust/replace-mod-crate, r=alexcrichton
bors [Fri, 14 Feb 2014 00:32:01 +0000 (16:32 -0800)]
auto merge of #12017 : FlaPer87/rust/replace-mod-crate, r=alexcrichton

The first setp for #9880 is to add a new `crate` keyword. This PR does exactly that. I took a chance to refactor `parse_item_foreign_mod` and I broke it down into 2 separate methods to isolate each feature.

The next step will be to push a new stage0 snapshot and then get rid of all `extern mod` around the code.

10 years agoauto merge of #12248 : alexcrichton/rust/rollup, r=alexcrichton
bors [Thu, 13 Feb 2014 23:17:21 +0000 (15:17 -0800)]
auto merge of #12248 : alexcrichton/rust/rollup, r=alexcrichton

This passed `make check` locally, so hopefully it passes on bors!

10 years agomk: Fix non-android cross builds.
Luqman Aden [Tue, 11 Feb 2014 21:51:08 +0000 (16:51 -0500)]
mk: Fix non-android cross builds.

10 years agoRebase conflicts from this giant stack of patches
Alex Crichton [Thu, 13 Feb 2014 20:50:46 +0000 (12:50 -0800)]
Rebase conflicts from this giant stack of patches

List of PRs contained in this rollup:

Closes #12167 r=alexcrichton
Closes #12200 r=alexcrichton
Closes #12206 r=pcwalton
Closes #12209 r=huonw
Closes #12211 r=pcwalton
Closes #12217 r=brson
Closes #12218 r=alexcrichton
Closes #12220 r=alexcrichton
Closes #12222 r=kballard
Closes #12225 r=alexcrichton
Closes #12227 r=kballard
Closes #12237 r=alexcrichton
Closes #12240 r=kballard

10 years agoLift $dst outside the closure in write!
Alex Crichton [Thu, 13 Feb 2014 12:31:19 +0000 (04:31 -0800)]
Lift $dst outside the closure in write!

If you were writing to something along the lines of `self.foo` then with the new
closure rules it meant that you were borrowing `self` for the entirety of the
closure, meaning that you couldn't format other fields of `self` at the same
time as writing to a buffer contained in `self`.

By lifting the borrow outside of the closure the borrow checker can better
understand that you're only borrowing one of the fields at a time. This had to
use type ascription as well in order to preserve trait object coercions.

10 years agoremove duplicate function from std::ptr (is_null, is_not_null, offset, mut_offset)
JeremyLetang [Mon, 10 Feb 2014 21:50:42 +0000 (16:50 -0500)]
remove duplicate function from std::ptr (is_null, is_not_null, offset, mut_offset)

10 years agoRegister new snapshots
Alex Crichton [Thu, 13 Feb 2014 00:40:17 +0000 (16:40 -0800)]
Register new snapshots

10 years agomk: make NO_REBUILD more forceful and more general.
Huon Wilson [Thu, 13 Feb 2014 08:35:43 +0000 (19:35 +1100)]
mk: make NO_REBUILD more forceful and more general.

Previously crates like `green` and `native` would still depend on their
parents when running `make check-stage2-green NO_REBUILD=1`, this
ensures that they only depend on their source files.

Also, apply NO_REBUILD to the crate doc tests, so, for example,
`check-stage2-doc-std` will use an already compiled `rustdoc` directly.

10 years agoRelax an assertion in start_selection()
Alex Crichton [Thu, 13 Feb 2014 04:51:42 +0000 (20:51 -0800)]
Relax an assertion in start_selection()

It asserted that the previous count was always nonnegative, but DISCONNECTED is
a valid value for it to see. In order to continue to remember to store
DISCONNECTED after DISCONNECTED was seen, I also added a helper method.

Closes #12226

10 years agostd::comm: replace Handle.id with a method.
Huon Wilson [Thu, 13 Feb 2014 03:10:29 +0000 (14:10 +1100)]
std::comm: replace Handle.id with a method.

The `id` shouldn't be changed by external code, and exposing it publicly
allows to be accidentally changed.

Also, remove the first element special case in the `select!` macro.

10 years agoAdd documentation for conditional-compilation
Tobias Bucher [Wed, 12 Feb 2014 23:38:14 +0000 (00:38 +0100)]
Add documentation for conditional-compilation

This documents in-source conditions using #[cfg(...)] and configurations
pre-defined by the compiler.

Fix #7962.

10 years agoAdd some missing Show implementations in libstd
Brendan Zabarauskas [Wed, 12 Feb 2014 19:41:34 +0000 (06:41 +1100)]
Add some missing Show implementations in libstd

10 years agoMove base64 and hex from libextra to libserialize
Liigo Zhuang [Wed, 12 Feb 2014 00:40:52 +0000 (08:40 +0800)]
Move base64 and hex from libextra to libserialize

10 years agoRemove a source of O(n^2) running time in bigints.
Felix S. Klock II [Sun, 9 Feb 2014 22:13:47 +0000 (23:13 +0100)]
Remove a source of O(n^2) running time in bigints.

::num::bigint, Remove a source of O(n^2) running time in `fn shr_bits`.

I'll cut to the chase: On my laptop, this brings the running time on
`pidigits 2000` (from src/test/bench/shootout-pidigits.rs) from this:
```
% time ./pidigits 2000 > /dev/null

real 0m7.695s
user 0m7.690s
sys 0m0.005s
```
to this:
```
% time ./pidigits 2000 > /dev/null

real 0m0.322s
user 0m0.318s
sys 0m0.004s
```

The previous code was building up a vector by repeatedly making a
fresh copy for each element that was unshifted onto the front,
yielding quadratic running time.  This fixes that by building up the
vector in reverse order (pushing elements onto the end) and then
reversing it.

(Another option would be to build up a zero-initialized vector of the
desired length and then installing all of the shifted result elements
into their target index, but this was easier to hack up quickly, and
yields the desired asymptotic improvement.  I have been thinking of
adding a `vec::from_fn_rev` to handle this case, maybe I will try that
this weekend.)

10 years agoResolve type variables when checking casting to char
Seo Sanghyeon [Wed, 12 Feb 2014 15:42:28 +0000 (00:42 +0900)]
Resolve type variables when checking casting to char

10 years agoInclude compiler-rt in the distribution tarballs
Alex Crichton [Wed, 12 Feb 2014 19:42:58 +0000 (11:42 -0800)]
Include compiler-rt in the distribution tarballs

10 years agoStop unloading syntax libraries
Steven Fackler [Wed, 12 Feb 2014 06:43:23 +0000 (22:43 -0800)]
Stop unloading syntax libraries

Externally loaded libraries are able to do things that cause references
to them to survive past the expansion phase (e.g. creating @-box cycles,
launching a task or storing something in task local data). As such, the
library has to stay loaded for the lifetime of the process.

10 years agoRemove obsolete warnings for `extern mod`
Flavio Percoco [Mon, 3 Feb 2014 21:49:14 +0000 (22:49 +0100)]
Remove obsolete warnings for `extern mod`

This patch gets rid of ObsoleteExternModAttributesInParens and
ObsoleteNamedExternModule since the replacement of `extern mod` with
`extern crate` avoids those cases and raises different errors. Both have
been around for at least a version which makes this a good moment to get
rid of them.

10 years agoReplace `extern mod` with `extern crate`
Flavio Percoco [Sun, 2 Feb 2014 22:52:06 +0000 (23:52 +0100)]
Replace `extern mod` with `extern crate`

This patch adds a new keyword `crate` which is intended to replace mod
in the context of `extern mod` as part of the issue #9880. The patch
doesn't replace all `extern mod` cases since it is necessary to first
push a new snapshot 0.

The implementation could've been less invasive than this. However I
preferred to take this chance to split the `parse_item_foreign_mod`
method and pull the `extern crate` part out of there, hence the new
method `parse_item_foreign_crate`.

10 years agoReplace `crate` usage with `krate`
Flavio Percoco [Wed, 5 Feb 2014 21:15:24 +0000 (22:15 +0100)]
Replace `crate` usage with `krate`

This patch replaces all `crate` usage with `krate` before introducing the
new keyword. This ensures that after introducing the keyword, there
won't be any compilation errors.

krate might not be the most expressive substitution for crate but it's a
very close abbreviation for it. `module` was already used in several
places already.

10 years agoauto merge of #12210 : zr40/rust/patch-1, r=cmr
bors [Thu, 13 Feb 2014 18:32:18 +0000 (10:32 -0800)]
auto merge of #12210 : zr40/rust/patch-1, r=cmr

According to kimundi on IRC, the current term for `()` is 'unit'. This commit updates tutorial.md to change 'nil' to 'unit' where `()` is described.

10 years agoauto merge of #12165 : fhahn/rust/change-some-tests, r=alexcrichton
bors [Wed, 12 Feb 2014 22:51:48 +0000 (14:51 -0800)]
auto merge of #12165 : fhahn/rust/change-some-tests, r=alexcrichton

While working on #11363 I stumbled over a couple of ignored tests, that seem to be fixed or invalid.

* src/test/run-pass/issue-3559.rs was fixed in #4726
* src/test/compile-fail/borrowck-call-sendfn.rs was fixed in #2978
* update src/test/compile-fail/issue-5500-1.rs to work with current Rust (I'm not 100% sure if the original condition is tested as mentioned in #5500, but I think so)
* removed src/test/compile-fail/issue-5500.rs because it is tested in
    src/test/run-fail/issue-5500.rs (they are the same test cases, I just renamed src/test/run-fail/addr-of-bot.rs to be consistent with the other issue name

10 years agoauto merge of #12216 : alexcrichton/rust/another-snap-fix, r=brson
bors [Wed, 12 Feb 2014 19:51:49 +0000 (11:51 -0800)]
auto merge of #12216 : alexcrichton/rust/another-snap-fix, r=brson

Hurray more snapshot blockers!

10 years agoIgnore another fourcc test on cross compiles
Alex Crichton [Wed, 12 Feb 2014 19:24:34 +0000 (11:24 -0800)]
Ignore another fourcc test on cross compiles

10 years agoReenable some ignored test cases
Florian Hahn [Mon, 10 Feb 2014 21:37:14 +0000 (22:37 +0100)]
Reenable some ignored test cases

* src/test/run-pass/issue-3559.rs was fixed in #4726
* src/test/compile-fail/borrowck-call-sendfn.rs was fixed in #2978
* update src/test/compile-fail/issue-5500-1.rs to work with current Rust
* removed src/test/compile-fail/issue-5500.rs because it is tested in
    src/test/run-fail/issue-5500.rs
* src/test/compile-fail/view-items-at-top.rs fixed
* #897 fixed
* compile-fail/issue-6762.rs issue was closed as dup of #6801
* deleted compile-fail/issue-2074.rs because it became irelevant and is
  irrelevant #2074, a test covering this was added in
  4f92f452bd701fb39156d66d4756cc48cc396a8a

10 years agoDon't hit epoll unless a scheduler absolutely must
Alex Crichton [Tue, 11 Feb 2014 06:48:45 +0000 (22:48 -0800)]
Don't hit epoll unless a scheduler absolutely must

Currently, a scheduler will hit epoll() or kqueue() at the end of *every task*.
The reason is that the scheduler will context switch back to the scheduler task,
terminate the previous task, and then return from run_sched_once. In doing so,
the scheduler will poll for any active I/O.

This shows up painfully in benchmarks that have no I/O at all. For example, this
benchmark:

    for _ in range(0, 1000000) {
        spawn(proc() {});
    }

In this benchmark, the scheduler is currently wasting a good chunk of its time
hitting epoll() when there's always active work to be done (run with
RUST_THREADS=1).

This patch uses the previous two commits to alter the scheduler's behavior to
only return from run_sched_once if no work could be found when trying really
really hard. If there is active I/O, this commit will perform the same as
before, falling back to epoll() to check for I/O completion (to not starve I/O
tasks).

In the benchmark above, I got the following numbers:

    12.554s on today's master
    3.861s  with #12172 applied
    2.261s  with both this and #12172 applied

cc #8341

10 years agoPercolate the (Scheduler, GreenTask) pair upwards
Alex Crichton [Tue, 11 Feb 2014 06:14:42 +0000 (22:14 -0800)]
Percolate the (Scheduler, GreenTask) pair upwards

This is in preparation for running do_work in a loop while there are no active
I/O handles. This changes the do_work and interpret_message_queue methods to
return a triple where the last element is a boolean flag as to whether work was
done or not.

This commit preserves the same behavior as before, it simply re-structures the
code in preparation for future work.

10 years agoExpose whether event loops have active I/O
Alex Crichton [Tue, 11 Feb 2014 03:59:35 +0000 (19:59 -0800)]
Expose whether event loops have active I/O

The green scheduler can optimize its runtime based on this by deciding to not go
to sleep in epoll() if there is no active I/O and there is a task to be stolen.

This is implemented for librustuv by keeping a count of the number of tasks
which are currently homed. If a task is homed, and then performs a blocking I/O
operation, the count will be nonzero while the task is blocked. The homing count
is intentionally 0 when there are I/O handles, but no handles currently blocked.
The reason for this is that epoll() would only be used to wake up the scheduler
anyway.

The crux of this change was to have a `HomingMissile` contain a mutable borrowed
reference back to the `HomeHandle`. The rest of the change was just dealing with
this fallout. This reference is used to decrement the homed handle count in a
HomingMissile's destructor.

Also note that the count maintained is not atomic because all of its
increments/decrements/reads are all on the same I/O thread.

10 years agoauto merge of #12204 : alexcrichton/rust/seek, r=pcwalton
bors [Wed, 12 Feb 2014 16:11:46 +0000 (08:11 -0800)]
auto merge of #12204 : alexcrichton/rust/seek, r=pcwalton

This adopts the rules posted in #10432:

1. If a seek position is negative, then an error is generated
2. Seeks beyond the end-of-file are allowed. Future writes will fill the gap
   with data and future reads will return errors.
3. Seeks within the bounds of a file are fine.

Closes #10432

10 years agoauto merge of #12196 : dguenther/rust/fix-fourcc-example, r=alexcrichton
bors [Wed, 12 Feb 2014 14:21:44 +0000 (06:21 -0800)]
auto merge of #12196 : dguenther/rust/fix-fourcc-example, r=alexcrichton

Cleans up a few issues with `fourcc`:
* Corrects the endianness in the docs example
* Removes `#[cfg(not(test))]` (bors might not build this on Windows. If the build fails, I'll re-add it)
* Adds a FIXME referencing the LLVM assert issue we encountered with bors builds on Windows (Same error as #10872)

10 years agoauto merge of #12180 : eddyb/rust/rm-ty_type, r=nikomatsakis
bors [Wed, 12 Feb 2014 12:36:43 +0000 (04:36 -0800)]
auto merge of #12180 : eddyb/rust/rm-ty_type, r=nikomatsakis

10 years agoRemoved ty_type (previously used to represent *tydesc).
Eduard Burtescu [Tue, 11 Feb 2014 11:48:55 +0000 (13:48 +0200)]
Removed ty_type (previously used to represent *tydesc).

10 years agodoc: rename 'nil' to 'unit' when describing `()`
Matthijs van der Vleuten [Wed, 12 Feb 2014 12:11:12 +0000 (13:11 +0100)]
doc: rename 'nil' to 'unit' when describing `()`

10 years agoauto merge of #12194 : WebeWizard/rust/master, r=cmr
bors [Wed, 12 Feb 2014 11:21:44 +0000 (03:21 -0800)]
auto merge of #12194 : WebeWizard/rust/master, r=cmr

10 years agoauto merge of #12190 : alexcrichton/rust/fix-snap-again, r=brson
bors [Wed, 12 Feb 2014 09:36:45 +0000 (01:36 -0800)]
auto merge of #12190 : alexcrichton/rust/fix-snap-again, r=brson

Loadable syntax extensions don't work when cross compiling (see #12102), so the
fourcc tests all need to be ignored. They're valuable tests, so they shouldn't
be outright ignored, so they're now flagged with ignore-cross-compile

10 years agoauto merge of #12185 : nikomatsakis/rust/issue-12033-tweak-test, r=alexchrichton
bors [Wed, 12 Feb 2014 07:06:44 +0000 (23:06 -0800)]
auto merge of #12185 : nikomatsakis/rust/issue-12033-tweak-test, r=alexchrichton

10 years agoauto merge of #12184 : JeremyLetang/rust/rustpkg-link, r=alexcrichton
bors [Wed, 12 Feb 2014 05:51:46 +0000 (21:51 -0800)]
auto merge of #12184 : JeremyLetang/rust/rustpkg-link, r=alexcrichton

10 years agoFinalize the Seek API
Alex Crichton [Wed, 12 Feb 2014 04:13:46 +0000 (20:13 -0800)]
Finalize the Seek API

This adopts the rules posted in #10432:

1. If a seek position is negative, then an error is generated
2. Seeks beyond the end-of-file are allowed. Future writes will fill the gap
   with data and future reads will return errors.
3. Seeks within the bounds of a file are fine.

Closes #10432