Commit Graph

26724 Commits

Author SHA1 Message Date
Brian Anderson
feac422dd4 Merge remote-tracking branch 'tbu/pr_doc_smallfix' 2014-02-23 15:37:52 -08:00
Brian Anderson
0368886dbf Merge remote-tracking branch 'kud1ing/patch-1' 2014-02-23 15:37:13 -08:00
bors
329fcd48e5 auto merge of #12338 : edwardw/rust/hygienic-break-continue, r=cmr
Makes labelled loops hygiene by performing renaming of the labels defined in e.g. `'x: loop { ... }` and then used in break and continue statements within loop body so that they act hygienically when used with macros.
    
Closes #12262.
2014-02-23 15:37:05 -08:00
bors
cbed3321f5 auto merge of #12484 : TheHydroImpulse/rust/fix_js, r=huonw 2014-02-23 14:22:04 -08:00
kud1ing
778d032364 Tutorial: fix typo 2014-02-23 22:23:10 +01:00
bors
ba037475ee auto merge of #12492 : huonw/rust/snapshots, r=alexcrichton
Replaces IterBytes with the new Hash, removing all trace of the old implementation.
2014-02-23 13:07:01 -08:00
Huon Wilson
efaf4db24c Transition to new Hash, removing IterBytes and std::to_bytes. 2014-02-24 07:44:10 +11:00
Tobias Bucher
e9bb571aff Fix C function FFI example in the Rust cheatsheet 2014-02-23 20:55:02 +01:00
Huon Wilson
9e8d5aa29e arena,std,serialize: remove some unnecessary transmutes.
`as`-able transmutes, duplication and manual slice decomposition are
silly.
2014-02-24 01:15:39 +11:00
Huon Wilson
4cc723dc22 native: be more const correct with the FFI calls.
These calls are mutating their argument and so it's bad behaviour to be
pretending that the values are immutable to rustc.
2014-02-24 01:15:39 +11:00
Huon Wilson
8b246fda78 green,native,rustuv: Replace many pointer transmute's with as or referencing.
These can all be written in a more controlled manner than with the
transmute hammer, leading to (hopefully) safer code.
2014-02-24 01:15:39 +11:00
Huon Wilson
06e3e63c90 flate: return CVec<u8> rather than copying into a new vector.
This trades an O(n) allocation + memcpy for a O(1) proc allocation (for
the destructor). Most users only need &[u8] anyway (all of the users in
the main repo), and so this offers large gains.
2014-02-24 01:15:39 +11:00
Huon Wilson
768b96e8b1 green: remove ancient register-saving code.
@alexcrichton said he thought this was useless (and it's old logic: it's
been there since before the runtime was written into Rust).
2014-02-24 00:57:35 +11:00
Edward Wang
386db05df8 Make break and continue hygienic
Makes labelled loops hygiene by performing renaming of the labels
defined in e.g. `'x: loop { ... }` and then used in break and continue
statements within loop body so that they act hygienically when used with
macros.

Closes #12262.
2014-02-23 21:20:37 +08:00
Huon Wilson
5444da54fd Register snapshots. 2014-02-23 22:50:17 +11:00
bors
8786405047 auto merge of #12416 : alexcrichton/rust/highlight, r=huonw
This adds simple syntax highlighting based off libsyntax's lexer to be sure to
stay up to date with rust's grammar. Some of the highlighting is a bit ad-hoc,
but it definitely seems to get the job done!

This currently doesn't highlight rustdoc-rendered function signatures and
structs that are emitted to each page because the colors already signify what's
clickable and I think we'd have to figure out a different scheme before
colorizing them. This does, however, colorize all code examples and source code.

Closes #11393
2014-02-23 03:36:56 -08:00
bors
551da06157 auto merge of #12311 : brson/rust/unstable, r=alexcrichton
With the stability attributes we can put public-but unstable modules next to others, so this moves `intrinsics` and `raw` out of the `unstable` module (and marks both as `#[experimental]`).
2014-02-23 02:21:53 -08:00
Brian Anderson
db111846b5 std: Move unstable::stack to rt::stack 2014-02-23 01:47:08 -08:00
Brian Anderson
96b299e1f0 std: Remove unstable::lang
Put the lonely lang items here closer to the code they are calling.
2014-02-23 01:47:05 -08:00
Brian Anderson
3e57808a01 std: Move raw to std::raw
Issue #1457
2014-02-23 01:07:53 -08:00
Brian Anderson
4d10bdc5b9 std: Move intrinsics to std::intrinsics.
Issue #1457
2014-02-23 01:07:53 -08:00
bors
c250c16f81 auto merge of #12428 : alexcrichton/rust/move-hashmap, r=brson
These two containers are indeed collections, so there place is in
libcollections, not in libstd. There will always be a hash map as part of the
standard distribution of Rust, but by moving it out of the standard library it
makes libstd that much more portable to more platforms and environments.

