Commit Graph

35370 Commits

Author SHA1 Message Date
Jorge Aparicio
f2af07e6d5 libcollections: remove unnecessary as_slice() calls 2014-12-06 19:05:58 -05:00
jbranchaud
2171c95553 Add missing semicolon to hello world program in intro. 2014-12-06 17:36:32 -06:00
Steven Fackler
3246d4f369 Change from message to expected 2014-12-06 15:16:38 -08:00
Steven Fackler
616af6eb83 Allow message specification for should_fail
The test harness will make sure that the panic message contains the
specified string. This is useful to help make `#[should_fail]` tests a
bit less brittle by decreasing the chance that the test isn't
"accidentally" passing due to a panic occurring earlier than expected.
The behavior is in some ways similar to JUnit's `expected` feature:
`@Test(expected=NullPointerException.class)`.

Without the message assertion, this test would pass even though it's not
actually reaching the intended part of the code:
```rust
 #[test]
 #[should_fail(message = "out of bounds")]
fn test_oob_array_access() {
    let idx: uint = from_str("13o").unwrap(); // oops, this will panic
    [1i32, 2, 3][idx];
}
```
2014-12-06 15:13:48 -08:00
bors
a31ad6bfcd auto merge of #19579 : alexcrichton/rust/snapshots, r=nikomatsakis 2014-12-06 23:12:17 +00:00
NODA, Kai
87424c6a32 Fix false positive alerts from a run-pass test on Command.
Reported as a part of rust-lang/rust#19120

The logic of rust-lang/rust@74fb798a20 was
flawed because when a CI tool run the test parallely with other tasks,
they all belong to a single session family and the test may pick up
irrelevant zombie processes before they are reaped by the CI tool
depending on timing.

Also, panic! inside a loop over all children makes the logic simpler.

By not destructing the return values of Command::spawn() until
find_zombies() finishes, I believe we can conduct a slightly stricter
test.

Signed-off-by: NODA, Kai <nodakai@gmail.com>
2014-12-07 07:07:26 +08:00
Vadim Chugunov
de8f48b10a - Support gcc-less installation on Windows. To do so in unattended mode run:<intaller>.exe /TYPE=compact /SILENT.
- Do not require admin privileges to install.
2014-12-06 12:48:32 -08:00
bors
de83d7dd19 auto merge of #19431 : erickt/rust/buf-writer-error, r=alexcrichton
Previously, `BufWriter::write` would just return an `std::io::OtherIoError` if someone attempted to write past the end of the wrapped buffer. This pull request changes the error to support partial writes and return a `std::io::ShortWrite`, or an `io::io::EndOfFile` if it's been fully exhausted.

 I've also optimized away a bounds check inside `BufWriter::write`, which should help shave off some nanoseconds in an inner loops.
2014-12-06 20:12:13 +00:00
bors
358db12a89 auto merge of #19590 : sfackler/rust/fix-android, r=sfackler
Seems to be blocking forever
2014-12-06 17:42:16 +00:00
Steven Fackler
2e2aca9eb8 Ignore wait-forked-but-failed-child
Test will be fixed in #19588
2014-12-06 08:13:57 -08:00
Corey Richardson
6e18b5af93 rustc: check supertraits for object safety
Closes #18959

Technically, this causes code that once compiled to no longer compile, but
that code probably never ran.

[breaking-change]
2014-12-05 22:27:21 -08:00
jbranchaud
9cb26e2db0 Add a doctest for BTreeMap's iter method. 2014-12-05 23:50:13 -06:00
Steven Fackler
8a288d3aff Ignore issue #16671 test on android
Seems to be blocking forever
2014-12-05 20:22:35 -08:00
Huon Wilson
b800ce1608 Implement lifetime elision for Foo(...) -> ... type sugar.
This means that `Fn(&A) -> (&B, &C)` is equivalent to `for<'a> Fn(&'a A)
-> (&'a B, &'a C)` similar to the lifetime elision of lower-case `fn` in
types and declarations.

Closes #18992.
2014-12-05 19:04:13 -08:00
Huon Wilson
e8524198e3 Feature-gate explicit unboxed closure method calls & manual impls,
detect UFCS drop and allow UFCS methods to have explicit type parameters.

Work towards #18875.

Since code could previously call the methods & implement the traits
manually, this is a

[breaking-change]

Closes #19586. Closes #19375.
2014-12-05 17:54:45 -08:00
mdinger
796e4b8a88 Typo 2014-12-05 20:14:28 -05:00
Matt Windsor
363ed2f7ad Correct minor typos on the ownership guide.
liftimes -> lifetimes
2014-12-06 00:30:03 +00:00
Chase Southwood
da50db0ca2 Implement BitOps for TreeSet 2014-12-05 18:03:45 -06:00
Luqman Aden
8ebc1c9fd8 librustc: Fix debuginfo for captured variables in non-FnOnce unboxed closures. 2014-12-05 18:56:40 -05:00
Aidan Cully
c394a6c238 prefer "FIXME" to "TODO". 2014-12-05 18:39:58 -05:00
Alex Crichton
9b443289cf Register new snapshots 2014-12-05 15:39:26 -08:00
Corey Farwell
4ef16741e3 Utilize fewer reexports
In regards to:

