]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agoImprove examples for syntax::ext::deriving::encodable
Barosl Lee [Fri, 14 Nov 2014 08:14:44 +0000 (17:14 +0900)]
Improve examples for syntax::ext::deriving::encodable

The examples in the documentation for syntax::ext::deriving::encodable
are outdated, and do not work. To fix this, the following changes are
applied:

- emit_field() -> emit_struct_field()
- read_field() -> read_struct_field()
- Use Result to report errors
- Add the mut keyword to Encoder/Decoder
- Prefer Encodable::encode() to emit_uint

9 years agoauto merge of #18840 : huonw/rust/tweaks, r=alexcrichton
bors [Fri, 14 Nov 2014 08:17:19 +0000 (08:17 +0000)]
auto merge of #18840 : huonw/rust/tweaks, r=alexcrichton

Fix some old papercuts with diagnostics, e.g. tweaking spans, rewording messages. See individual commits.

9 years agoauto merge of #18827 : bjz/rust/rfc369-numerics, r=alexcrichton
bors [Fri, 14 Nov 2014 05:37:17 +0000 (05:37 +0000)]
auto merge of #18827 : bjz/rust/rfc369-numerics, r=alexcrichton

This implements a considerable portion of rust-lang/rfcs#369 (tracked in #18640). Some interpretations had to be made in order to get this to work. The breaking changes are listed below:

[breaking-change]

- `core::num::{Num, Unsigned, Primitive}` have been deprecated and their re-exports removed from the `{std, core}::prelude`.
- `core::num::{Zero, One, Bounded}` have been deprecated. Use the static methods on `core::num::{Float, Int}` instead. There is no equivalent to `Zero::is_zero`. Use `(==)` with `{Float, Int}::zero` instead.
- `Signed::abs_sub` has been moved to `std::num::FloatMath`, and is no longer implemented for signed integers.
- `core::num::Signed` has been removed, and its methods have been moved to `core::num::Float` and a new trait, `core::num::SignedInt`. The methods now take the `self` parameter by value.
- `core::num::{Saturating, CheckedAdd, CheckedSub, CheckedMul, CheckedDiv}` have been removed, and their methods moved to `core::num::Int`. Their parameters are now taken by value. This means that
- `std::time::Duration` no longer implements `core::num::{Zero, CheckedAdd, CheckedSub}` instead defining the required methods non-polymorphically.
- `core::num::{zero, one, abs, signum}` have been deprecated. Use their respective methods instead.
- The `core::num::{next_power_of_two, is_power_of_two, checked_next_power_of_two}` functions have been deprecated in favor of methods defined a new trait, `core::num::UnsignedInt`
- `core::iter::{AdditiveIterator, MultiplicativeIterator}` are now only implemented for the built-in numeric types.
- `core::iter::{range, range_inclusive, range_step, range_step_inclusive}` now require `core::num::Int` to be implemented for the type they a re parametrized over.

9 years agoRevert the need for initial values with arithmetic iterators
Brendan Zabarauskas [Fri, 14 Nov 2014 04:35:44 +0000 (15:35 +1100)]
Revert the need for initial values with arithmetic iterators

9 years agoauto merge of #18929 : alexcrichton/rust/issue-18928, r=brson
bors [Fri, 14 Nov 2014 01:52:14 +0000 (01:52 +0000)]
auto merge of #18929 : alexcrichton/rust/issue-18928, r=brson

Apparently it's not found on win64!

Closes #18928

9 years agoauto merge of #18926 : alexcrichton/rust/issue-18925, r=huonw
bors [Thu, 13 Nov 2014 23:37:21 +0000 (23:37 +0000)]
auto merge of #18926 : alexcrichton/rust/issue-18925, r=huonw

The subtraction was erroneously backwards, returning negative durations!

Closes #18925

9 years agoauto merge of #18887 : aturon/rust/controlled-inherit, r=alexcrichton
bors [Thu, 13 Nov 2014 19:32:21 +0000 (19:32 +0000)]
auto merge of #18887 : aturon/rust/controlled-inherit, r=alexcrichton

This patch tweaks the stability inheritance infrastructure so that
`#{stable]` attributes are not inherited. Doing so solves two problems:

1. It allows us to mark module *names* as stable without accidentally
marking the items they contain as stable.

2. It means that a `#[stable]` attribution must always appear directly
on the item it applies to, which makes it easier for reviewers to catch
changes to stable APIs.

Fixes #17484

9 years agoetc: Don't bundle libctl3d32 on windows
Alex Crichton [Thu, 13 Nov 2014 17:28:26 +0000 (09:28 -0800)]
etc: Don't bundle libctl3d32 on windows

Apparently it's not found on win64!

Closes #18928

9 years agostd: Fix the return value of Duration::span
Alex Crichton [Thu, 13 Nov 2014 16:48:38 +0000 (08:48 -0800)]
std: Fix the return value of Duration::span

The subtraction was erroneously backwards, returning negative durations!

Closes #18925