This conveniently also removes the stuttering of 'std::hashmap::HashMap',
although 'collections::HashMap' is only one character shorter.
2014-02-23 01:06:57 -08:00
Alex Crichton
2a14e084cf Move std::{trie, hashmap} to libcollections
These two containers are indeed collections, so their place is in
libcollections, not in libstd. There will always be a hash map as part of the
standard distribution of Rust, but by moving it out of the standard library it
makes libstd that much more portable to more platforms and environments.

This conveniently also removes the stuttering of 'std::hashmap::HashMap',
although 'collections::HashMap' is only one character shorter.
2014-02-23 00:35:11 -08:00
Alex Crichton
ad9e26dab3 rustdoc: Add syntax highlighting
This adds simple syntax highlighting based off libsyntax's lexer to be sure to
stay up to date with rust's grammar. Some of the highlighting is a bit ad-hoc,
but it definitely seems to get the job done!

This currently doesn't highlight rustdoc-rendered function signatures and
structs that are emitted to each page because the colors already signify what's
clickable and I think we'd have to figure out a different scheme before
colorizing them. This does, however, colorize all code examples and source code.

Closes #11393
2014-02-23 00:16:23 -08:00
Brian Anderson
a8941c3e04 std: Remove some nonsense from old std::io docs
Most of this stuff is irrelevant implementation notes from last year.
This trims out the stuff that isn't appropriate for user-facing docs.
2014-02-22 23:05:11 -08:00
bors
edf351e9f7 auto merge of #12451 : edwardw/rust/ident-2-name, r=cmr
Closes #7743.
2014-02-22 22:01:54 -08:00
bors
9b9e2f80d5 auto merge of #12450 : FlaPer87/rust/issue-10682, r=alexcrichton
Fixes #10682
2014-02-22 20:21:54 -08:00
bors
a0f0699da6 auto merge of #12444 : thestinger/rust/arena, r=huonw
This prevents generating visit glue when using a TypedArena. The problem
still exists for the untyped Arena.
2014-02-22 19:06:52 -08:00
bors
4995a85f40 auto merge of #12448 : alexcrichton/rust/smaller-rust, r=brson
Two optimizations:

1. Compress `foo.bc` in each rlib with `flate`. These are just taking up space and are only used with LTO, no need for LTO to be speedy.
2. Stop install `librustc.rlib` and friends, this is a *huge* source of bloat. There's no need for us to install static libraries for these components.

cc #12440
2014-02-22 17:46:53 -08:00
Daniel Fagnan
c08cfa1872 Fixed invalid JavaScript
Signed-off-by: Daniel Fagnan <dnfagnan@gmail.com>
2014-02-22 18:16:53 -07:00
bors
22d3669b9e auto merge of #11863 : erickt/rust/hash, r=acrichto
This PR merges `IterBytes` and `Hash` into a trait that allows for generic non-stream-based hashing. It makes use of @eddyb's default type parameter support in order to have a similar usage to the old `Hash` framework.

Fixes #8038.

Todo:

- [x] Better documentation
- [ ] Benchmark
- [ ] Parameterize `HashMap` on a `Hasher`.
2014-02-22 15:01:58 -08:00
Erick Tryzelaar
ca6d512ec1 std: fix the hash doctest 2014-02-22 14:12:47 -08:00
Huon Wilson
713ca7d540 std: mark two helper functions #[inline].
`str::utf8_char_width` and `char::from_u32` are tiny, which means it's a
big performance hit to call them in a tight loop outside libstd.
2014-02-23 09:11:36 +11:00
bors
2ba0a8a096 auto merge of #11603 : alexcrichton/rust/issue-11591, r=brson
This prevents linker errors as found in #11591

Closes #11591
2014-02-22 11:41:48 -08:00
Alex Crichton
351d0ffaa1 Force all lang items to be reachable
This prevents linker errors as found in #11591

Closes #11591
2014-02-22 10:29:06 -08:00
bors
eb5ba4d269 auto merge of #12366 : aepsil0n/rust/feature/unnecessary_parens_around_assigned_values, r=alexcrichton
Fixes #12350.

Parentheses around assignment statements such as

```rust
let mut a = (0);
a = (1);
a += (2);
```

are not necessary and therefore an unnecessary_parens warning is raised when
statements like this occur.

NOTE: In `let` declarations this does not work as intended. Is it possible that they do not count as assignment expressions (`ExprAssign`)? (edit: this is fixed by now)

Furthermore, there are some cases that I fixed in the rest of the code, where parentheses could potentially enhance readability. Compare these lines:

```rust
a = b == c;
a = (b == c);
```

Thus, after having worked on this I'm not entirely sure, whether we should go through with this patch or not. Probably a matter of debate. ;)
2014-02-22 10:26:46 -08:00
bors
87e3b5fe7f auto merge of #12441 : kud1ing/rust/backticks, r=brson
Not all of those messages are covered by tests. I am not sure how to trigger them and where to put those tests.

