]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoMerge remote-tracking branch 'huonw/inline-helpers'
Brian Anderson [Sun, 23 Feb 2014 23:44:20 +0000 (15:44 -0800)]
Merge remote-tracking branch 'huonw/inline-helpers'

10 years agoMerge remote-tracking branch 'brson/ratcher'
Brian Anderson [Sun, 23 Feb 2014 23:43:28 +0000 (15:43 -0800)]
Merge remote-tracking branch 'brson/ratcher'

10 years agoMerge remote-tracking branch 'brson/iodoc'
Brian Anderson [Sun, 23 Feb 2014 23:43:23 +0000 (15:43 -0800)]
Merge remote-tracking branch 'brson/iodoc'

10 years agoMerge remote-tracking branch 'tbu/pr_doc_smallfix'
Brian Anderson [Sun, 23 Feb 2014 23:37:52 +0000 (15:37 -0800)]
Merge remote-tracking branch 'tbu/pr_doc_smallfix'

10 years agoMerge remote-tracking branch 'kud1ing/patch-1'
Brian Anderson [Sun, 23 Feb 2014 23:37:13 +0000 (15:37 -0800)]
Merge remote-tracking branch 'kud1ing/patch-1'

10 years agoauto merge of #12484 : TheHydroImpulse/rust/fix_js, r=huonw
bors [Sun, 23 Feb 2014 22:22:04 +0000 (14:22 -0800)]
auto merge of #12484 : TheHydroImpulse/rust/fix_js, r=huonw

10 years agoTutorial: fix typo
kud1ing [Sun, 23 Feb 2014 21:23:10 +0000 (22:23 +0100)]
Tutorial: fix typo

10 years agoauto merge of #12492 : huonw/rust/snapshots, r=alexcrichton
bors [Sun, 23 Feb 2014 21:07:01 +0000 (13:07 -0800)]
auto merge of #12492 : huonw/rust/snapshots, r=alexcrichton

Replaces IterBytes with the new Hash, removing all trace of the old implementation.

10 years agoTransition to new `Hash`, removing IterBytes and std::to_bytes.
Huon Wilson [Sun, 23 Feb 2014 10:29:35 +0000 (21:29 +1100)]
Transition to new `Hash`, removing IterBytes and std::to_bytes.

10 years agoFix C function FFI example in the Rust cheatsheet
Tobias Bucher [Sun, 23 Feb 2014 18:52:33 +0000 (19:52 +0100)]
Fix C function FFI example in the Rust cheatsheet

10 years agoRegister snapshots.
Huon Wilson [Sun, 23 Feb 2014 07:30:05 +0000 (18:30 +1100)]
Register snapshots.

10 years agoauto merge of #12416 : alexcrichton/rust/highlight, r=huonw
bors [Sun, 23 Feb 2014 11:36:56 +0000 (03:36 -0800)]
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