9 years agoauto merge of #18811 : pczarn/rust/issue-18763-ice, r=pnkfelix
bors [Thu, 13 Nov 2014 14:17:10 +0000 (14:17 +0000)]
auto merge of #18811 : pczarn/rust/issue-18763-ice, r=pnkfelix

Fix ICEs introduced in #17830

* fixed get_tt for doc comments
* properly handle MatchNt in `quote`

Fixes #18763
Fixes #18775

9 years agoauto merge of #18879 : pcwalton/rust/path-silliness, r=aturon
bors [Thu, 13 Nov 2014 12:27:03 +0000 (12:27 +0000)]
auto merge of #18879 : pcwalton/rust/path-silliness, r=aturon

This breaks code like:

    struct Foo {
        x: int,
    }

    let f: Foo = ...;
    ... f.x::<int> ...

Change this code to not contain an unused type parameter. For example:

    struct Foo {
        x: int,
    }

    let f: Foo = ...;
    ... f.x ...

Closes #18680.

[breaking-change]

r? @aturon

9 years agoauto merge of #18877 : michaelsproul/rust/panic-tests, r=alexcrichton
bors [Thu, 13 Nov 2014 10:37:06 +0000 (10:37 +0000)]
auto merge of #18877 : michaelsproul/rust/panic-tests, r=alexcrichton

I'm fairly sure all these tests refer to task panics. I skim read them all, but there's a small chance I renamed something too eagerly.

9 years agoauto merge of #18872 : hirschenberger/rust/master, r=thestinger
bors [Thu, 13 Nov 2014 08:17:09 +0000 (08:17 +0000)]
auto merge of #18872 : hirschenberger/rust/master, r=thestinger

Discussed in #18587

9 years agoauto merge of #18867 : michaelsproul/rust/unreachable-formatting, r=pcwalton
bors [Thu, 13 Nov 2014 06:12:10 +0000 (06:12 +0000)]
auto merge of #18867 : michaelsproul/rust/unreachable-formatting, r=pcwalton

Closes #18842.

9 years agoUse the correct span for out-of-range int literals.
Huon Wilson [Mon, 10 Nov 2014 11:07:36 +0000 (22:07 +1100)]
Use the correct span for out-of-range int literals.

This corrects the error message to point at the literal, not the next
token.

Closes #17123.

9 years agoAdd more "help: ..."'s to the parser.
Huon Wilson [Mon, 10 Nov 2014 10:58:03 +0000 (21:58 +1100)]
Add more "help: ..."'s to the parser.

Adds a method for printing a fatal error and also a help message to the
parser and uses this in a variety of places to improve error messages.

Closes #12213.

9 years agoAdd error message specific to \<carriage return>.
Huon Wilson [Mon, 10 Nov 2014 10:54:42 +0000 (21:54 +1100)]
Add error message specific to \<carriage return>.

This can crop-up with a misconfigured editor or an unexpected
interaction between version control and certain operating systems.

Closes #11669.

9 years agoTweak and add test for detecting libraries with mismatching target triples.
Huon Wilson [Mon, 10 Nov 2014 10:52:55 +0000 (21:52 +1100)]
Tweak and add test for detecting libraries with mismatching target triples.

Closes #10814.

9 years agoauto merge of #18862 : murarth/rust/issue-18566-test, r=alexcrichton
bors [Thu, 13 Nov 2014 02:37:05 +0000 (02:37 +0000)]
auto merge of #18862 : murarth/rust/issue-18566-test, r=alexcrichton

9 years agoauto merge of #18858 : alexcrichton/rust/remove-time, r=jakub
bors [Wed, 12 Nov 2014 22:57:16 +0000 (22:57 +0000)]
auto merge of #18858 : alexcrichton/rust/remove-time, r=jakub

This commit deprecates the entire libtime library in favor of the
externally-provided libtime in the rust-lang organization. Users of the
`libtime` crate as-is today should add this to their Cargo manifests:

    [dependencies.time]
    git = "https://github.com/rust-lang/time"

To implement this transition, a new function `Duration::span` was added to the
`std::time::Duration` time. This function takes a closure and then returns the
duration of time it took that closure to execute. This interface will likely
improve with `FnOnce` unboxed closures as moving in and out will be a little
easier.

Due to the deprecation of the in-tree crate, this is a:

[breaking-change]

cc #18855, some of the conversions in the `src/test/bench` area may have been a
little nicer with that implemented

9 years agoauto merge of #18907 : alexcrichton/rust/snapshots, r=jakub-,jakub
bors [Wed, 12 Nov 2014 21:07:09 +0000 (21:07 +0000)]
auto merge of #18907 : alexcrichton/rust/snapshots, r=jakub-,jakub

9 years agoRegister new snapshots
Alex Crichton [Wed, 12 Nov 2014 20:17:55 +0000 (12:17 -0800)]
Register new snapshots

9 years agoauto merge of #18830 : adaszko/rust/patch-1, r=steveklabnik
bors [Wed, 12 Nov 2014 17:22:05 +0000 (17:22 +0000)]
auto merge of #18830 : adaszko/rust/patch-1, r=steveklabnik