Also some message patterns in the existing tests are not complete.
For example, i find `error: mismatched types: expected "i32" but found "char" (expected i32 but found char)` a bit repetitive, but as i can see there is no test covering that.
2014-02-22 09:11:47 -08:00
bors
52755b717e auto merge of #12439 : cmr/rust/rustdoc-reset, r=thestinger
rustdoc: web: don't reset the search bar
2014-02-22 07:56:47 -08:00
Eduard Bopp
9982de6397 Warn about unnecessary parentheses upon assignment
Closes #12366.

Parentheses around assignment statements such as

    let mut a = (0);
    a = (1);
    a += (2);

are not necessary and therefore an unnecessary_parens warning is raised when
statements like this occur.

The warning mechanism was refactored along the way to allow for code reuse
between the routines for checking expressions and statements.

Code had to be adopted throughout the compiler and standard libraries to comply
with this modification of the lint.
2014-02-22 16:32:48 +01:00
bors
51676b21d6 auto merge of #12437 : alexcrichton/rust/travis-yml, r=brson
Travis CI provides an easy-to-use continuous integration infrastructure for
github repos to use. Travis will automatically test all PRs which are opened
against the rust repository, informing PR owners of the test results.

I believe that this will be a very convenient piece of infrastructure as we'll
be able to reduce the load on bors quite a bit. In theory all PRs opened have
had the full test suite run against them, but unfortunately this is rarely the
case (I'm a prime suspect). Travis will be able to provide easy and relatively
quick (~30min) feedback for PRs. By ensuring fewer failures on bors, we can
hopefully feed more successful jobs to bors.

Overall, I expect this to be very helpful for new contributors as well as
regular contributors as it's another layer of tests being run which will
hopefully catch things sooner. One of the most convenient parts about using
Travis is that there's very little burden in terms of maintenance, and if things
go wrong we can easily turn travis completely off.

Note that this is *not* the metric by which a PR will be merged with. Using
travis will purely be another source for running tests, we will continue to gate
all PRs on bors.
2014-02-22 06:41:48 -08:00
bors
f764d477eb auto merge of #12433 : alexcrichton/rust/fix-some-config-things, r=brson
These are mostly centered around using an external LLVM (notably 3.5)
2014-02-22 05:16:51 -08:00
bors
c48babe546 auto merge of #12427 : alexcrichton/rust/snapshots, r=brson
This contains the fix for #4252 so we can start using methods in destructors.
2014-02-22 03:21:52 -08:00
Huon Wilson
abde5ed011 mk: restore check-notidy.
tidy has some limitations (e.g. the "checked in binaries" check doesn't
and can't actually check git), and so it's useful to run tests without
running tidy occasionally.
2014-02-22 20:18:29 +11:00
bors
d22099ca44 auto merge of #12462 : kballard/rust/restore-llvm-from-12407, r=brson
PR #12407 was accidentally reverted by PR #12411. Restore the correct
version of LLVM that PR #12407 introduced.
2014-02-22 01:11:50 -08:00
Kevin Ballard
e61c7fd3e2 Restore LLVM to the correct revision
PR #12407 was accidentally reverted by PR #12411. Restore the correct
version of LLVM that PR #12407 introduced.
2014-02-21 23:59:58 -08:00
bors
068781e5aa auto merge of #12422 : alexcrichton/rust/buffered-default, r=brson
One of the most common ways to use the stdin stream is to read it line by line
for a small program. In order to facilitate this common usage pattern, this
commit changes the stdin() function to return a BufferedReader by default. A new
`stdin_raw()` method was added to get access to the raw unbuffered stream.

I have not changed the stdout or stderr methods because they are currently
unable to flush in their destructor, but #12403 should have just fixed that.
2014-02-21 23:56:47 -08:00
Brian Anderson
623e475146 test: 'ratcher' is not a word 2014-02-21 23:53:37 -08:00
Daniel Micay
4687e1d67d remove the TyDesc from TypedArena
This prevents generating visit glue when using a TypedArena. The problem
still exists for the untyped Arena.
2014-02-22 02:04:25 -05:00
Erick Tryzelaar
d223dd1e57 std: rewrite Hash to make it more generic
This patch merges IterBytes and Hash traits, which clears up the
confusion of using `#[deriving(IterBytes)]` to support hashing.
Instead, it now is much easier to use the new `#[deriving(Hash)]`
for making a type hashable with a stream hash.

Furthermore, it supports custom non-stream-based hashers, such as
if a value's hash was cached in a database.

This does not yet replace the old IterBytes-hash with this new
version.
2014-02-21 21:33:23 -08:00
bors
698042de23 auto merge of #12421 : Hywan/rust/api_doc, r=alexcrichton
I was reading the code and saw this. Not the best contribution of my life ;-).
2014-02-21 21:26:49 -08:00