Commit Graph

28061 Commits

Author SHA1 Message Date
Yuri Kunde Schlesner
9faef77b23 Eliminate the need for Options in LruEntry.
LruEntry nodes previously used Option to encapsulate the key and value
fields. This was used merely as a way avoid having values for the sigil
node. Apart from wasting a few bytes for the discriminant, this
cluttered the rest of the code, since these fields always contained
Some on regular nodes as a class invariant.

The Option wrapping was removed, and the values in the sigil field are
initialized using mem::init, so that they don't contain any real data.
2014-04-19 21:12:02 -03:00
Yuri Kunde Schlesner
ad4062e8af Eliminate unecessary extra sigil node from LruCache.
Instead of allocating both head and tail nodes for the ends of the node
list, a single node can be allocated and linked circularly instead,
making it act as both the head and the tail of the list at the same
time.
2014-04-18 07:23:36 -03:00
Yuri Kunde Schlesner
04784540ef Remove redundant variable in LruCache::put 2014-04-18 03:39:25 -03:00
bors
0c23140aaf auto merge of #13575 : TeXitoi/rust/shootout-knucleotide-parallel, r=alexcrichton 2014-04-17 18:41:24 -07:00
bors
950312960a auto merge of #13572 : yuriks/rust/bitv-renames, r=alexcrichton
Renamed the methods in Bitv that test all bits to have names that, ehm, "roll off the tongue" a bit more easily. :)

Also added tests for them while at it, since they seemed to be missing.
2014-04-17 17:21:26 -07:00
bors
4c50cf38a0 auto merge of #13565 : alexcrichton/rust/issue-13560, r=brson
Syntax-only crates are no longer registered with the cstore, so there's no need
to allocate crate numbers to them. This ends up leaving gaps in the crate
numbering scheme which is not expected in the rest of the compiler.

Closes #13560
2014-04-17 15:51:27 -07:00
bors
99c258cd74 auto merge of #13261 : pnkfelix/rust/fsk-fix-12856, r=nikomatsakis
Fix #12856.

I wanted to put this up first because I wanted to get feedback about the second commit in the series, commit 8599236.  Its the more invasive part of the patch and is largely just belt-and-suspenders assertion checking; in the commit message I mentioned at least one other approach we could take here.  Or we could drop the belt-and-suspenders and just rely on the guard added in the first patch, commit 8d6a005 (which is really quite trivial on its own).

So any feedback on what would be better is appreciated.