9 years agotime: Deprecate the library in the distribution
Alex Crichton [Mon, 10 Nov 2014 20:27:56 +0000 (12:27 -0800)]
time: Deprecate the library in the distribution

This commit deprecates the entire libtime library in favor of the
externally-provided libtime in the rust-lang organization. Users of the
`libtime` crate as-is today should add this to their Cargo manifests:

    [dependencies.time]
    git = "https://github.com/rust-lang/time"

To implement this transition, a new function `Duration::span` was added to the
`std::time::Duration` time. This function takes a closure and then returns the
duration of time it took that closure to execute. This interface will likely
improve with `FnOnce` unboxed closures as moving in and out will be a little
easier.

Due to the deprecation of the in-tree crate, this is a:

[breaking-change]

cc #18855, some of the conversions in the `src/test/bench` area may have been a
little nicer with that implemented

9 years agoFix stability_summary fallout
Brendan Zabarauskas [Wed, 12 Nov 2014 16:45:08 +0000 (03:45 +1100)]
Fix stability_summary fallout

9 years agoRemove Signed trait and add SignedInt trait
Brendan Zabarauskas [Wed, 12 Nov 2014 13:02:42 +0000 (00:02 +1100)]
Remove Signed trait and add SignedInt trait

The methods have been moved into Float and SignedInt

9 years agoRemove lots of numeric traits from the preludes
Brendan Zabarauskas [Mon, 10 Nov 2014 05:26:10 +0000 (16:26 +1100)]
Remove lots of numeric traits from the preludes

Num, NumCast, Unsigned, Float, Primitive and Int have been removed.

9 years agoClean up core::num doc comments
Brendan Zabarauskas [Mon, 10 Nov 2014 05:00:13 +0000 (16:00 +1100)]
Clean up core::num doc comments

9 years agoDeprecate signum wrapper and clean up signed impls
Brendan Zabarauskas [Mon, 10 Nov 2014 00:39:55 +0000 (11:39 +1100)]
Deprecate signum wrapper and clean up signed impls

9 years agoDeprecate Num, Unsigned and Primitive
Brendan Zabarauskas [Mon, 10 Nov 2014 00:30:52 +0000 (11:30 +1100)]
Deprecate Num, Unsigned and Primitive

9 years agoDeprecate Zero and One traits
Brendan Zabarauskas [Sun, 9 Nov 2014 22:35:53 +0000 (09:35 +1100)]
Deprecate Zero and One traits

9 years agoDeprecate Bounded trait
Brendan Zabarauskas [Sun, 9 Nov 2014 14:20:13 +0000 (01:20 +1100)]
Deprecate Bounded trait

9 years agoMove checked arithmetic operators into Int trait
Brendan Zabarauskas [Sun, 9 Nov 2014 13:11:28 +0000 (00:11 +1100)]
Move checked arithmetic operators into Int trait

9 years agoRejig Int impl macros
Brendan Zabarauskas [Sun, 9 Nov 2014 10:30:30 +0000 (21:30 +1100)]
Rejig Int impl macros

This should make implementing the checked operator methods easier

9 years agoMove saturating operator methods into Int
Brendan Zabarauskas [Sun, 9 Nov 2014 06:46:33 +0000 (17:46 +1100)]
Move saturating operator methods into Int

9 years agoCreate UnsignedInt trait and deprecate free functions
Brendan Zabarauskas [Sun, 9 Nov 2014 06:15:45 +0000 (17:15 +1100)]
Create UnsignedInt trait and deprecate free functions

9 years agoMove abs_sub to FloatMath
Brendan Zabarauskas [Sun, 9 Nov 2014 06:24:14 +0000 (17:24 +1100)]
Move abs_sub to FloatMath

This removes the need for libcore to depend on libm. `abs_sub` is not as useful for integers.

9 years agoDeprecate Signed method wrappers
Brendan Zabarauskas [Sun, 9 Nov 2014 05:59:28 +0000 (16:59 +1100)]
Deprecate Signed method wrappers

9 years agoTake parameters by-value in Signed trait
Brendan Zabarauskas [Sun, 9 Nov 2014 05:48:49 +0000 (16:48 +1100)]
Take parameters by-value in Signed trait

9 years agoauto merge of #18860 : aturon/rust/reexports-in-stab-summary, r=brson
bors [Wed, 12 Nov 2014 12:21:57 +0000 (12:21 +0000)]
auto merge of #18860 : aturon/rust/reexports-in-stab-summary, r=brson

Previously, the stability summary page attempted to associate impl
blocks with the module in which they were defined, rather than the
module defining the type they apply to (which is usually, but not
always, the same). Unfortunately, due to the basic architecture of
rustdoc, this meant that impls from re-exports were not being counted.

This commit makes the stability summary work the same way that rustdoc's
rendered output does: all methods are counted alongside the type they
apply to, no matter where the methods are defined.

In addition, for trait impl blocks only the stability of the overall
block is counted; the stability of the methods within is not
counted (since that stability level is part of the trait definition).

Fixes #18812