https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729

This commit:

* Changes the #deriving code so that it generates code that utilizes fewer
  reexports (in particur Option::* and Result::*), which is necessary to
  remove those reexports in the future
* Changes other areas of the codebase so that fewer reexports are utilized
2014-12-05 18:13:04 -05:00
jbranchaud
451cc7e5c0 Add doctests for union, diff, sym_diff, and intersection.
Add a rustdoc test for union to exhibit how it is used.

There is already a test for union in the test namespace, but this commit
adds a doctest that will appear in the rustdocs.

Add a doctest for the difference function.

Add a doctest for the symmetric_difference function.

Add a doctest for the intersection function.

Update the union et al. doctests based on @Gankro's comments.

Make the union et al. doctests a bit more readable.
2014-12-05 17:00:24 -06:00
Aidan Cully
7bf7bd6a75 work around portability issue on FreeBSD, in which the key returned from
pthread_key_create can be 0.
2014-12-05 17:20:44 -05:00
Nafis
e1b77b0709 fix 404 2014-12-06 08:17:49 +10:00
jbranchaud
d6b6df0dfa Add doctests for keys() and values() of the BTreeMap collection.
Update keys() and values() for BTreeMap based on @Gankro's comments.

Assign keys and values to variables before doing assertion.
2014-12-05 15:40:46 -06:00
bors
6f4c11be3b auto merge of #19508 : cmr/rust/rollup-2014_12_03, r=cmr 2014-12-05 20:23:10 +00:00
Erick Tryzelaar
e20ea0b67d collections: dramatically speed up Vec::reserve with magic
Somehow llvm is able to optimize this version of Vec::reserve
into dramatically faster than the old version. In micro-benchmarks
this was 2-10 times faster. It also shaved 14 minutes off of
rust's compile times.

Closes #19281.
2014-12-05 11:29:41 -08:00
Corey Richardson
33f34bdb4e Merge remote-tracking branch 'csouth3/trieset-bitops' into rollup-2014_12_03
Conflicts:
	src/libcollections/trie/set.rs
2014-12-05 11:19:50 -08:00
Luqman Aden
2dccb5a77f librustc: Don't reuse same alloca for match on struct/tuple field which we reassign to in match body. 2014-12-05 14:16:20 -05:00
Andrew Paseltiner
600faba5bc libcore: Fix Sized bounds on overloaded function traits.
- Remove the `for Sized?` bound on `core::ops::FnOnce`, as it takes
  `self` by value and can never be implemented by an unsized type.
- Add a missing `Sized?` bound to the blanket `core::ops::FnMut` impl,
  as both `Fn` and `FnMut` are `for Sized?`.
2014-12-05 14:04:57 -05:00
Chase Southwood
309ab34b7a Implement BitOps for TrieSet 2014-12-05 12:58:45 -06:00
Corey Richardson
090110779f rollup merge of #19553: sfackler/issue-19543
Closes #19543
2014-12-05 10:08:33 -08:00
Corey Richardson
a90e0d70cc rollup merge of #19534: scialex/liballoc-cfg
Adds the ability to use a custom allocator heap by passing either --cfg
external_crate and --extern external=<allocator_crate_name> or --cfg
external_funcs and defining the allocator functions prefixed by 'rust_'
somewhere.

This is useful for many applications including OS/embedded development,
and allocator development and testing.
2014-12-05 10:08:28 -08:00
Corey Richardson
b8eaf7bc8a rollup merge of #19530: aochagavia/remove-test
Fixes https://github.com/rust-lang/rust/issues/19510
2014-12-05 10:08:26 -08:00
Corey Richardson
d602c058ae rollup merge of #19528: aliblong/add_vecmap_capacity
Part of #18424

Adds `capacity()` function to VecMap, as per the collections reform.