r? @nikomatsakis
2014-04-17 12:46:26 -07:00
Felix S. Klock II
3099451020 Add result sanity check to is_to_be_inferred.
This version of `is_to_be_inferred` double-checks the result from
`inferred_map` by querying the `named_region_map` and `ast_map` and
then asserts that the `inferred_map` state is consistent with its own
findings.  (See issue 13261 for further discussion of the approaches).
2014-04-17 20:40:51 +02:00
bors
ff0b0d5cee auto merge of #13558 : alexcrichton/rust/snapshots, r=brson
This is the first snapshot build by mingw-w64 with the win32 threading model I believe (Closes #13501).

Curiously, this successfully built a snapshot on freebsd when the auto builder is continuously segfaulting. Who knew!
2014-04-17 11:16:31 -07:00
bors
903fbd2635 auto merge of #13569 : alexcrichton/rust/ignore-bytecode, r=brson
The name of the file changed awhile back and this spot wasn't updated to
continue ignoring the bytecode from rlibs when copying into staticlibs.
2014-04-17 06:16:24 -07:00
bors
1fd7de8246 auto merge of #13567 : iancormac84/rust/libc_windows_guid_fix, r=alexcrichton
structure's Data2 and Data3 members expect WORD types instead of DWORD. I
discovered this discrepancy while experimenting with some bindings to
Microsoft's OLE2 api. The discrepancy was corrupting the contents of the
string returned by UuidToString after I used known GUIDs to test the
accuracy of the function binding. I didn't add test cases because it would
mean adding a dependency to my rather incomplete binding library. However,
the fix produces expected string values when tested.
2014-04-17 04:46:50 -07:00
bors
d8fa106867 auto merge of #13563 : lifthrasiir/rust/refman-dl, r=alexcrichton
Closes #13561. All definition lists have been converted to unordered lists. This is a temporary measure; please revert this when Sundown (or any replacement) gets a support for definition lists in the future.
2014-04-17 03:16:25 -07:00
Felix S. Klock II
364d82e7f3 Regression test. 2014-04-17 11:42:30 +02:00
Felix S. Klock II
78baf0e968 Drive-by: pprust::*_to_str for TypeMethod, Method, and FnDecl. 2014-04-17 11:42:30 +02:00
Felix S. Klock II
b25fe99331 Extended syntax::{fold, ast_map} to include lifetimes.
Part of this required added an override of `fold_type_method` in the
Folder for Ctx impl; it follows the same pattern as `fold_method`.

Also, as a drive-by fix, I moved all of the calls to `folder.new_id`
in syntax::fold's no-op default traversal to really be the first
statement in each function.

  * This is to uphold the invariant that `folder.new_id` is always
    called first (an unfortunate requirement of the current `ast_map`
    code), an invariant that we seemingly were breaking in e.g. the
    previous `noop_fold_block`.

  * Now it should be easier to see when adding new code that this
    invariant must be upheld.

  * (note that the breakage in `noop_fold_block` may not have mattered
    so much previously, since the only thing that blocks can bind are
    lifetimes, which I am only adding support for now.)
2014-04-17 11:42:30 +02:00
Felix S. Klock II
0e30f07abc Guard variance inference for params bound in non-variance context.
Before adding a variance constrant for a given early-bound param,
check if it was meant to be inferred.

To support the above, added `fn is_to_be_inferred` to
`variance::ConstraintContext`.
2014-04-17 11:25:46 +02:00
bors
18536190e1 auto merge of #13557 : FlaPer87/rust/ls-behind-z, r=brson
Closes #13549
2014-04-17 01:31:27 -07:00
Yuri Kunde Schlesner
03c595585b Simplify implementation of Bitv::{all,none} using iter builtins. 2014-04-17 05:21:18 -03:00
Guillaume Pinot
ba99e4ce54 parallelisation of shootout-k-nucleotide 2014-04-17 09:38:55 +02:00
Yuri Kunde Schlesner
23342027b0 Give reduction-type tests in Bitv more natural names 2014-04-17 02:08:20 -03:00
bors
787f4151e3 auto merge of #13550 : brson/rust/man, r=alexcrichton
--no-analysis, --dep-info, -C relocation-model, remove --gen-crate-map
2014-04-16 21:56:22 -07:00
bors
1dec47711d auto merge of #13503 : edwardw/rust/lifetime-ice, r=nikomatsakis
When instantiating trait default methods for certain implementation,
`typeck` correctly combined type parameters from trait bound with those
from method bound, but didn't do so for lifetime parameters. Applies
the same logic to lifetime parameters.

Closes #13204
2014-04-16 20:31:25 -07:00
bors
9f3fd9337d auto merge of #13499 : brson/rust/resultdocs, r=brson
This adds some fairly extensive documentation for `Result`.

I'm using manual links to other rustdoc html pages a bit.
2014-04-16 19:11:26 -07:00
bors
88805e1e00 auto merge of #13485 : adrientetar/rust/newrustdoc, r=brson
- Cherry-pick from #12996
- Use Fira Sans for headlines and sidebar (Light), Heuristica for the body (Adobe Utopia derivative). Both are licensed under the SIL OFL license.
- A few tweaks

Two examples: [modified `std`](http://adrientetar.legtux.org/cached/rust-docs/std.htm) and [modified `std::io`](http://adrientetar.legtux.org/cached/rust-docs/io.htm).

cc #13484
**Blocked on graydon/rust-www#25 (for hosting of the fonts), that's showcased [here](http://adrientetar.github.io/rust-www/).**

cc @brson, @TheHydroImpulse
2014-04-16 17:51:28 -07:00
Alex Crichton
6807eab800 rustc: Fix omission of bytecode in staticlibs
The name of the file changed awhile back and this spot wasn't updated to
continue ignoring the bytecode from rlibs when copying into staticlibs.
2014-04-16 17:29:08 -07:00
bors
ccccbd2368 auto merge of #13465 : alexcrichton/rust/fix-comm-dox, r=brson
Some of this documentation got a little out of date. There was no mention of a
`SyncSender`, and the entire "Outside the runtime" section isn't really true any
more (or really all that relevant).

This also updates a few other doc blocks and adds some examples.
2014-04-16 16:31:29 -07:00
bors
8dc935e42c auto merge of #13432 : ruediger/rust/rustmode, r=nikomatsakis
* Use `setq-local` instead of `(set (make-local-variable 'var) value)`.  Provides a version for older Emacsen.
* Remove use of `cl.el`.
* Use \' in file regexp instead of line end match $.
* Use type for `defcustom` and add parent group.
2014-04-16 14:31:32 -07:00
bors
b8d62147aa auto merge of #13418 : ktt3ja/rust/move-out-of, r=brson
This commit changes the way move errors are reported when some value is
captured by a PatIdent. First, we collect all of the "cannot move out
of" errors before reporting them, and those errors with the same "move
source" are reported together. If the move is caused by a PatIdent (that
binds by value), we add a note indicating where it is and suggest the
user to put `ref` if they don't want the value to move. This makes the
"cannot move out of" error in match expression nicer (though the extra
note may not feel that helpful in other places :P). For example, with
the following code snippet,

```rust
enum Foo {
    Foo1(~u32, ~u32),
    Foo2(~u32),
    Foo3,
}

fn main() {
    let f = &Foo1(~1u32, ~2u32);
    match *f {
        Foo1(num1, num2) => (),
        Foo2(num) => (),
        Foo3 => ()
    }
}
```

Errors before the change:

```rust
test.rs:10:9: 10:25 error: cannot move out of dereference of `&`-pointer
test.rs:10         Foo1(num1, num2) => (),
                   ^~~~~~~~~~~~~~~~
test.rs:10:9: 10:25 error: cannot move out of dereference of `&`-pointer
test.rs:10         Foo1(num1, num2) => (),
                   ^~~~~~~~~~~~~~~~
test.rs:11:9: 11:18 error: cannot move out of dereference of `&`-pointer
test.rs:11         Foo2(num) => (),
                   ^~~~~~~~~
```

After:

```rust
test.rs:9:11: 9:13 error: cannot move out of dereference of `&`-pointer
test.rs:9     match *f {
                    ^~
test.rs:10:14: 10:18 note: attempting to move value to here (to prevent the move, use `ref num1` or `ref mut num1` to capture value by reference)
test.rs:10         Foo1(num1, num2) => (),
                        ^~~~
test.rs:10:20: 10:24 note: and here (use `ref num2` or `ref mut num2`)
test.rs:10         Foo1(num1, num2) => (),
                              ^~~~
test.rs:11:14: 11:17 note: and here (use `ref num` or `ref mut num`)
test.rs:11         Foo2(num) => (),
                        ^~~
```

Close #8064
2014-04-16 13:11:30 -07:00
iancormac84
fc4c6ee462 This is a Windows specific fix in libc. According to MSDN, the GUID
structure's Data2 and Data3 members expect WORD types instead of DWORD. I
discovered this discrepancy while experimenting with some bindings to
Microsoft's OLE2 api. The discrepancy was corrupting the contents of the
string returned by UuidToString after I used known GUIDs to test the
accuracy of the function binding. I didn't add test cases because it would
mean adding a dependency to my rather incomplete binding library. However,
the fix produces expected string values when tested.
2014-04-16 15:43:17 -04:00
Alex Crichton
4ba94e2c24 rustc: Don't allocate a cnum to syntax crates
Syntax-only crates are no longer registered with the cstore, so there's no need
to allocate crate numbers to them. This ends up leaving gaps in the crate
numbering scheme which is not expected in the rest of the compiler.

Closes #13560
2014-04-16 11:42:22 -07:00
Brian Anderson
e69bd81dec doc: Address review feedback 2014-04-16 11:35:26 -07:00
Brian Anderson
46cb598efb std: Improve docs for mod 'result' 2014-04-16 11:35:26 -07:00
Brian Anderson
111178d028 rustc: Slightly reword the --no-analysis description for clarity 2014-04-16 11:30:36 -07:00
Brian Anderson
45e4fad5d0 man: Add missing options to rustc.1 2014-04-16 11:30:33 -07:00
bors
bfaf171c6d auto merge of #13454 : brson/rust/noglobs, r=alexcrichton
Them removes all the glob reexports from liblibc. I did it by removing them all, and then adding back per-platform explicit reexports until everything built again.

I realize this isn't the best strategy for determining an API, but this is the lowest-impact change that solves the problem, plus I'm dissatisfied with the design of this library for other reasons and think it needs to be reconsidered from top to bottom (later).

Progress on #11870.
2014-04-16 10:56:31 -07:00
Kang Seonghoon
010c107ca5 doc: Removed all definition lists as Sundown doesn't support them.
Closes #13561. Please revert this commit when Sundown (or any
replacement) gets a support for definition lists in the future.
2014-04-17 02:48:28 +09:00
Edward Wang
daa1f5099f Combine lifetime parameters when instantiating default methods
When instantiating trait default methods for certain implementation,
`typeck` correctly combined type parameters from trait bound with those
from method bound, but didn't do so for lifetime parameters. Applies
the same logic to lifetime parameters.