9 years agoauto merge of #18854 : thestinger/rust/spawn, r=aturon
bors [Wed, 12 Nov 2014 10:27:01 +0000 (10:27 +0000)]
auto merge of #18854 : thestinger/rust/spawn, r=aturon

cc https://github.com/rust-lang/rust/issues/18000

9 years agoauto merge of #18841 : Manishearth/rust/doc-ty, r=alexcrichton
bors [Wed, 12 Nov 2014 08:32:03 +0000 (08:32 +0000)]
auto merge of #18841 : Manishearth/rust/doc-ty, r=alexcrichton

I'll probably start documenting the rest of `syntax::ast` whenever I get time.

9 years agoauto merge of #18833 : slashgrin/rust/patch-1, r=brson
bors [Wed, 12 Nov 2014 05:27:02 +0000 (05:27 +0000)]
auto merge of #18833 : slashgrin/rust/patch-1, r=brson

Should refer to handling panicking tasks like any other computation
that may _fail_, not any other computation that may _panic_.

9 years agoUpdate tests for new stability inheritance rules
Aaron Turon [Tue, 11 Nov 2014 20:52:12 +0000 (12:52 -0800)]
Update tests for new stability inheritance rules

9 years agorustc: do not inherit #[stable]
Aaron Turon [Tue, 11 Nov 2014 20:46:47 +0000 (12:46 -0800)]
rustc: do not inherit #[stable]

This patch tweaks the stability inheritance infrastructure so that
`#{stable]` attributes are not inherited. Doing so solves two problems:

1. It allows us to mark module *names* as stable without accidentally
marking the items they contain as stable.

2. It means that a `#[stable]` attribution must always appear directly
on the item it applies to, which makes it easier for reviewers to catch
changes to stable APIs.

Fixes #17484

9 years agoauto merge of #18813 : csherratt/rust/add-encode-decode-vecmap, r=alexcrichton
bors [Tue, 11 Nov 2014 22:37:05 +0000 (22:37 +0000)]
auto merge of #18813 : csherratt/rust/add-encode-decode-vecmap, r=alexcrichton

9 years agolibsyntax: Forbid type parameters in field expressions.
Patrick Walton [Tue, 11 Nov 2014 18:45:59 +0000 (10:45 -0800)]
libsyntax: Forbid type parameters in field expressions.

This breaks code like:

    struct Foo {
        x: int,
    }

    let f: Foo = ...;
    ... f.x::<int> ...

Change this code to not contain an unused type parameter. For example:

    struct Foo {
        x: int,
    }

    let f: Foo = ...;
    ... f.x ...

Closes #18680.

[breaking-change]

9 years agoauto merge of #18793 : swgillespie/rust/master, r=alexcrichton
bors [Tue, 11 Nov 2014 18:26:56 +0000 (18:26 +0000)]
auto merge of #18793 : swgillespie/rust/master, r=alexcrichton

I noticed today that `move` wasn't getting highlighted in my editor of choice (emacs), so I went ahead and added it as a keyword in the emacs, vim, and kate editor files. Apparently it has already been done for gedit.

9 years agotest: Rename files, fail -> panic.
Michael Sproul [Tue, 11 Nov 2014 17:36:12 +0000 (09:36 -0800)]
test: Rename files, fail -> panic.

9 years agoauto merge of #18821 : arielb1/rust/fnv-hash-map, r=eddyb
bors [Tue, 11 Nov 2014 16:22:04 +0000 (16:22 +0000)]
auto merge of #18821 : arielb1/rust/fnv-hash-map, r=eddyb

This should improve performance

9 years agoauto merge of #18808 : ebfe/rust/lint-names, r=alexcrichton
bors [Tue, 11 Nov 2014 12:21:59 +0000 (12:21 +0000)]
auto merge of #18808 : ebfe/rust/lint-names, r=alexcrichton

9 years agoauto merge of #18797 : vadimcn/rust/prefer-bundled2, r=alexcrichton
bors [Tue, 11 Nov 2014 10:12:00 +0000 (10:12 +0000)]
auto merge of #18797 : vadimcn/rust/prefer-bundled2, r=alexcrichton

