Commit Graph

28126 Commits

Author SHA1 Message Date
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
bors
349d66af94 auto merge of #13532 : alexcrichton/rust/rollup, r=alexcrichton 2014-04-15 23:36:58 -07:00
Alex Crichton
c18c9284b3 Test fixes from the rollup
Closes #13546 (workcache: Don't assume gcc exists on all platforms)
Closes #13545 (std: Remove pub use globs)
Closes #13530 (test: Un-ignore smallest-hello-world.rs)
Closes #13529 (std: Un-ignore some float tests on windows)
Closes #13528 (green: Add a helper macro for booting libgreen)
Closes #13526 (Remove RUST_LOG="::help" from the docs)
Closes #13524 (dist: Make Windows installer uninstall first. Closes #9563)
Closes #13521 (Change AUTHORS section in the man pages)
Closes #13519 (Update GitHub's Rust projects page.)
Closes #13518 (mk: Change windows to install from stage2)
Closes #13516 (liburl doc: insert missing hyphen)
Closes #13514 (rustdoc: Better sorting criteria for searching.)
Closes #13512 (native: Fix a race in select())
Closes #13506 (Use the unsigned integer types for bitwise intrinsics.)
Closes #13502 (Add a default impl for Set::is_superset)
2014-04-15 22:54:07 -07:00
bors
74bd2338eb auto merge of #13390 : alexcrichton/rust/run-some-destructors, r=brson
Previously, if statements of the form "Foo;" or "let _ = Foo;" were encountered
where Foo had a destructor, the destructors were not run. This changes
the relevant locations in trans to check for ty::type_needs_drop and invokes
trans_to_lvalue instead of trans_into.

Closes #4734
Closes #6892
2014-04-15 21:17:00 -07:00
Alex Crichton
0754d1d061 green: Add a helper macro for booting libgreen
This one-liner should help booting libgreen with librustuv without having to
worry about all the fiddly bits of argc/argv and whatnot.
2014-04-15 19:47:03 -07:00
Alex Crichton
55f02b2c1b std: Un-ignore some float tests on windows
These were fixed in the upgrade from mingw32 to mingw64.

Closes #8663
2014-04-15 19:47:03 -07:00
Alex Crichton
9e8a270681 test: Un-ignore smallest-hello-world.rs
Rebased through the ages to bring the test up to date.

Closes #8538
2014-04-15 19:47:03 -07:00
Brian Anderson
c8f5b701dc std: Remove pub use globs 2014-04-15 19:47:03 -07:00
Alex Crichton
4a827f588e workcache: Don't assume gcc exists on all platforms
FreeBSD has recently moved to clang by default, and no longer ship gcc. Instead
use "cc" on unix platforms (the default compiler) and "gcc" on windows.
2014-04-15 19:47:03 -07:00
Steven Fackler
06edc6a3b6 More default impl and docs removal in treemap 2014-04-15 19:45:00 -07:00
Steven Fackler
c7325bdd8e Add a default impl for Set::is_superset
I also deleted a bunch of documentation that was copy/pasted from the
trait definition.
2014-04-15 19:45:00 -07:00
Huon Wilson
54ec04f1c1 Use the unsigned integer types for bitwise intrinsics.
Exposing ctpop, ctlz, cttz and bswap as taking signed i8/i16/... is just
exposing the internal LLVM names pointlessly (LLVM doesn't have "signed
integers" or "unsigned integers", it just has sized integer types
with (un)signed *operations*).

These operations are semantically working with raw bytes, which the
unsigned types model better.
2014-04-15 19:45:00 -07:00
Alex Crichton
93dc555188 native: Fix a race in select()
During selection, libnative would erroneously re-acquire ownership of a task
when a separate thread still had ownership of the task. The loop in select()
was rewritten to acknowledge this race and instead block waiting to re-acquire
ownership rather than plowing through.

Closes #13494
2014-04-15 19:45:00 -07:00
Alex Crichton
4ca7abb1c4 native: Be more stringent about pattern matching
Trying to avoid a wildcard where possible.
2014-04-15 19:45:00 -07:00
Alex Crichton
c836ff4621 std: Impl Deref/DerefMut for a borrowed task 2014-04-15 19:45:00 -07:00
Kang Seonghoon
326f938730 rustdoc: Better sorting criteria for searching.
This essentially rewrites the sorting algorithm, which relied on
the implementation-defined handling of non-consistent sorting function
(cf. ECMA-262 5th edition, section 15.4.4.11)
and was also a bit inefficient.

The new criteria expands the prior criteria while adding these ones:

