Commit Graph

32171 Commits

Author SHA1 Message Date
Peter Marheine
0b53cc54e1 collections/slice: Reexport mut_ref_slice in addition to ref_slice. 2014-09-04 17:22:58 -06:00
Piotr Czarnecki
27f87c611f std: Fix overflow of HashMap's capacity 2014-09-04 23:22:32 +01:00
Piotr Czarnecki
ae7342a56a std: Refine and document HashMap's code
* branchless `bucket.next()`
* robin_hood is a free function
* fixed the resize policy that was off by one
* documented the growth algorithm
* updated documentation after interface changes
* removed old fixmes
2014-09-04 23:22:32 +01:00
bors
e024017f60 auto merge of #16986 : bjz/rust/bitflags, r=alexcrichton
Closes #16469
2014-09-04 20:21:02 +00:00
Richard Diamond
0dadd3c3ad Auto-derive Clone for syntax::diagnostic::Level. 2014-09-04 13:31:00 -05:00
bors
d3e7922ddd auto merge of #16982 : jbcrail/rust/comment-and-string-corrections, r=alexcrichton
I corrected spelling and capitalization errors in comments and strings.
2014-09-04 18:30:59 +00:00
Brendan Zabarauskas
ef354d850e Use {} for bitflags! definition and invocations
This looks nicer because it reflects Rust's other syntactic structures.
2014-09-05 03:33:00 +10:00
Brendan Zabarauskas
ff72583891 Attach documentation to the bitflags! macro itself
This is in consistent with the style demonstrated in the std::macros module.
2014-09-05 03:31:45 +10:00
Brendan Zabarauskas
ca60b743d7 Test attributes 2014-09-05 03:31:45 +10:00
Brendan Zabarauskas
f3f038c856 Allow trailing commas in bitflags! macro 2014-09-05 03:31:45 +10:00
bors
bef51ba234 auto merge of #16923 : wickerwaka/rust/crate-as-fixup, r=alexcrichton
Changed occurances of:
extern crate foo = "bar";
to:
extern crate "bar" as foo;

Added warning for old deprecated syntax
2014-09-04 16:40:59 +00:00
bors
4a5a9c5631 auto merge of #16885 : wickerwaka/rust/fmt-center, r=alexcrichton
Use '^' to specify center alignment in format strings.

```
fmt!( "[{:^5s}]", "Hi" ) -> "[ Hi  ]"
fmt!( "[{:^5s}]", "H" )  -> "[  H  ]"
fmt!( "[{:^5d}]", 1i )   -> "[  1  ]"
fmt!( "[{:^5d}]", -1i )  -> "[ -1  ]"
fmt!( "[{:^6d}]", 1i )   -> "[  1   ]"
fmt!( "[{:^6d}]", -1i )  -> "[  -1  ]"
```

If the padding is odd then the padding on the right will be one
character longer than the padding on the left.
2014-09-04 14:50:59 +00:00
wickerwaka
2bc4a5e92a Center alignment for fmt
Use '^' to specify center alignment in format strings.

fmt!( "[{:^5s}]", "Hi" ) -> "[ Hi  ]"
fmt!( "[{:^5s}]", "H" )  -> "[  H  ]"
fmt!( "[{:^5d}]", 1i )   -> "[  1  ]"
fmt!( "[{:^5d}]", -1i )  -> "[ -1  ]"
fmt!( "[{:^6d}]", 1i )   -> "[  1   ]"
fmt!( "[{:^6d}]", -1i )  -> "[  -1  ]"

If the padding is odd then the padding on the right will be one
character longer than the padding on the left.

Tuples squashed
2014-09-04 07:38:53 -07:00
bors
8d5e64f3bc auto merge of #16981 : kmcallister/rust/ctypes-warning, r=alexcrichton 2014-09-04 13:01:00 +00:00
bors
6d8b5c9f7d auto merge of #16976 : treeman/rust/issue-16943, r=kballard
Closes #16943.
2014-09-04 11:11:08 +00:00
bors
85e2e5a900 auto merge of #16964 : nodakai/rust/libnative-superfluous-retry, r=alexcrichton
Those syscalls listed below don't return `EINTR`, so wrapping them with `retry()` is superfluous.

But I admit the current code is better from the viewpoint of difensive programming, given that the overhead of `retry()` is really cheap...

http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstat.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdir.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/unlink.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/rmdir.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstatat.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/utime.html
2014-09-04 09:21:04 +00:00
Jonas Hietala
38bf999f4a Print file permissions with 4 digits. 2014-09-04 09:01:51 +02:00
bors
5924937a5a auto merge of #16883 : jakub-/rust/issue-16648, r=pcwalton
They were only correct in the simplest case. Some of the optimisations
are certainly possible but should be introduced carefully and only
when the whole pattern codegen infrastructure is in a better shape.