10 years agoauto merge of #12311 : brson/rust/unstable, r=alexcrichton
bors [Sun, 23 Feb 2014 10:21:53 +0000 (02:21 -0800)]
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]`).

10 years agostd: Move unstable::stack to rt::stack
Brian Anderson [Mon, 17 Feb 2014 05:37:12 +0000 (21:37 -0800)]
std: Move unstable::stack to rt::stack

10 years agostd: Remove unstable::lang
Brian Anderson [Mon, 17 Feb 2014 04:16:23 +0000 (20:16 -0800)]
std: Remove unstable::lang

Put the lonely lang items here closer to the code they are calling.

10 years agostd: Move raw to std::raw
Brian Anderson [Sun, 16 Feb 2014 08:04:33 +0000 (00:04 -0800)]
std: Move raw to std::raw

Issue #1457

10 years agostd: Move intrinsics to std::intrinsics.
Brian Anderson [Sun, 16 Feb 2014 07:49:08 +0000 (23:49 -0800)]
std: Move intrinsics to std::intrinsics.

Issue #1457

10 years agoauto merge of #12428 : alexcrichton/rust/move-hashmap, r=brson
bors [Sun, 23 Feb 2014 09:06:57 +0000 (01:06 -0800)]
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.

10 years agoMove std::{trie, hashmap} to libcollections
Alex Crichton [Thu, 20 Feb 2014 03:29:58 +0000 (19:29 -0800)]
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.

10 years agorustdoc: Add syntax highlighting
Alex Crichton [Thu, 20 Feb 2014 09:14:51 +0000 (01:14 -0800)]
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

10 years agostd: Remove some nonsense from old std::io docs
Brian Anderson [Sat, 22 Feb 2014 23:53:54 +0000 (15:53 -0800)]
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.

10 years agoauto merge of #12451 : edwardw/rust/ident-2-name, r=cmr
bors [Sun, 23 Feb 2014 06:01:54 +0000 (22:01 -0800)]
auto merge of #12451 : edwardw/rust/ident-2-name, r=cmr

Closes #7743.

10 years agoauto merge of #12450 : FlaPer87/rust/issue-10682, r=alexcrichton
bors [Sun, 23 Feb 2014 04:21:54 +0000 (20:21 -0800)]
auto merge of #12450 : FlaPer87/rust/issue-10682, r=alexcrichton

Fixes #10682

10 years agoauto merge of #12444 : thestinger/rust/arena, r=huonw
bors [Sun, 23 Feb 2014 03:06:52 +0000 (19:06 -0800)]
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.

10 years agoauto merge of #12448 : alexcrichton/rust/smaller-rust, r=brson
bors [Sun, 23 Feb 2014 01:46:53 +0000 (17:46 -0800)]
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

10 years agoFixed invalid JavaScript
Daniel Fagnan [Sun, 23 Feb 2014 01:08:17 +0000 (18:08 -0700)]
Fixed invalid JavaScript

Signed-off-by: Daniel Fagnan <dnfagnan@gmail.com>
10 years agoauto merge of #11863 : erickt/rust/hash, r=acrichto
bors [Sat, 22 Feb 2014 23:01:58 +0000 (15:01 -0800)]
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`.

10 years agostd: fix the hash doctest
Erick Tryzelaar [Sat, 22 Feb 2014 22:12:47 +0000 (14:12 -0800)]
std: fix the hash doctest

10 years agostd: mark two helper functions #[inline].
Huon Wilson [Sat, 22 Feb 2014 22:11:36 +0000 (09:11 +1100)]
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.

10 years agoauto merge of #11603 : alexcrichton/rust/issue-11591, r=brson
bors [Sat, 22 Feb 2014 19:41:48 +0000 (11:41 -0800)]
auto merge of #11603 : alexcrichton/rust/issue-11591, r=brson

This prevents linker errors as found in #11591

Closes #11591

10 years agoForce all lang items to be reachable
Alex Crichton [Thu, 16 Jan 2014 18:12:31 +0000 (10:12 -0800)]
Force all lang items to be reachable

This prevents linker errors as found in #11591

Closes #11591

10 years agoauto merge of #12366 : aepsil0n/rust/feature/unnecessary_parens_around_assigned_value...
bors [Sat, 22 Feb 2014 18:26:46 +0000 (10:26 -0800)]
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. ;)

10 years agoauto merge of #12441 : kud1ing/rust/backticks, r=brson
bors [Sat, 22 Feb 2014 17:11:47 +0000 (09:11 -0800)]
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.

10 years agoauto merge of #12439 : cmr/rust/rustdoc-reset, r=thestinger
bors [Sat, 22 Feb 2014 15:56:47 +0000 (07:56 -0800)]
auto merge of #12439 : cmr/rust/rustdoc-reset, r=thestinger

rustdoc: web: don't reset the search bar

10 years agoWarn about unnecessary parentheses upon assignment
Eduard Bopp [Tue, 18 Feb 2014 12:40:25 +0000 (13:40 +0100)]
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.

10 years agoauto merge of #12437 : alexcrichton/rust/travis-yml, r=brson
bors [Sat, 22 Feb 2014 14:41:48 +0000 (06:41 -0800)]
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.

10 years agoauto merge of #12433 : alexcrichton/rust/fix-some-config-things, r=brson
bors [Sat, 22 Feb 2014 13:16:51 +0000 (05:16 -0800)]
auto merge of #12433 : alexcrichton/rust/fix-some-config-things, r=brson

These are mostly centered around using an external LLVM (notably 3.5)

10 years agoauto merge of #12427 : alexcrichton/rust/snapshots, r=brson
bors [Sat, 22 Feb 2014 11:21:52 +0000 (03:21 -0800)]
auto merge of #12427 : alexcrichton/rust/snapshots, r=brson