Closes #13204
2014-04-17 00:38:54 +08:00
bors
baa149bcc7 auto merge of #13556 : michaelwoerister/rust/various-fixes, r=alexcrichton
This is a test case verifying that issue #12886 was indeed fixed by PR #13441 from last week.
Fixes #12886.
2014-04-16 09:36:33 -07:00
Flavio Percoco
fcdc36b142 Move --ls behind -Z ls
Closes #13549
2014-04-16 17:45:06 +02:00
Alex Crichton
2286b0cb21 Register new snapshots 2014-04-16 08:24:22 -07:00
bors
72869b6579 auto merge of #13547 : alexcrichton/rust/remove-priv, r=huonw
See [RFC 6](e0c741f1c6/active/0006-remove-priv.md)
2014-04-16 08:16:35 -07:00
Alex Crichton
a0347d5224 syntax: Demote priv to a reserved keyword
It is no longer used in rust anywhere.

RFC: 0006-remove-priv
2014-04-16 08:12:43 -07:00
Alex Crichton
5cfbc0e7ae rustc: Remove private enum variants
This removes the `priv` keyword from the language and removes private enum
variants as a result. The remaining use cases of private enum variants were all
updated to be a struct with one private field that is a private enum.

RFC: 0006-remove-priv

Closes #13535
2014-04-16 08:12:43 -07:00
bors
12391df5b7 auto merge of #13544 : klutzy/rust/pprust, r=alexcrichton
Fixes #12685
2014-04-16 05:11:26 -07:00
bors
f39ba69aaa auto merge of #13539 : Aatch/rust/vector-copy-faster, r=thestinger
LLVM wasn't recognising the loops as memcpy loops and was therefore failing to optimise them properly. While improving LLVM is the "proper" way to fix this, I think that these cases are important enough to warrant a little low-level optimisation.