(Salvaged from #19516, #19523, while we await an RFC regarding `reserve`/`reserve_index` for `VecMap`)
2014-12-05 10:08:24 -08:00
Corey Richardson
39646d2ff6 rollup merge of #19526: steveklabnik/gh19402
Fixes #19402.
2014-12-05 10:07:49 -08:00
Corey Richardson
0fb040f4bd rollup merge of #19525: steveklabnik/guide_edits
Fixes #19335. (or at least, the actionable parts)
2014-12-05 10:07:48 -08:00
Corey Richardson
c7d545e2f7 rollup merge of #19520: csouth3/derefmut-unsized
Right now, `DerefMut` is not `for Sized?`, so you can't impl `DerefMut<T> for Foo` where `Foo` is unsized.  However, there is no reason that it can't be `for Sized?`, so this pull request fixes the issue.

Closes #19493.
2014-12-05 10:07:47 -08:00
Corey Richardson
d58aecb6b3 rollup merge of #19518: csouth3/trieset-bitops
Implement the `BitOr`, `BitAnd`, `BitXor`, and `Sub` traits from `std::ops` for TrieSet.  The behavior of these operator overloads is consistent with [RFC 235](https://github.com/rust-lang/rfcs/blob/master/text/0235-collections-conventions.md#combinations).
2014-12-05 10:07:45 -08:00
Corey Richardson
4e492cbaf8 rollup merge of #19515: lifthrasiir/rustdoc-wrong-dedup
Fixes #17332.
2014-12-05 10:07:44 -08:00
Corey Richardson
f3a85cf822 rollup merge of #19513: lifthrasiir/rustdoc-fat-redirect
We heavily rely on queries and fragments in the URL structure, so it is desired to preserve them even in the redirects. The generated redirect pages try to preserve them with scripts, which take precedence over the original `Refresh` metadata. Non-scripting browsers would continue to work (with no queries and fragments).

(This in turn solves a number of semi-broken links to the source code, which are actually linked to redirect pages.)
2014-12-05 10:07:42 -08:00
Corey Richardson
33e96be299 rollup merge of #19512: cybergeek94/master
Added the example from [this Reddit thread][1], reworked to be more robust with correct logic (first link skipped the 0th and 1st Fibonacci numbers, second forgot about the last two valid values before overflow). Will yield all Fibonacci numbers sequentially in the range `[0, <u32 as Int>::max_value())`.

If the example is too complicated I can change it to a more naive version, perhaps using signed integers to check for overflow instead of `Option` and `.checked_add()`.

Also reworded the doc comments to clarify the usage and behavior of `Unfold`, as the thread suggested that it wasn't really clear how `Unfold` worked and when one should use it.

This change is in the `core` crate but I based the example on `std` since that's where most readers will find the example. I included a note about `core` for clarity. Edit: removed.

Tested with `rustdoc src/libcore/lib.rs`. Rebased against latest master as of the creation of this PR.

[1]: http://www.reddit.com/r/rust/comments/2ny8r1/a_question_about_loops/cmighu4?context=10000
2014-12-05 10:07:41 -08:00
Corey Richardson
a8c1812f36 rollup merge of #19503: lifthrasiir/xenophobic-rustdoc
This series of commits deals with broken links to the source code. It also refactors some repetitive codes from Rustdoc. The most important commit, 1cb1f00d40, describes the rationale; this will fix a half of #16289. Other commits are reasonably independent to each other and can be made into indiviudal PRs at the request.

### Notes on the broken source links

As of bda97e8557 (I've used this to check the PR works as intended), there are 281 (!) such broken links. They can be further classified as follows:

* 178 links to incorrect item types. This is the first half of #16289, and this PR fixes all of them.
* 89 links to redirect pages. They are not technically "broken" but still doesn't give a source code. I have a fix for this in mind, which would make a redirect page slightly *fat*.
* 14 links to incorrect `DefId` in the `gotosrc` parameter. This is #15309, and affects many `liballoc` reexports in `libstd` but *nothing else* (curiously). I'm yet to track this down; might be a metadata bug (not sure).
* 0 links to the crate reexported as a different name. This is the second half of #16289, and seems not hard to fix but I'm running out of time.

Prevalence of this kind of bugs calls for a full link verifier integrated into the testing process. :S
2014-12-05 10:07:38 -08:00
Corey Richardson
fdb395626b rollup merge of #19494: P1start/better-expected
As an example of what this changes, the following code:

```rust
let x: [int ..4];
```

Currently spits out ‘expected `]`, found `..`’. However, a comma would also be valid there, as would a number of other tokens. This change adjusts the parser to produce more accurate errors, so that that example now produces ‘expected one of `(`, `+`, `,`, `::`, or `]`, found `..`’.

(Thanks to cramer on IRC for pointing out this problem with diagnostics.)
2014-12-05 10:07:36 -08:00
Corey Richardson
13befdff91 rollup merge of #19492: steveklabnik/remove_outdated_comment
https://github.com/rust-lang/rust/pull/19472#issuecomment-65370278

/cc @alexcrichton
2014-12-05 10:07:34 -08:00
Corey Richardson
3489fc4134 rollup merge of #19491: oli-obk/libtest_tojson_dependency
deriving encodable + using json::PrettyEncoder removes the only ToJson trait implementation in the rust repository outside of libserialize

@pcwalton does this agree with your FIXME comment?
2014-12-05 10:07:31 -08:00
Corey Richardson
a6358f571e rollup merge of #19483: cgaebel/copy_memory-comment 2014-12-05 10:07:23 -08:00
Corey Richardson
1b2b24a6af rollup merge of #19480: cmr/es6-escape
First half of bootstrapping https://github.com/rust-lang/rfcs/pull/446
2014-12-05 10:07:18 -08:00
Corey Richardson
7464a29a37 rollup merge of #19474: luqmana/fl
Fixes #19339.
2014-12-05 10:07:11 -08:00