Fixes #16648.
2014-09-04 06:41:04 +00:00
bors
1f49e02d1d auto merge of #16909 : carols10cents/rust/docs-links, r=alexcrichton
This has the primary advantage of not interfering with browser default behavior for links like being able to cmd/ctrl+click on a result to open the result in a new tab but leave the current page as-is (previous behavior both opened a new tab and changed the current tab's location to the result's).

I've done my best to keep the rest of the behavior and the appearance the same-- the whole row still highlights, still has a hand cursor, still moves to the result page with a normal click, arrows+enter still work. If the result is on the current page, the search is simply hidden.

The biggest difference in behavior is that people using tab to navigate through the links will have to hit tab twice for each row, since each cell has its own `a` tag.. I could fix this by switching to `div`s and `span`s instead of a table, but that's potentially more CSS finicky?

The biggest difference in appearance is probably that all the text in the search results is Fira Sans now, instead of just the method name with the rest of the text in Source Serif Pro. I can put this appearance back, but it looks like all links anywhere on the page are Fira Sans. Only the name was in an `a` tag before, but the whole row was ACTING like a link, so I think this is actually more consistent.

[I've pushed these changes to a gh-pages repo](https://carols10cents.github.io/rustdoc-playground/std/index.html?search=t) if you'd like to take a look at the effects; note that I also have my changes for PR #16735 there too so the search results will be sorted differently than on master.
2014-09-04 04:51:05 +00:00
Joseph Crail
b7bfe04b2d Fix spelling errors and capitalization. 2014-09-03 23:10:38 -04:00
bors
c95aa9950f auto merge of #16972 : ruud-v-a/rust/timespec-arithmetic, r=alexcrichton
Changing from `Timespec` to `Duration` introduced a bug for negative durations. This fixes that.
2014-09-04 03:01:03 +00:00
Keegan McAllister
f422de1e85 Use a visitor to look for non-FFI-safe types
Fixes #16250.
2014-09-03 19:28:37 -07:00
Keegan McAllister
7f676b8699 Fix some non-FFI-safe types in externs 2014-09-03 19:01:15 -07:00
bors
d59d97cbec auto merge of #16961 : huonw/rust/bitv-twiddle, r=alexcrichton
bitv: add larger tests, better benchmarks & remove dead code.

There were no tests for iteration etc. with more than 5 elements,
i.e. not even going beyond a single word. This situation is rectified.

Also, the only benchmarks for `set` were with a constant bit value,
which was not indicative of every situation, due to inlining & branch
removal. This adds a benchmark at the other end of the spectrum: random
input.
2014-09-04 01:11:04 +00:00
bors
a4d257b150 auto merge of #16954 : nick29581/rust/dst-bug-deref, r=nikomatsakis
Closes #16930 

r?
2014-09-03 23:21:05 +00:00
Jonas Hietala
fca8a1d151 Print file permissions in octal form.
Closes #16943.
2014-09-03 23:59:22 +02:00
bors
3b5d92c923 auto merge of #16953 : nick29581/rust/dst-bug-7, r=pcwalton
Closes #16947 

r?
2014-09-03 21:31:07 +00:00
bors
821afc4ce8 auto merge of #16932 : crabtw/rust/mips, r=alexcrichton
Add missing liblibc constants
2014-09-03 19:41:12 +00:00
Ruud van Asseldonk
0b4912b9af libtime: Fix adding negative duration to Timespec. 2014-09-03 21:28:54 +02:00
bors
9b81a4eef8 auto merge of #16811 : nick29581/rust/dst-bug-2, r=nikomatsakis
closes #16800 
r? @nikomatsakis - I'm not 100% sure this is the right approach, it is kind of ad-hoc. The trouble is we don't have any intrinsic notion of which types are sized and which are not, we only have the Sized bound, so I have nothing to validate the Sized bound against.
2014-09-03 17:51:05 +00:00
bors
6ac4a30810 auto merge of #16634 : apoelstra/rust/to-option-fix, r=aturon
As outlined in

  https://aturon.github.io/style/naming/conversions.html

`to_` functions names should only be used for expensive operations.
Thus `to_option` is better named `as_option`. Also, putting type
names into method names is considered bad style; what the user is
really trying to get is a reference. This `as_ref` is even better.

Also, we are missing a mutable version of this method.

Finally, there is a bug in the signature of `to_option` which has
been around since lifetime elision: originally the returned reference
had 'static lifetime, but since the elision changes this become
the lifetime of the raw pointer (which does not make sense, since
the pointer lifetime and referent lifetime are unrelated). We fix
the bug to return a reference with a fresh lifetime which will be
inferred from the calling context.

[breaking-change]
2014-09-03 16:01:12 +00:00
bors
8a8986776d auto merge of #16956 : nick29581/rust/unsized-test-1, r=alexcrichton
I landed this disabled, but it now passes since @pcwalton implemented RFC 11

r?
2014-09-03 14:11:09 +00:00
NODA, Kai
d90921a9d8 libnative/io/file_unix: remove superfluous retry().
These syscalls don't return EINTR:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstat.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdir.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/unlink.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/rmdir.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstatat.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/utime.html
2014-09-03 19:31:46 +08:00
Huon Wilson
5c819186ed bitv: add larger tests, better benchmarks & remove dead code.
There were no tests for iteration etc. with more than 5 elements,
i.e. not even going beyond a single word. This situation is rectified.

Also, the only benchmarks for `set` were with a constant bit value,
which was not indicative of every situation, due to inlining & branch
removal. This adds a benchmark at the other end of the spectrum: random
input.
2014-09-03 20:07:08 +10:00
bors
3ce5a026b0 auto merge of #16940 : treeman/rust/fail-non-utf8, r=pnkfelix
Closes #16877.
2014-09-03 09:21:02 +00:00
bors
b7d456dfea auto merge of #16934 : nick29581/rust/dst-bug-6, r=pcwalton
Closes #16911 

r?
2014-09-03 06:26:02 +00:00
Nick Cameron
69a9d23d58 Enable a test for correct treatment of Sized? 2014-09-03 16:50:18 +12:00
Nick Cameron
ab3999f615 Handle custom deref returning fat pointers
Closes #16930
2014-09-03 15:31:36 +12:00
Nick Cameron
7d72bdb226 Fix ICE when casting &[T] to *const [T]
Closes #16947
2014-09-03 15:22:32 +12:00
bors
f7ec95efbb auto merge of #16917 : nick29581/rust/cross-trait, r=pcwalton
Closes #15349

r? @pcwalton (or anyone else)
2014-09-03 02:40:59 +00:00
bors
2e38581792 auto merge of #16892 : andrew-d/rust/andrew-fix-test-reexports, r=sfackler
Fixes #16597

I'm not 100% sure this is the correct way to handle this - but I wasn't able to find a better way without doing way more refactoring of the code that I was comfortable with.  Comments and criticism are appreciated 😄
2014-09-03 00:51:00 +00:00
bors
4e5d5ba1ed auto merge of #16850 : vks/rust/hash-num, r=alexcrichton
Updates #15294.
2014-09-02 23:01:06 +00:00
bors
0e7e107ad6 auto merge of #16944 : alexcrichton/rust/ignore-gdb-pretty, r=brson
These tests are blocking a linux nightly and a new snapshot, so ignore them for
now. Their tracking issue is #16919.
2014-09-02 21:11:05 +00:00
Nick Cameron
7f72884f13 Remove cross-borrowing for traits.
Closes #15349

[breaking-change]

Trait objects are no longer implicitly coerced from Box<T> to &T. You must make an explicit coercion using `&*`.
2014-09-03 08:32:35 +12:00
Nick Cameron
e9bd650cad Schedule cleanup for &* on fat owned pointers
For example `let _x: &Trait = &*(box Foo as Box<Trait>);`. There was a bug where no cleanup would be scheduled by the deref.

No test because cleanup-auto-borrow-obj.rs is a test for this once we remove trait cross-borrowing (done on another branch).
2014-09-03 08:29:33 +12:00
bors
f4aafd6713 auto merge of #16916 : alexcrichton/rust/tcp-accept-stress-again-oh-my, r=brson
The tcp-accept-stress, despite the previous modifications, is still deadlocking
on the osx buildbots. When building/testing/running repeatedly locally, it was
discovered that the test would often fail with TcpStream::connect returning the
error `address not available`.

This test opens up quite a large number of sockets, and it looks like by default
osx isn't the speediest at recycling those sockets for further use.

The test has been modified (and verified) to not deadlock in this error case,
and the test is not just officially ignored on OSX (with no FIXME). I believe
that we'll get good coverage of the relevant code on the linux builders, so this
isn't so much of a loss.

At the same time I turned down the stress parameters to hopefully lighten the
socket load on other platforms.
2014-09-02 19:16:07 +00:00
Alex Crichton
b090905b17 test: Ignore failing gdb pretty tests
These tests are blocking a linux nightly and a new snapshot, so ignore them for
now. Their tracking issue is #16919.
2014-09-02 08:34:00 -07:00
Alex Crichton
2ec7bb8756 native: Remove a bogus assert in net::read
This assert was likely inherited from some point, but it's not quite valid as a
no-timeout read may enter this loop, but data could be stolen by any other read
after the socket is deemed readable.

I saw this fail in a recent bors run where the assertion was tripped.
2014-09-02 08:21:51 -07:00
Jonas Hietala
968b1280e3 Prevent failure when using fail! with invalid utf8.
Closes #16877.
2014-09-02 15:59:28 +02:00
Piotr Czarnecki
fc636ae8f4 std: Split hashmap.rs into modules 2014-09-02 14:59:07 +01:00