Fixes #13472 

r? @thestinger 

---

Benchmark Results:

```
--- Before ---
test clone_owned          ... bench:   6126104 ns/iter (+/- 285962) = 170 MB/s
test clone_owned_to_owned ... bench:   6125054 ns/iter (+/- 271197) = 170 MB/s
test clone_str            ... bench:     80586 ns/iter (+/- 11489) = 13011 MB/s
test clone_vec            ... bench:   3903220 ns/iter (+/- 658556) = 268 MB/s
test test_memcpy          ... bench:     69401 ns/iter (+/- 2168) = 15108 MB/s

--- After ---
test clone_owned          ... bench:     70839 ns/iter (+/- 4931) = 14801 MB/s
test clone_owned_to_owned ... bench:     70286 ns/iter (+/- 4836) = 14918 MB/s
test clone_str            ... bench:     78519 ns/iter (+/- 5511) = 13353 MB/s
test clone_vec            ... bench:     71415 ns/iter (+/- 1999) = 14682 MB/s
test test_memcpy          ... bench:     70980 ns/iter (+/- 2126) = 14772 MB/s
```
2014-04-16 03:36:27 -07:00
Michael Woerister
7c042cd70b debuginfo: Add a test case for issue #12886. 2014-04-16 12:22:38 +02:00
bors
61f788c772 auto merge of #13527 : huonw/rust/macro-expander-trait, r=sfackler
There's now one unified way to return things from a macro, instead of
being able to choose the `AnyMacro` trait or the `MRItem`/`MRExpr`
variants of the `MacResult` enum. This does simplify the logic handling
the expansions, but the biggest value of this is it makes macros in (for
example) type position easier to implement, as there's this single thing
to modify.