This contains the fix for #4252 so we can start using methods in destructors.

10 years agoauto merge of #12462 : kballard/rust/restore-llvm-from-12407, r=brson
bors [Sat, 22 Feb 2014 09:11:50 +0000 (01:11 -0800)]
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.

10 years agoRestore LLVM to the correct revision
Kevin Ballard [Sat, 22 Feb 2014 07:59:58 +0000 (23:59 -0800)]
Restore LLVM to the correct revision

PR #12407 was accidentally reverted by PR #12411. Restore the correct
version of LLVM that PR #12407 introduced.

10 years agoauto merge of #12422 : alexcrichton/rust/buffered-default, r=brson
bors [Sat, 22 Feb 2014 07:56:47 +0000 (23:56 -0800)]
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.

10 years agotest: 'ratcher' is not a word
Brian Anderson [Sat, 22 Feb 2014 07:53:37 +0000 (23:53 -0800)]
test: 'ratcher' is not a word

10 years agoremove the TyDesc from TypedArena
Daniel Micay [Fri, 21 Feb 2014 12:25:17 +0000 (07:25 -0500)]
remove the TyDesc from TypedArena

This prevents generating visit glue when using a TypedArena. The problem
still exists for the untyped Arena.

10 years agostd: rewrite Hash to make it more generic
Erick Tryzelaar [Sat, 22 Feb 2014 05:33:23 +0000 (21:33 -0800)]
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.

10 years agoauto merge of #12421 : Hywan/rust/api_doc, r=alexcrichton
bors [Sat, 22 Feb 2014 05:26:49 +0000 (21:26 -0800)]
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 ;-).

10 years agosyntax: add syntax extension helper to make simple view items
Erick Tryzelaar [Sun, 16 Feb 2014 06:10:16 +0000 (22:10 -0800)]
syntax: add syntax extension helper to make simple view items

10 years agosyntax: Allow syntax extensions to have attributes
Erick Tryzelaar [Fri, 14 Feb 2014 16:09:51 +0000 (08:09 -0800)]
syntax: Allow syntax extensions to have attributes

10 years agostd: minor whitespace cleanup
Erick Tryzelaar [Mon, 10 Feb 2014 15:14:58 +0000 (07:14 -0800)]
std: minor whitespace cleanup

10 years agoextra: rename Uuid::to_bytes() to as_bytes()
Erick Tryzelaar [Wed, 22 Jan 2014 01:02:31 +0000 (17:02 -0800)]
extra: rename Uuid::to_bytes() to as_bytes()

10 years agoauto merge of #12411 : Arcterus/rust/time, r=alexcrichton
bors [Sat, 22 Feb 2014 03:46:51 +0000 (19:46 -0800)]
auto merge of #12411 : Arcterus/rust/time, r=alexcrichton

More work towards finishing #8784.

10 years agoauto merge of #12382 : bjz/rust/fmt-int, r=alexcrichton
bors [Sat, 22 Feb 2014 00:36:52 +0000 (16:36 -0800)]
auto merge of #12382 : bjz/rust/fmt-int, r=alexcrichton