Based on Windows bundle feedback we got to date,
- We *do* want to prefer the bundled linker: The external one might be for the wrong architecture (e.g. 32 bit vs 64 bit).  On the other hand, binutils don't add many new features these days, so using an older bundled linker is not likely to be a problem.
- We *do* want to prefer bundled libraries: The external ones might not have the symbols we expect (e.g. what's needed for DWARF exceptions vs SjLj).  Since `-L rustlib/<triple>/lib` appears first on the linker command line, it's a good place to keep our platform libs that we want to be found first.

Closes #18325, closes #17726.

9 years agoSet exceeding bitshifts lint to deny
Falco Hirschenberger [Tue, 11 Nov 2014 09:41:53 +0000 (10:41 +0100)]
Set exceeding bitshifts lint to deny

Discussed in #18587

9 years agoAdd 'move' keyword to emacs, kate, and vim editor modes.
Sean Gillespie [Sun, 9 Nov 2014 01:48:45 +0000 (17:48 -0800)]
Add 'move' keyword to emacs, kate, and vim editor modes.

9 years agoauto merge of #18789 : cuviper/rust/vim-move, r=alexcrichton
bors [Tue, 11 Nov 2014 07:16:56 +0000 (07:16 +0000)]
auto merge of #18789 : cuviper/rust/vim-move, r=alexcrichton

It used to be in `rustKeyword`, until commit 5c75f210ba6e450fb1603b50ca0a4805f13173d7 removed it, and then #18782 restored it again.  However, this is now a closure modifier, and I think moving it to `rustStorage` is more appropriate to highlight it similarly to `mut`, `ref`, and the `&` sigil.

9 years agoauto merge of #18766 : liigo/rust/improve-inner-attr-msg, r=huonw
bors [Tue, 11 Nov 2014 04:26:57 +0000 (04:26 +0000)]
auto merge of #18766 : liigo/rust/improve-inner-attr-msg, r=huonw

for the code:
```
use std::io;

#![crate_type="rlib"] // ERROR: an inner attribute is not permitted in this context

fn say_hello() {
println!("hello");
}
```

this PR provides another note to help programmer fixing this error more easily:
```
hello.rs:6:3: 6:4 error: an inner attribute is not permitted in this context
hello.rs:6 #![crate_type="rlib"]
             ^
hello.rs:6:3: 6:4 note: put inner attribute in top of file or block
hello.rs:6 #![crate_type="rlib"]
             ^
```

9 years agoAdd optional messages to the unreachable macro.
Michael Sproul [Tue, 11 Nov 2014 03:33:20 +0000 (19:33 -0800)]
Add optional messages to the unreachable macro.

Closes #18842.

9 years agoauto merge of #18753 : jbcrail/rust/fix-deprecated-enum-set, r=alexcrichton
bors [Tue, 11 Nov 2014 02:11:54 +0000 (02:11 +0000)]
auto merge of #18753 : jbcrail/rust/fix-deprecated-enum-set, r=alexcrichton

I renamed the deprecated methods, resulting from the collection reform.

9 years agosyntax: improve message for misused inner attributes
Liigo Zhuang [Sat, 8 Nov 2014 09:23:27 +0000 (17:23 +0800)]
syntax: improve message for misused inner attributes

9 years agoAdd regression test for #18566
Murarth [Mon, 10 Nov 2014 23:47:32 +0000 (16:47 -0700)]
Add regression test for #18566

9 years agorustdoc: revise method counts in stability summary
Aaron Turon [Mon, 10 Nov 2014 23:33:21 +0000 (15:33 -0800)]
rustdoc: revise method counts in stability summary

Previously, the stability summary page attempted to associate impl
blocks with the module in which they were defined, rather than the
module defining the type they apply to (which is usually, but not
always, the same). Unfortunately, due to the basic architecture of
rustdoc, this meant that impls from re-exports were not being counted.

This commit makes the stability summary work the same way that rustdoc's
rendered output does: all methods are counted alongside the type they
apply to, no matter where the methods are defined.

In addition, for trait impl blocks only the stability of the overall
block is counted; the stability of the methods within is not
counted (since that stability level is part of the trait definition).

Fixes #18812

9 years agoauto merge of #18857 : brson/rust/winescapefixes, r=alexcrichton
bors [Mon, 10 Nov 2014 23:01:57 +0000 (23:01 +0000)]
auto merge of #18857 : brson/rust/winescapefixes, r=alexcrichton

9 years agomk: Fix configuration of version commit information
Brian Anderson [Mon, 10 Nov 2014 17:54:25 +0000 (09:54 -0800)]
mk: Fix configuration of version commit information

Commit bec2ee77f78b4bb8a503101091272a634a273a1c started quoting paths
discovered as part of the `probe` function, which includes git.  The
`make` `wildcard` function appears to be incompatible with quoted
paths so this check in the makefile now fails. Employing `wildcard`
here appears to only re-verify that git actually exists, which the
configure script already did, so I've just removed it.

Additionally, with the quoted paths the `subst` function should no
longer be needed, so I've removed it as well.

Closes #18771

9 years agonote the intent of reforming task spawning
Daniel Micay [Mon, 10 Nov 2014 22:04:33 +0000 (17:04 -0500)]
note the intent of reforming task spawning

9 years agovim: move 'move' to rustStorage
Josh Stone [Mon, 10 Nov 2014 21:48:17 +0000 (13:48 -0800)]
vim: move 'move' to rustStorage

9 years agoAttempt to fix the problem with failing distcheck.
Vitali Haravy [Mon, 10 Nov 2014 21:05:34 +0000 (21:05 +0000)]
Attempt to fix the problem with failing distcheck.

9 years agoauto merge of #18287 : michaelsproul/rust/triemap-collection-views, r=bstrie
bors [Mon, 10 Nov 2014 20:21:53 +0000 (20:21 +0000)]
auto merge of #18287 : michaelsproul/rust/triemap-collection-views, r=bstrie

I've implemented the new collection views API for TrieMap. I more or less followed the approach set out by @Gankro in BTreeMap, by using a `SearchStack`. There's quite a bit of unsafe code, but I've wrapped it safely where I think is appropriate. I've added tests to ensure everything works, and performance seems quite good.

```
test trie::bench_map::bench_find                           ... bench:     67879 ns/iter (+/- 4192)
test trie::bench_map::bench_find_entry                     ... bench:    186814 ns/iter (+/- 18748)
test trie::bench_map::bench_insert_large                   ... bench:    716612 ns/iter (+/- 160121)
test trie::bench_map::bench_insert_large_entry             ... bench:    851219 ns/iter (+/- 20331)
test trie::bench_map::bench_remove                         ... bench:    838856 ns/iter (+/- 27998)
test trie::bench_map::bench_remove_entry                   ... bench:    981711 ns/iter (+/- 53046)
```

Using an entry is slow compared to a plain find, but is only ~15% slower for inserts and removes, which is where this API is most useful. I'm tempted to remove the standalone `remove` function in favour of an entry-based approach (to cut down on complexity).

I've added some more comments to the general part of the code-base, which will hopefully help the next person looking over this. I moved the three key structures to the top of the file so that the nesting structure is clearly visible, and renamed `Child<T>` to `TrieNode<T>` and `TrieNode<T>` to `InternalNode<T>` to improve clarity. If these changes are creeping, I'm happy to revert them.

Let me know if my use of `fail!` is ok, I was a little unsure of how specific to be. Some of the data-structures have various invariants that shouldn't be broken, so using `fail!` seemed appropriate.

## Still to do

* Modernise iterators (make them double-ended).
* Make the keys generic, or rename this data-structure (see: https://github.com/rust-lang/rust/issues/14902).
* Possibly move this code out of libcollections. [Searching Github for TrieMap turns up very few real results.][triemap-search]

Related issues: https://github.com/rust-lang/rust/issues/18009 and https://github.com/rust-lang/rust/issues/17320

[triemap-search]: https://github.com/search?utf8=%E2%9C%93&q=TrieMap+language%3ARust&type=Code&ref=searchresults

9 years agoImplement collection views API for TrieMap.
Michael Sproul [Thu, 23 Oct 2014 01:02:33 +0000 (18:02 -0700)]
Implement collection views API for TrieMap.

9 years agoFix 'renamed lint' warnings
Michael Gehring [Sun, 9 Nov 2014 12:59:23 +0000 (13:59 +0100)]
Fix 'renamed lint' warnings

9 years agoauto merge of #18802 : bkoropoff/rust/issue-18769, r=luqmana
bors [Mon, 10 Nov 2014 16:12:03 +0000 (16:12 +0000)]
auto merge of #18802 : bkoropoff/rust/issue-18769, r=luqmana

Drill down the loan path for `McDeclared` references as well since it might lead to an upvar.  Closes #18769

9 years agoauto merge of #18795 : haberman/rust/master, r=cmr
bors [Mon, 10 Nov 2014 14:07:00 +0000 (14:07 +0000)]
auto merge of #18795 : haberman/rust/master, r=cmr

Previously Int inherited from PartialOrd (via Primitive)
but not Ord.  But integers have a total order, so
inheriting from Ord is appropriate. Fixes #18776.

9 years agoDocument ast::Ty_
Manish Goregaokar [Mon, 10 Nov 2014 13:41:27 +0000 (19:11 +0530)]
Document ast::Ty_

9 years agoauto merge of #18792 : sfackler/rust/struct-variants, r=alexcrichton
bors [Mon, 10 Nov 2014 11:06:54 +0000 (11:06 +0000)]
auto merge of #18792 : sfackler/rust/struct-variants, r=alexcrichton

We need a snapshot before the parser can be adjusted.

9 years agoRogue 'panic' -> 'fail' in guide.
Jeff Parsons [Mon, 10 Nov 2014 10:20:11 +0000 (21:20 +1100)]
Rogue 'panic' -> 'fail' in guide.

Should refer to handling panicking tasks like any other computation
that may _fail_, not any other computation that may _panic_.

9 years agoFix broken documentation link
Adam Szkoda [Mon, 10 Nov 2014 07:22:10 +0000 (08:22 +0100)]
Fix broken documentation link

9 years agoauto merge of #18782 : netvl/rust/update-vim-syntax, r=alexcrichton
bors [Mon, 10 Nov 2014 07:01:49 +0000 (07:01 +0000)]
auto merge of #18782 : netvl/rust/update-vim-syntax, r=alexcrichton

`as` (already for a long time) and `move` (which was only added recently, AFAIK) are not marked as keywords in Vim syntax file, so they are not highlighted as keywords in Rust sources. This PR fixes this.

9 years agoauto merge of #18781 : klutzy/rust/cross, r=cmr
bors [Mon, 10 Nov 2014 04:41:49 +0000 (04:41 +0000)]
auto merge of #18781 : klutzy/rust/cross, r=cmr

cc #12859

9 years agoUse FnvHashMap instead of HashMap in rustc
Ariel Ben-Yehuda [Sun, 9 Nov 2014 22:59:56 +0000 (00:59 +0200)]
Use FnvHashMap instead of HashMap in rustc

9 years agoauto merge of #18780 : bkoropoff/rust/regionck-for-loop, r=eddyb
bors [Sun, 9 Nov 2014 22:31:44 +0000 (22:31 +0000)]
auto merge of #18780 : bkoropoff/rust/regionck-for-loop, r=eddyb

Use the mem-cat of the iterator element type rather than the iterator itself when processing the for loop pattern.

Closes #17068
Closes #18767

9 years agoauto merge of #18739 : vhbit/rust/issue-18574, r=alexcrichton
bors [Sun, 9 Nov 2014 20:01:44 +0000 (20:01 +0000)]
auto merge of #18739 : vhbit/rust/issue-18574, r=alexcrichton

Fixes #18574

9 years agoAdded `move` keyword and renamed `fail` to `panic`
Vladimir Matveev [Sat, 8 Nov 2014 19:38:10 +0000 (22:38 +0300)]
Added `move` keyword and renamed `fail` to `panic`

9 years agoauto merge of #18762 : mdinger/rust/str_coerce, r=steveklbanik
bors [Sun, 9 Nov 2014 17:06:45 +0000 (17:06 +0000)]
auto merge of #18762 : mdinger/rust/str_coerce, r=steveklbanik

I had slight confusion when using this as a reference and was told it was imprecise. Most of the rewording was suggested by @huonw.

cc @steveklabnik

9 years agoAdd Encodable and Decodable for VecMap
Colin Sherratt [Sun, 9 Nov 2014 16:30:18 +0000 (11:30 -0500)]
Add Encodable and Decodable for VecMap

9 years agoFix ICEs that involved quasi-quotation
Piotr Czarnecki [Sun, 9 Nov 2014 15:34:04 +0000 (16:34 +0100)]
Fix ICEs that involved quasi-quotation

* fixed get_tt for doc comments
* properly handle MatchNt in `quote`

Fixes #18763
Fixes #18775

9 years agoauto merge of #18756 : jbcrail/rust/add-enum-set-bitxor, r=alexcrichton
bors [Sun, 9 Nov 2014 15:11:43 +0000 (15:11 +0000)]
auto merge of #18756 : jbcrail/rust/add-enum-set-bitxor, r=alexcrichton

I implemented BitXor, and also added tests for BitAnd and BitXor.

cc #18424

9 years agoauto merge of #18755 : japaric/rust/ord, r=alexcrichton
bors [Sun, 9 Nov 2014 12:31:40 +0000 (12:31 +0000)]
auto merge of #18755 : japaric/rust/ord, r=alexcrichton

Closes #18738
cc #15689

r? @alexcrichton
cc @cmr

9 years agoFirst stage of struct variant field visibility changes
Steven Fackler [Sun, 9 Nov 2014 00:54:33 +0000 (16:54 -0800)]
First stage of struct variant field visibility changes

We need a snapshot before the parser can be adjusted.

9 years agoauto merge of #18748 : carols10cents/rust/prepend-to-append, r=alexcrichton
bors [Sun, 9 Nov 2014 07:46:41 +0000 (07:46 +0000)]
auto merge of #18748 : carols10cents/rust/prepend-to-append, r=alexcrichton

A most trivial documentation correction. The examples in the intro are all about adding to the end of the array, not the beginning, but this one line says "prepend".

This isn't a very serious problem, it just made me a bit confused when I got to it.

9 years agoauto merge of #18557 : aturon/rust/io-removal, r=alexcrichton
bors [Sun, 9 Nov 2014 05:51:44 +0000 (05:51 +0000)]
auto merge of #18557 : aturon/rust/io-removal, r=alexcrichton

This PR includes a sequence of commits that gradually dismantles the `librustrt` `rtio` system -- the main trait previously used to abstract over green and native io. It also largely dismantles `libnative`, moving much of its code into `libstd` and refactoring as it does so.

TL;DR:

* Before this PR: `rustc hello.rs && wc -c hello` produces 715,996
* After this PR:  `rustc hello.rs && wc -c hello` produces 368,100

That is, this PR reduces the footprint of hello world by ~50%.

This is a major step toward #17325 (i.e. toward implementing the [runtime removal RFC](https://github.com/rust-lang/rfcs/pull/230).) What remains is to pull out the scheduling, synchronization and task infrastructure, and to remove `libgreen`. These will be done soon in a follow-up PR.

Part of the work here is eliminating the `rtio` abstraction, which in many cases means bringing the implementation of io closer to the actual API presented in `std::io`.

Another aspect of this PR is the creation of two new, *private* modules within `std` that implement io:

* The `sys` module, which represents a platform-specific implementation of a number of low-level abstractions that are used directly within `std::io` and `std::os`. These "abstractions" are left largely the same as they were in `libnative` (except for the removal of `Arc` in file descriptors), but they are expected to evolve greatly over time. Organizationally, there are `sys/unix/` and `sys/windows/` directories which both implement the entire `sys` module hierarchy; this means that nearly all of the platform-specific code is isolated and you can get a handle on each platform in isolation.

* The `sys_common` module, which is rooted at `sys/common`, and provides a few pieces of private, low-level, but cross-platform functionality.

In the long term, the `sys` modules will provide hooks for exposing high-level platform-specific APIs as part of `libstd`. The first such API will be access to file descriptors from `std::io` abstractions, but a bit of design work remains before that step can be taken.

The `sys_common` module includes some traits (like `AsFileDesc`) which allow communication of private details between modules in disparate locations in the hierarchy; this helps overcome the relatively simple hierarchical privacy system in Rust.

To emphasize: the organization in `sys` is *very preliminary* and the main goal was to migrate away from `rtio` as quickly and simply as possible. The design will certainly evolve over time, and all of the details are currently private.

Along the way, this PR also entirely removes signal handling, since it was only supported on `librustuv` which was removed a while ago.

Because of the removal of APIs from `libnative` and `librustrt`, and the removal of signal handling, this is a:

[breaking-change]

Some of these APIs will return in public from from `std` over time.

r? @alexcrichton

9 years agoUpdate test to cover #18769
Brian Koropoff [Sun, 9 Nov 2014 05:51:02 +0000 (21:51 -0800)]
Update test to cover #18769

9 years agoFix upvars sometimes not being marked as used mutably
Brian Koropoff [Sun, 9 Nov 2014 05:49:29 +0000 (21:49 -0800)]
Fix upvars sometimes not being marked as used mutably

Drill down the loan path for McDeclared references as well since
it might lead to an upvar.  Closes #18769

9 years agoIgnore sepcomp-lib-lto on android due to linker weirdness
Aaron Turon [Sun, 9 Nov 2014 04:57:15 +0000 (20:57 -0800)]
Ignore sepcomp-lib-lto on android due to linker weirdness

9 years agoRemove somewhat bogus process-spawn-errno test (non-mac, non-windows only)
Aaron Turon [Sun, 9 Nov 2014 01:22:14 +0000 (17:22 -0800)]
Remove somewhat bogus process-spawn-errno test (non-mac, non-windows only)

9 years agoRuntime removal: fully remove rtio
Aaron Turon [Fri, 17 Oct 2014 20:39:27 +0000 (13:39 -0700)]
Runtime removal: fully remove rtio

This patch cleans up the remnants of the runtime IO interface.

Because this eliminates APIs in `libnative` and `librustrt`, it is a:

[breaking-change]

This functionality is likely to be available publicly, in some form,
from `std` in the future.

9 years agoRuntime removal: refactor tty
Aaron Turon [Fri, 17 Oct 2014 20:33:08 +0000 (13:33 -0700)]
Runtime removal: refactor tty

This patch continues runtime removal by moving the tty implementations
into `sys`.

Because this eliminates APIs in `libnative` and `librustrt`, it is a:

[breaking-change]

This functionality is likely to be available publicly, in some form,
from `std` in the future.

9 years agoRuntime removal: refactor timer
Aaron Turon [Fri, 17 Oct 2014 01:57:11 +0000 (18:57 -0700)]
Runtime removal: refactor timer

This patch continues runtime removal by moving out timer-related code
into `sys`.

Because this eliminates APIs in `libnative` and `librustrt`, it is a:

[breaking-change]

This functionality is likely to be available publicly, in some form,
from `std` in the future.

9 years agoRuntime removal: refactor process
Aaron Turon [Thu, 9 Oct 2014 23:27:28 +0000 (16:27 -0700)]
Runtime removal: refactor process

This patch continues the runtime removal by moving and refactoring the
process implementation into the new `sys` module.

Because this eliminates APIs in `libnative` and `librustrt`, it is a:

[breaking-change]

This functionality is likely to be available publicly, in some form,
from `std` in the future.

9 years agoRuntime removal: refactor helper threads
Aaron Turon [Wed, 15 Oct 2014 22:45:59 +0000 (15:45 -0700)]
Runtime removal: refactor helper threads

This patch continues the runtime removal by moving
libnative::io::helper_thread into sys::helper_signal and
sys_common::helper_thread

Because this eliminates APIs in `libnative` and `librustrt`, it is a:

[breaking-change]

This functionality is likely to be available publicly, in some form,
from `std` in the future.

9 years agoRuntime removal: refactor pipes and networking
Aaron Turon [Fri, 10 Oct 2014 17:11:49 +0000 (10:11 -0700)]
Runtime removal: refactor pipes and networking

This patch continues the runtime removal by moving pipe and
networking-related code into `sys`.

Because this eliminates APIs in `libnative` and `librustrt`, it is a:

[breaking-change]

This functionality is likely to be available publicly, in some form,
from `std` in the future.

9 years agoRuntime removal: refactor fs
Aaron Turon [Wed, 1 Oct 2014 00:34:14 +0000 (17:34 -0700)]
Runtime removal: refactor fs

This moves the filesystem implementation from libnative into the new
`sys` modules, refactoring along the way and hooking into `std::io::fs`.

Because this eliminates APIs in `libnative` and `librustrt`, it is a:

[breaking-change]

This functionality is likely to be available publicly, in some form,
from `std` in the future.