- The current crate is always preferred over other crates.
  (Closes #13178)
- An item with a description is preferred over one without it,
  if item names match. This is a heuristic assuming that
  the documented item is more likely to be relevant.
- An item with no literal occurrence of search query is handled correctly.
2014-04-15 19:45:00 -07:00
Chris Shea
ea5d9088ad liburl doc: insert missing hyphen 2014-04-15 19:45:00 -07:00
Alex Crichton
efec34a95a mk: Change windows to install from stage2
In the past, windows was installed from stage3 to guarantee convergence between
the host and target artifacts, but syntax extensions on all platforms are
currently relying on convergence, so special casing this one platform has become
less relevant over time.

This will also have the added benefit of dealing with #13474 and #13491. These
issues will be closed after next next nightly is confirmed to fix them.
2014-04-15 19:45:00 -07:00
Mihnea Dobrescu-Balaur
ca5babea5f Update GitHub's Rust projects page. 2014-04-15 19:45:00 -07:00
Tobias Bucher
efc285b7e6 Change AUTHORS section in the man pages
The man pages no longer contain Graydon Hoare as the project lead.

Fix #13509.
2014-04-15 19:45:00 -07:00
Brian Anderson
8f3c2a6ffd dist: Make Windows installer uninstall first. Closes #9563
This will remove existing files before installing new ones. Note
that I took some code with no license from stackoverflow, as
indicated in comments.
2014-04-15 19:45:00 -07:00
Tobias Bucher
a5dcbc66db Remove RUST_LOG="::help" from the docs
This feature is no longer present in the current version, it was removed along
with the crate map.
2014-04-15 19:45:00 -07:00
James Miller
be334d5824 Make Vec::clone and slice::to_owned failure-safe 2014-04-16 14:29:36 +12:00
bors
b400a4d272 auto merge of #13498 : johnsoft/rust/fix-transmute-fn-names, r=alexcrichton
Regions were renamed to lifetimes a while back, so these functions should probably be renamed as well.
2014-04-15 19:21:57 -07:00
Alex Crichton
83351fa02e Remove usage of private enum variants
This replaces all uses of private enum variants with a struct that has
one private field pointing at a private enum.

RFC: 0006-remove-priv
2014-04-15 19:17:44 -07:00
bors
6fcf43e50e auto merge of #13511 : Meyermagic/rust/enum_typeid, r=alexcrichton
Fixes #13507.

I haven't familiarized myself with this part of the rust compiler, so hopefully there are no mistakes (despite the simplicity of the commit). It is also 5am.
2014-04-15 17:31:54 -07:00
James Miller
42b39924d8 Improve the copying code for slices and Vec 2014-04-16 11:35:31 +12:00
Sean McArthur
9c1cd69ce7 optimized SipHash implementation
work started from @gereeter's PR: https://github.com/mozilla/rust/pull/13114
but adjusted bits
2014-04-15 15:57:04 -07:00
bors
10f94e3fe5 auto merge of #13164 : ktt3ja/rust/lifetime-suggestion-method, r=nmatsakis
This includes a change to the way lifetime names are generated. Say we
figure that `[#0, 'a, 'b]` have to be the same lifetimes, then instead
of just generating a new lifetime `'c` like before to replace them, we
would reuse `'a`. This is done so that when the lifetime name comes
from an impl, we don't give something that's completely off, and we
don't have to do much work to figure out where the name came from. For
example, for the following code snippet:

```rust
struct Baz<'x> {
    bar: &'x int
}

impl<'x> Baz<'x> {
    fn baz1(&self) -> &int {
        self.bar
    }
}
```

`[#1, 'x]` (where `#1` is BrAnon(1) and refers to lifetime of `&int`)
have to be marked the same lifetime. With the old method, we would
generate a new lifetime `'a` and suggest `fn baz1(&self) -> &'a int`
or `fn baz1<'a>(&self) -> &'a int`, both of which are wrong.
2014-04-15 14:16:54 -07:00
Kiet Tran
79d1e5df21 Support lifetime suggestion for method
This includes a change to the way lifetime names are generated. Say we
figure that `[#0, 'a, 'b]` have to be the same lifetimes, then instead
of just generating a new lifetime `'c` like before to replace them, we
would reuse `'a`. This is done so that when the lifetime name comes
from an impl, we don't give something that's completely off, and we
don't have to do much work to figure out where the name came from. For
example, for the following code snippet:

```rust
struct Baz<'x> {
    bar: &'x int
}

impl<'x> Baz<'x> {
    fn baz1(&self) -> &int {
        self.bar
    }
}
```

`[#1, 'x]` (where `#1` is BrAnon(1) and refers to lifetime of `&int`)
have to be marked the same lifetime. With the old method, we would
generate a new lifetime `'a` and suggest `fn baz1(&self) -> &'a int`
or `fn baz1<'a>(&self) -> &'a int`, both of which are wrong.
2014-04-15 15:47:47 -04:00
Brian Anderson
9d48e61da3 libc: Deglob reexports. #11870 2014-04-15 11:36:14 -07:00
bors
189584e792 auto merge of #13489 : JustAPerson/rust/crate-file-name, r=alexcrichton
Before, the `--crate-file-name` flag only checked crate attributes for
possible crate types. Now, if any type is specified by one or more
`--crate-type` flags, only the filenames for those types will be
emitted, and any types specified by crate attributes will be ignored.
2014-04-15 11:02:03 -07:00
Alex Crichton
d1bfa51ea8 std: Update documentation on the comm module
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-15 06:24:30 -07:00
bors
8a4ffbf625 auto merge of #13416 : brson/rust/30min, r=alexcrichton
This is intended to be the first thing somebody new to the language reads about Rust. It is supposed to be simple and intriguing, to give the user an idea of whether Rust is appropriate for them, and to hint that there's a lot of cool stuff to learn if they just keep diving deeper.

I'm particularly happy with the sequence of concurrency examples.
2014-04-15 06:02:06 -07:00
Adrien Tétar
84bf922b69 rustdoc: add webfonts and tweak the styles accordingly 2014-04-15 20:15:19 +09:00
Brian Anderson
d1eb0e393f doc: Address feedback about intro 2014-04-14 20:49:29 -07:00
Meyer S. Jacobs
b9f7ac591c Fixes #13507
Fixes hashing of DefId for ty_enum.

Adds tests for cross-crate TypeId equivalence for various types.
2014-04-14 17:39:52 -07:00