By my measurements (using `-Z time-passes` on libstd and librustc etc.),
this appears to have little-to-no impact on expansion speed. There are
presumably larger costs than the small number of extra allocations and
virtual calls this adds (notably, all `macro_rules!`-defined macros have
not changed in behaviour, since they had to use the `AnyMacro` trait
anyway).

---

Summary of changes for dynamic syntax extension maintainers:

- `MacResult` is now a trait, and is returned as `~MacResult`
- `MRExpr` & `MRItem` are now `MacExpr::new` and `MacItem:new` respectively (which return `~MacResult`s)
- `MacResult::dummy_...` is `DummyResult::any` or `DummyResult::expr`
2014-04-16 02:16:30 -07:00
bors
e33228727e auto merge of #13522 : seanmonstar/rust/sip, r=alexcrichton
work started from @gereeter's PR: https://github.com/mozilla/rust/pull/13114
but adjusted bits

```
before
test hash::sip::tests::bench_u64                            ... bench:        34 ns/iter (+/- 0)
test hash::sip::tests::bench_str_under_8_bytes              ... bench:        37 ns/iter (+/- 1)
test hash::sip::tests::bench_str_of_8_bytes                 ... bench:        43 ns/iter (+/- 1)
test hash::sip::tests::bench_str_over_8_bytes               ... bench:        50 ns/iter (+/- 1)
test hash::sip::tests::bench_long_str                       ... bench:       613 ns/iter (+/- 14)
test hash::sip::tests::bench_compound_1                     ... bench:       114 ns/iter (+/- 11)

after
test hash::sip::tests::bench_u64                            ... bench:        25 ns/iter (+/- 0)
test hash::sip::tests::bench_str_under_8_bytes              ... bench:        31 ns/iter (+/- 0)
test hash::sip::tests::bench_str_of_8_bytes                 ... bench:        36 ns/iter (+/- 0)
test hash::sip::tests::bench_str_over_8_bytes               ... bench:        40 ns/iter (+/- 0)
test hash::sip::tests::bench_long_str                       ... bench:       600 ns/iter (+/- 14)
test hash::sip::tests::bench_compound_1                     ... bench:        64 ns/iter (+/- 6)
```

Notably it seems smaller keys will hash faster. A long string doesn't see much gains, but compound cuts in half (once compound used a `int` and `u64`).
2014-04-16 00:56:30 -07:00
Huon Wilson
99dd5911a1 syntax: unify all MacResult's into a single trait.
There's now one unified way to return things from a macro, instead of
being able to choose the `AnyMacro` trait or the `MRItem`/`MRExpr`
variants of the `MacResult` enum. This does simplify the logic handling
the expansions, but the biggest value of this is it makes macros in (for
example) type position easier to implement, as there's this single thing
to modify.

By my measurements (using `-Z time-passes` on libstd and librustc etc.),
this appears to have little-to-no impact on expansion speed. There are
presumably larger costs than the small number of extra allocations and
virtual calls this adds (notably, all `macro_rules!`-defined macros have
not changed in behaviour, since they had to use the `AnyMacro` trait
anyway).
2014-04-16 17:53:27 +10:00
klutzy
96710c11de pprust: Handle multi-stmt/no-expr ExprFnBlock
Fixes #12685
2014-04-16 16:02:18 +09:00