This is PR is the beginning of a complete rewrite and ultimate removal of the `std::num::strconv` module (see #6220), and the removal of the `ToStrRadix` trait in favour of using the `std::fmt` functionality directly. This should make for a cleaner API, encourage less allocation, and make the implementation more comprehensible .

The `Formatter::{pad_integral, with_padding}` methods have also been refactored make things easier to understand.

The formatting tests for integers have been moved out of `run-pass/ifmt.rs` in order to provide more immediate feedback when building using `make check-stage2-std NO_REBUILD=1`.

Arbitrary radixes are now easier to use in format strings. For example:

~~~rust
assert_eq!(format!("{:04}", radix(3, 2)), ~"0011");
~~~

The benchmarks have been standardised between `std::num::strconv` and `std::num::fmt` to make it easier to compare the performance of the different implementations.

~~~
 type | radix | std::num::strconv      | std::num::fmt
======|=======|========================|======================
 int  | bin   | 1748 ns/iter (+/- 150) | 321 ns/iter (+/- 25)
 int  | oct   |  706 ns/iter (+/- 53)  | 179 ns/iter (+/- 22)
 int  | dec   |  640 ns/iter (+/- 59)  | 207 ns/iter (+/- 10)
 int  | hex   |  637 ns/iter (+/- 77)  | 205 ns/iter (+/- 19)
 int  | 36    |  446 ns/iter (+/- 30)  | 309 ns/iter (+/- 20)
------|-------|------------------------|----------------------
 uint | bin   | 1724 ns/iter (+/- 159) | 322 ns/iter (+/- 13)
 uint | oct   |  663 ns/iter (+/- 25)  | 175 ns/iter (+/- 7)
 uint | dec   |  613 ns/iter (+/- 30)  | 186 ns/iter (+/- 6)
 uint | hex   |  519 ns/iter (+/- 44)  | 207 ns/iter (+/- 20)
 uint | 36    |  418 ns/iter (+/- 16)  | 308 ns/iter (+/- 32)
~~~

10 years agoauto merge of #12362 : liigo/rust/update-rust-manual, r=alexcrichton
bors [Fri, 21 Feb 2014 21:56:49 +0000 (13:56 -0800)]
auto merge of #12362 : liigo/rust/update-rust-manual, r=alexcrichton

change `extern mod` to `extern crate`, `package id` to `crate id`, and some lines wrapping fix, etc.

10 years agoRepresent lifetimes as Names instead of Idents
Edward Wang [Fri, 21 Feb 2014 20:04:03 +0000 (04:04 +0800)]
Represent lifetimes as Names instead of Idents

Closes #7743.

10 years agoauto merge of #12253 : pcwalton/rust/more-vec-ng, r=alexcrichton
bors [Fri, 21 Feb 2014 19:41:51 +0000 (11:41 -0800)]
auto merge of #12253 : pcwalton/rust/more-vec-ng, r=alexcrichton

r? @brson

10 years agoTest nested `proc` can access outer owned data
Flavio Percoco [Fri, 21 Feb 2014 19:37:51 +0000 (20:37 +0100)]
Test nested `proc` can access outer owned data

Fixes #10682

10 years agomk: Don't install host rlibs
Alex Crichton [Fri, 21 Feb 2014 18:55:30 +0000 (10:55 -0800)]
mk: Don't install host rlibs

You rarely want to statically link against librustc and friends, so there's no
real reason to install the rlib version of these libraries, especially because
the rlibs are massive.

10 years agolibstd: Implement some convenience methods on vectors
Patrick Walton [Wed, 19 Feb 2014 05:36:51 +0000 (21:36 -0800)]
libstd: Implement some convenience methods on vectors

10 years agorustc: Compress bytecode files in rlibs
Alex Crichton [Fri, 21 Feb 2014 18:54:00 +0000 (10:54 -0800)]
rustc: Compress bytecode files in rlibs

These are only ever used with LTO, so there's no need for reading them to be
speedy.

10 years agoauto merge of #12326 : bjz/rust/integer, r=alexcrichton
bors [Fri, 21 Feb 2014 17:46:49 +0000 (09:46 -0800)]
auto merge of #12326 : bjz/rust/integer, r=alexcrichton

This is part of the effort to simplify `std::num`, as tracked in issue #10387.

10 years agoReduce reliance on `to_str_radix`
Brendan Zabarauskas [Fri, 21 Feb 2014 16:53:18 +0000 (03:53 +1100)]
Reduce reliance on `to_str_radix`

This is in preparation to remove the implementations of ToStrRadix in integers, and to remove the associated logic from `std::num::strconv`.

The parts that still need to be liberated are:

- `std::fmt::Formatter::runplural`
- `num::{bigint, complex, rational}`

10 years agoDecouple integer formatting from std::num::strconv
Brendan Zabarauskas [Fri, 21 Feb 2014 16:52:32 +0000 (03:52 +1100)]
Decouple integer formatting from std::num::strconv

This works towards a complete rewrite and ultimate removal of the `std::num::strconv` module (see #6220), and the removal of the `ToStrRadix` trait in favour of using the `std::fmt` functionality directly. This should make for a cleaner API, encourage less allocation, and make the implementation far more comprehensible.

The `Formatter::pad_integral` method has also been refactored make it easier to understand.

The formatting tests for integers have been moved out of `run-pass/ifmt.rs` in order to provide more immediate feedback when building using `make check-stage2-std NO_REBUILD=1`.

The benchmarks have been standardised between std::num::strconv and std::num::fmt to make it easier to compare the performance of the different implementations.

Arbitrary radixes are now easier to use in format strings. For example:

~~~
assert_eq!(format!("{:04}", radix(3, 2)), ~"0011");
~~~

10 years agoAdd Pod trait bound to std::num::Primitive
Brendan Zabarauskas [Fri, 21 Feb 2014 16:51:56 +0000 (03:51 +1100)]
Add Pod trait bound to std::num::Primitive

10 years agoauto merge of #12420 : pnkfelix/rust/fsk-improve-doc-for-ptr-offset, r=alexcrichton
bors [Fri, 21 Feb 2014 16:26:50 +0000 (08:26 -0800)]
auto merge of #12420 : pnkfelix/rust/fsk-improve-doc-for-ptr-offset, r=alexcrichton

ptr::RawPtr, spell out units used for the `offset` argument.

spell out units used for the `offset` argument, so that callers do not
try to scale to byte units themselves.

(this was originally landed in PR #11002 for the stand-alone functions, but that PR did not modify the `RawPtr` methods, since that had no doc at all at the time.  Now `RawPtr` has the *only* documentation for `offset`, since the stand-alone functions went away in PR #12167 / PR #12248.)

10 years agoMove time out of extra (cc #8784)
Arcterus [Thu, 20 Feb 2014 03:08:12 +0000 (19:08 -0800)]
Move time out of extra (cc #8784)

10 years agoauto merge of #12419 : huonw/rust/compiler-unsafe, r=alexcrichton
bors [Fri, 21 Feb 2014 15:06:51 +0000 (07:06 -0800)]
auto merge of #12419 : huonw/rust/compiler-unsafe, r=alexcrichton

Previously an `unsafe` block created by the compiler (like those in the
formatting macros) would be "ignored" if surrounded by `unsafe`, that
is, the internal unsafety would be being legitimised by the external
block:

    unsafe { println!("...") } =(expansion)=> unsafe { ... unsafe { ... } }

And the code in the inner block would be using the outer block, making
it considered used (and the inner one considered unused).

This patch forces the compiler to create a new unsafe context for
compiler generated blocks, so that their internal unsafety doesn't
escape to external blocks.

Fixes #12418.

10 years agoMove std::num::Integer to libnum
Brendan Zabarauskas [Sun, 16 Feb 2014 20:20:01 +0000 (07:20 +1100)]
Move std::num::Integer to libnum

10 years agoauto merge of #12415 : HeroesGrave/rust/move-enum-set, r=alexcrichton
bors [Fri, 21 Feb 2014 13:26:58 +0000 (05:26 -0800)]
auto merge of #12415 : HeroesGrave/rust/move-enum-set, r=alexcrichton

Part of #8784

Also removed the one glob import.

10 years agoauto merge of #12410 : DaGenix/rust/fix-incorrect-comment, r=alexcrichton
bors [Fri, 21 Feb 2014 12:01:57 +0000 (04:01 -0800)]
auto merge of #12410 : DaGenix/rust/fix-incorrect-comment, r=alexcrichton

The comments say that the prelude imports std::io::println since it would
be annoying to have to import it in every program that uses it. However,
the prelude doesn't actually import that function anymore. So, update the
comments to better match reality.

10 years agoinsignificant fix to rust manual and tutorial
Liigo Zhuang [Tue, 18 Feb 2014 07:03:09 +0000 (15:03 +0800)]
insignificant fix to rust manual and tutorial

10 years agoauto merge of #12290 : mrshu/rust/lint-warn-by-default, r=alexcrichton
bors [Fri, 21 Feb 2014 08:56:58 +0000 (00:56 -0800)]
auto merge of #12290 : mrshu/rust/lint-warn-by-default, r=alexcrichton

This first part of my attempts to fix #11432.

In this one I only set NonCamelCaseTypes to warn by default and tried to fix errors that were reported by `make check`.

Please feel free to let me know if I missed something or didn't do it the right way.

Thanks.

10 years agobackticks
kud1ing [Fri, 21 Feb 2014 07:26:20 +0000 (08:26 +0100)]
backticks

10 years agoauto merge of #12407 : alexcrichton/rust/up-llvm, r=sfackler
bors [Fri, 21 Feb 2014 07:16:57 +0000 (23:16 -0800)]
auto merge of #12407 : alexcrichton/rust/up-llvm, r=sfackler

This updates the LLVM submodule to the `rust-llvm-2014-02-19` tag which is the
old one with https://github.com/rust-lang/llvm/pull/4 cherry-picked on top.

Awesome job by @neykov for this!

10 years agorustdoc: web: don't reset the search bar
Corey Richardson [Fri, 21 Feb 2014 07:15:08 +0000 (02:15 -0500)]
rustdoc: web: don't reset the search bar

10 years agoChanged NonCamelCaseTypes lint to warn by default
mr.Shu [Mon, 10 Feb 2014 14:36:31 +0000 (15:36 +0100)]
Changed NonCamelCaseTypes lint to warn by default

Added allow(non_camel_case_types) to librustc where necesary

Tried to fix problems with non_camel_case_types outside rustc

fixed failing tests

Docs updated

Moved #[allow(non_camel_case_types)] a level higher.

markdown.rs reverted

Fixed timer that was failing tests

Fixed another timer

10 years agoAdd a Travis-CI configuration for the repo
Alex Crichton [Thu, 20 Feb 2014 23:37:44 +0000 (15:37 -0800)]
Add a Travis-CI configuration for the repo

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.

10 years agomk: Fix --llvm-root finding tools
Alex Crichton [Fri, 21 Feb 2014 02:07:33 +0000 (18:07 -0800)]
mk: Fix --llvm-root finding tools

LLVM's tools are not contained in the local directory if --llvm-root is used by
the ./configure script. This fixes the installation path to be the root provided
by --llvm-root.

10 years agoconfigure: Accept LLVM 3.5 for building rust
Alex Crichton [Fri, 21 Feb 2014 02:07:08 +0000 (18:07 -0800)]
configure: Accept LLVM 3.5 for building rust

This is the current head of LLVM, and we can indeed build with 3.5

10 years agoauto merge of #12164 : alexcrichton/rust/rlibs-and-dylibs, r=cmr
bors [Fri, 21 Feb 2014 02:51:57 +0000 (18:51 -0800)]
auto merge of #12164 : alexcrichton/rust/rlibs-and-dylibs, r=cmr

The first commit improves error messages during linking, and the second commit improves error messages during crate-loading time.

Closes #12297
Closes #12377

10 years agomk: Fix --llvm-root finding tools
Alex Crichton [Fri, 21 Feb 2014 02:07:33 +0000 (18:07 -0800)]
mk: Fix --llvm-root finding tools

LLVM's tools are not contained in the local directory if --llvm-root is used by
the ./configure script. This fixes the installation path to be the root provided
by --llvm-root.

10 years agoconfigure: Accept LLVM 3.5 for building rust
Alex Crichton [Fri, 21 Feb 2014 02:07:08 +0000 (18:07 -0800)]
configure: Accept LLVM 3.5 for building rust

This is the current head of LLVM, and we can indeed build with 3.5

10 years agoRe-work loading crates with nicer errors
Alex Crichton [Mon, 10 Feb 2014 20:50:53 +0000 (12:50 -0800)]
Re-work loading crates with nicer errors

This commit rewrites crate loading internally in attempt to look at less
metadata and provide nicer errors. The loading is now split up into a few
stages:

1. Collect a mapping of (hash => ~[Path]) for a set of candidate libraries for a
   given search. The hash is the hash in the filename and the Path is the
   location of the library in question. All candidates are filtered based on
   their prefix/suffix (dylib/rlib appropriate) and then the hash/version are
   split up and are compared (if necessary).

   This means that if you're looking for an exact hash of library you don't have
   to open up the metadata of all libraries named the same, but also in your
   path.

2. Once this mapping is constructed, each (hash, ~[Path]) pair is filtered down
   to just a Path. This is necessary because the same rlib could show up twice
   in the path in multiple locations. Right now the filenames are based on just
   the crate id, so this could be indicative of multiple version of a crate
   during one crate_id lifetime in the path. If multiple duplicate crates are
   found, an error is generated.

3. Now that we have a mapping of (hash => Path), we error on multiple versions
   saying that multiple versions were found. Only if there's one (hash => Path)
   pair do we actually return that Path and its metadata.

With this restructuring, it restructures code so errors which were assertions
previously are now first-class errors. Additionally, this should read much less
metadata with lots of crates of the same name or same version in a path.

Closes #11908

10 years agoauto merge of #12401 : alexcrichton/rust/if-ok-2-try, r=brson
bors [Fri, 21 Feb 2014 00:56:51 +0000 (16:56 -0800)]
auto merge of #12401 : alexcrichton/rust/if-ok-2-try, r=brson

This "bubble up an error" macro was originally named if_ok! in order to get it
landed, but after the fact it was discovered that this name is not exactly
desirable.

The name `if_ok!` isn't immediately clear that is has much to do with error
handling, and it doesn't look fantastic in all contexts (if if_ok!(...) {}). In
general, the agreed opinion about `if_ok!` is that is came in as subpar.

The name `try!` is more invocative of error handling, it's shorter by 2 letters,
and it looks fitting in almost all circumstances. One concern about the word
`try!` is that it's too invocative of exceptions, but the belief is that this
will be overcome with documentation and examples.

Close #12037

10 years agoRegister new snapshots
Alex Crichton [Fri, 21 Feb 2014 00:00:16 +0000 (16:00 -0800)]
Register new snapshots

This contains the fix for #4252 so we can start using methods in destructors.

10 years agoauto merge of #12161 : aepsil0n/rust/docs/for-loop, r=alexcrichton
bors [Thu, 20 Feb 2014 18:36:49 +0000 (10:36 -0800)]
auto merge of #12161 : aepsil0n/rust/docs/for-loop, r=alexcrichton

I just started learning Rust and the absence of an explanation of the for-loop in the beginning really bugged me about the tutorial. Hence I simply added these lines, where I would have expected them. I know that there is something later on in the section on traits. However, this simple iteration scheme feels like something that you should be aware of right away.

10 years agoMass rename if_ok! to try!
Alex Crichton [Wed, 19 Feb 2014 18:07:49 +0000 (10:07 -0800)]
Mass rename if_ok! to try!

This "bubble up an error" macro was originally named if_ok! in order to get it
landed, but after the fact it was discovered that this name is not exactly
desirable.

The name `if_ok!` isn't immediately clear that is has much to do with error
handling, and it doesn't look fantastic in all contexts (if if_ok!(...) {}). In
general, the agreed opinion about `if_ok!` is that is came in as subpar.

The name `try!` is more invocative of error handling, it's shorter by 2 letters,
and it looks fitting in almost all circumstances. One concern about the word
`try!` is that it's too invocative of exceptions, but the belief is that this
will be overcome with documentation and examples.

Close #12037

10 years agoReturn a buffered stdin by default.
Alex Crichton [Thu, 20 Feb 2014 17:11:56 +0000 (09:11 -0800)]
Return a buffered stdin by default.

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.

10 years agoauto merge of #12405 : kud1ing/rust/backticks, r=huonw
bors [Thu, 20 Feb 2014 16:21:45 +0000 (08:21 -0800)]
auto merge of #12405 : kud1ing/rust/backticks, r=huonw

10 years agoFix some typos.
Ivan Enderlin [Thu, 20 Feb 2014 15:56:22 +0000 (16:56 +0100)]
Fix some typos.

10 years agoauto merge of #12403 : eddyb/rust/generic-dtors-with-bounds, r=nikomatsakis
bors [Thu, 20 Feb 2014 15:06:49 +0000 (07:06 -0800)]
auto merge of #12403 : eddyb/rust/generic-dtors-with-bounds, r=nikomatsakis

Fix generic Drop impls with trait bounds.
Fixes #4252.

10 years agoptr::RawPtr, spell out units used for the `offset` argument.
Felix S. Klock II [Thu, 20 Feb 2014 13:58:46 +0000 (14:58 +0100)]
ptr::RawPtr, spell out units used for the `offset` argument.

spell out units used for the `offset` argument, so that callers do not
try to scale to byte units themselves.

10 years agoauto merge of #12399 : michaelwoerister/rust/simd-fix, r=alexcrichton
bors [Thu, 20 Feb 2014 13:46:48 +0000 (05:46 -0800)]
auto merge of #12399 : michaelwoerister/rust/simd-fix, r=alexcrichton

Fixes  #12333.
I also re-enabled the *function-arg-initialization* test case, so if it passes again, fixes #12021.

10 years agoauto merge of #12398 : alexcrichton/rust/rlibs-and-dylibs-2, r=cmr
bors [Thu, 20 Feb 2014 12:31:49 +0000 (04:31 -0800)]
auto merge of #12398 : alexcrichton/rust/rlibs-and-dylibs-2, r=cmr

The new methodology can be found in the re-worded comment, but the gist of it is
that -C prefer-dynamic doesn't turn off static linkage. The error messages
should also be a little more sane now.

Closes #12133

10 years agorustc: avoid compiler generated `unsafe` blocks leaking.
Huon Wilson [Thu, 20 Feb 2014 12:22:45 +0000 (23:22 +1100)]
rustc: avoid compiler generated `unsafe` blocks leaking.

Previously an `unsafe` block created by the compiler (like those in the
formatting macros) would be "ignored" if surrounded by `unsafe`, that
is, the internal unsafety would be being legitimised by the external
block:

    unsafe { println!("...") } =(expansion)=> unsafe { ... unsafe { ... } }

And the code in the inner block would be using the outer block, making
it considered used (and the inner one considered unused).

This patch forces the compiler to create a new unsafe context for
compiler generated blocks, so that their internal unsafety doesn't
escape to external blocks.

Fixes #12418.

10 years agoauto merge of #12397 : alexcrichton/rust/send-off-the-runtime, r=brson
bors [Thu, 20 Feb 2014 11:11:48 +0000 (03:11 -0800)]
auto merge of #12397 : alexcrichton/rust/send-off-the-runtime, r=brson

The fairness yield mistakenly called `Local::take()` which meant that it would
only work if a local task was available. In theory sending on a channel (or calling try_recv) requires
no runtime because it never blocks, so there's no reason it shouldn't support
such a use case.

Closes #12391

10 years agoauto merge of #12343 : liigo/rust/move-extra-test-to-libtest, r=alexcrichton
bors [Thu, 20 Feb 2014 09:51:56 +0000 (01:51 -0800)]
auto merge of #12343 : liigo/rust/move-extra-test-to-libtest, r=alexcrichton

I don't think `extra` is a good/meaningful name for a library. `libextra` should disappear, and we move all of its sub modules out of it. This PR is just one of that steps: move `extra::test` to `libtest`.

I didn't add `libtest` to doc index, because it's an internal library currently.

**Update:**

All comments addressed. All tests passed. Rebased and squashed.

10 years agoauto merge of #12396 : alexcrichton/rust/windows-env-var, r=huonw
bors [Thu, 20 Feb 2014 08:36:53 +0000 (00:36 -0800)]
auto merge of #12396 : alexcrichton/rust/windows-env-var, r=huonw

On windows, the GetEnvironmentVariable function will return the necessary buffer
size if the buffer provided was too small. This case previously fell through the
checks inside of fill_utf16_buf_and_decode, tripping an assertion in the `slice`
method.

This adds an extra case for when the return value is >= the buffer size, in
which case we assume the return value as the new buffer size and try again.

Closes #12376

10 years agomove extra::test to libtest
Liigo Zhuang [Fri, 14 Feb 2014 01:49:11 +0000 (09:49 +0800)]
move extra::test to libtest

10 years agoauto merge of #12392 : aepsil0n/rust/fix/pub_randbigint, r=huonw
bors [Thu, 20 Feb 2014 07:21:50 +0000 (23:21 -0800)]
auto merge of #12392 : aepsil0n/rust/fix/pub_randbigint, r=huonw

Closes #12383.

Test suite did not capture this and can't as long as it is in the same module hierarchy. This is probably something that should be addressed in the future.

10 years agomove enum_set to libcollections. #8784
HeroesGrave [Thu, 20 Feb 2014 06:10:41 +0000 (19:10 +1300)]
move enum_set to libcollections. #8784

10 years agoauto merge of #12244 : pcwalton/rust/deuniquevectorpatterns, r=pcwalton
bors [Thu, 20 Feb 2014 05:56:51 +0000 (21:56 -0800)]
auto merge of #12244 : pcwalton/rust/deuniquevectorpatterns, r=pcwalton

Preparatory work for removing unique vectors from the language, which is
itself preparatory work for dynamically sized types.

r? @brson