Commit Graph

41113 Commits

Author SHA1 Message Date
Oak
b4c49ba212 mod.rs docs fix - for floats
Same with integers — docs meant that Option is returned though the function returns Result.
2015-04-10 23:20:40 +04:00
Oak
c7697ee86d mod.rs docs fix
Docs meant that Option is returned though the function returns Result.
2015-04-10 23:16:47 +04:00
Igor Strebezhev
9e68d236a7 Fix mistake in documentation 2015-04-10 20:32:38 +03:00
Felix S. Klock II
847a897fb3 fix some comments. 2015-04-10 19:13:34 +02:00
Brian Anderson
2cf7bc3e3d Bump prerelease version 2015-04-10 10:12:27 -07:00
Felix S. Klock II
47016f9ce5 Test case for 64-bit corner cases where truncation occurred before prior commit. 2015-04-10 19:11:03 +02:00
Felix S. Klock II
781fc902a4 Incorporate repr-attr into deriving(PartialOrd) to avoid truncation errors.
remove out of date fixme.
2015-04-10 19:11:00 +02:00
Brian Anderson
a0f832da52 Remove rustup.sh.
Now lives at https://github.com/rust-lang/rustup
2015-04-10 10:01:04 -07:00
Steve Klabnik
288b1c9aba Add examples for Convert 2015-04-10 12:44:20 -04:00
Andrew Paseltiner
7bf1da1283 s/Panicks/Panics/ 2015-04-10 12:42:36 -04:00
Simon Sapin
c2fa1f769d Doc: remove a "safety note" made obsolete by dropck for TypedArena
https://botbot.me/mozilla/rust-internals/2015-04-10/?msg=36316959&page=6
2015-04-10 18:30:52 +02:00
Steve Klabnik
74b5c75d74 copyediting: while loops 2015-04-10 12:26:58 -04:00
Steve Klabnik
8d35fc6303 copyediting: for loops 2015-04-10 12:26:58 -04:00
Steve Klabnik
b577beeb3a copyedits: patterns
This also puts slice patterns in nightly docs, where they belong.
2015-04-10 12:26:58 -04:00
Steve Klabnik
9aa4b643c4 copyediting: match 2015-04-10 12:26:58 -04:00
Steve Klabnik
64f4021c40 copy-editing: if
I decided to break if-let out, as it's too complex for this part, but moving
if that late seems silly too.
2015-04-10 12:26:58 -04:00
Steve Klabnik
04b4bb9fb0 remove backticks from titles
This doesn't actually display correctly
2015-04-10 12:26:58 -04:00
Steve Klabnik
f13b276d84 some TOC reorganization
As I go through this, I'm finding some ways that I want to tweak the order.
2015-04-10 12:26:58 -04:00
bors
c897ac04e2 Auto merge of #24177 - alexcrichton:rustdoc, r=aturon
This commit series starts out with more official test harness support for rustdoc tests, and then each commit afterwards adds a test (where appropriate). Each commit should also test and finish independently of all others (they're all pretty separable).

I've uploaded a [copy of the documentation](http://people.mozilla.org/~acrichton/doc/std/) generated after all these commits were applied, and a double check on issues being closed would be greatly appreciated! I'll also browse the docs a bit and make sure nothing regressed too horribly.
2015-04-10 16:18:44 +00:00
Dominick Allen
cdce32f8f3 Changed the wording of the documentation for the insert method for Vec to be less confusing. Since 0 is the smallest number possible for usize, it doesn't make sense to mention it if it's already included, and it should be more clear that the length of the vector is a valid index with the new wording. 2015-04-10 11:33:21 -04:00
Steve Klabnik
e66569eae8 Fix pow docs to not use Int
This is very confusing now that these are inherent methods.
2015-04-10 10:58:07 -04:00
Felix S. Klock II
afb7acff57 Re-add a fixme after some investigation into what's going on. 2015-04-10 16:32:31 +02:00
Felix S. Klock II
c44d40e77f Test case for new derive(PartialOrd) expansion. 2015-04-10 16:32:27 +02:00
Felix S. Klock II
6118795ee1 Change derive expansions to use discriminant_value intrinsic.
Fix #15523.
2015-04-10 16:20:18 +02:00
Felix S. Klock II
ea2739176b Rebase discriminant_value test. Add case for a specialized repr. 2015-04-10 16:14:00 +02:00
Felix S. Klock II
fb6d780dbe Regression test for Issue 21486.
Fix #21486
2015-04-10 15:35:19 +02:00
Felix S. Klock II
6c2a9910c7 Regression test for Issue 21400.
Fix #21400.
2015-04-10 15:34:34 +02:00
bors
9539627ac7 Auto merge of #24034 - alexcrichton:cloexec, r=aturon
The commit messages have more details as to what's going on, but this is a breaking change for any libraries which expect file descriptors to be inherited by default.

Closes #12148
2015-04-10 12:42:46 +00:00
Ben Ashford
faef52a847 Fix for #23150 2015-04-10 13:19:14 +01:00
James Miller
800c5f8038 Add test for discriminant_value results 2015-04-10 12:23:37 +02:00
James Miller
41dd35503a Implement discriminant_value intrinsic
Implements an intrinsic for extracting the value of the discriminant
enum variant values. For non-enum types, this returns zero, otherwise it
returns the value we use for discriminant comparisons. This means that
enum types that do not have a discriminant will also work in this
arrangement.

This is (at least part of) the work on Issue #24263
2015-04-10 12:23:08 +02:00
Niko Matsakis
e313b3334b Improve error message where a closure escapes fn while trying to borrow
from the current fn. Employ the new `span_suggestion` to show how you
can use `move`.
2015-04-10 06:11:28 -04:00
Niko Matsakis
906a9728ff Add a new span_suggestion infrastructure. This lets you edit a snippet
of text (perhaps obtained by span_snippet) and then splice that edited
form back into the original file in the form of a suggestion.
2015-04-10 06:11:28 -04:00
Niko Matsakis
5156b3a6cd Modify the codemap code to use more slices and to information about
columns within a line, not just the line numbers. Also try to clarify
and use the term `line_index` when 0-based.
2015-04-10 06:11:28 -04:00
Niko Matsakis
16574e3fbd Replace the use of the rather randomly named boolean custom to mean
"highlight end" and instead add a variant to `RenderSpan`
2015-04-10 06:11:28 -04:00
Alex Crichton
eadc3bcd67 std: Unconditionally close all file descriptors
The logic for only closing file descriptors >= 3 was inherited from quite some
time ago and ends up meaning that some internal APIs are less consistent than
they should be. By unconditionally closing everything entering a `FileDesc` we
ensure that we're consistent in our behavior as well as robustly handling the
stdio case.
2015-04-10 01:03:38 -07:00
Alex Crichton
445faca844 Test fixes and review feedback 2015-04-10 00:58:10 -07:00
bors
e4f9ddb878 Auto merge of #24180 - huonw:optimise-max-etc, r=alexcrichton
The main change in this patch is removing the use of `Option` inside the
inner loops of those functions to avoid comparisons where one branch
will only trigger on the first pass through the loop.

The included benchmarks go from:

    test bench_max    ... bench:       372 ns/iter (+/- 118)
    test bench_max_by ... bench:       428 ns/iter (+/- 33)
    test bench_max_by2 ... bench:      7128 ns/iter (+/- 326)

to:

    test bench_max    ... bench:       317 ns/iter (+/- 64)
    test bench_max_by ... bench:       356 ns/iter (+/- 270)
    test bench_max_by2 ... bench:      1387 ns/iter (+/- 183)

Problem noticed in http://www.reddit.com/r/rust/comments/31syce/using_iterators_to_find_the_index_of_the_min_or/
2015-04-10 07:54:18 +00:00
Luke Gallagher
2a88b79223 Add tests for E-needstest issues
Closes #20772
Closes #20939
Closes #21950
Closes #22034
2015-04-10 16:12:54 +10:00
Huon Wilson
c2258d6d04 Optimise Iterator::{max, max_by, min, min_by}.
The main change in this patch is removing the use of `Option` inside the
inner loops of those functions to avoid comparisons where one branch
will only trigger on the first pass through the loop.

The included benchmarks go from:

    test bench_max    ... bench:       372 ns/iter (+/- 118)
    test bench_max_by ... bench:       428 ns/iter (+/- 33)
    test bench_max_by2 ... bench:      7128 ns/iter (+/- 326)

to:

    test bench_max    ... bench:       317 ns/iter (+/- 64)
    test bench_max_by ... bench:       356 ns/iter (+/- 270)
    test bench_max_by2 ... bench:      1387 ns/iter (+/- 183)

Problem noticed in http://www.reddit.com/r/rust/comments/31syce/using_iterators_to_find_the_index_of_the_min_or/
2015-04-10 14:42:17 +10:00
Richo Healey
64da4e171d fmt: Assume that we'll only ever see 32 or 64 bit pointers 2015-04-09 18:06:01 -07:00
Richo Healey
d8bb08037f test: Unignore test for fixed issue #20676 2015-04-09 18:03:48 -07:00
Richo Healey
333eb85d4b fmt: {:p#} formats pointers padded to native width 2015-04-09 18:03:47 -07:00
Aaron Turon
76d468ae26 Ensure that .join().unwrap() works
Makes `Any + Send` implement `Debug`.

Fixes #21291
2015-04-09 17:33:17 -07:00
Alex Crichton
33a2191d0b std: Clean up process spawn impl on unix
* De-indent quite a bit by removing usage of FnOnce closures
* Clearly separate code for the parent/child after the fork
* Use `fs2::{File, OpenOptions}` instead of calling `open` manually
* Use RAII to close I/O objects wherever possible
* Remove loop for closing all file descriptors, all our own ones are now
  `CLOEXEC` by default so they cannot be inherited
2015-04-09 17:09:37 -07:00
Alex Crichton
d6c72306c8 std: Set CLOEXEC for all fds opened on unix
This commit starts to set the CLOEXEC flag for all files and sockets opened by
the standard library by default on all unix platforms. There are a few points of
note in this commit:

* The implementation is not 100% satisfactory in the face of threads. File
  descriptors only have the `F_CLOEXEC` flag set *after* they are opened,
  allowing for a fork/exec to happen in the middle and leak the descriptor.
  Some platforms do support atomically opening a descriptor while setting the
  `CLOEXEC` flag, and it is left as a future extension to bind these apis as it
  is unclear how to do so nicely at this time.

* The implementation does not offer a method of opting into the old behavior of
  not setting `CLOEXEC`. This will possibly be added in the future through
  extensions on `OpenOptions`, for example.

* This change does not yet audit any Windows APIs to see if the handles are
  inherited by default by accident.

This is a breaking change for users who call `fork` or `exec` outside of the
standard library itself and expect file descriptors to be inherted. All file
descriptors created by the standard library will no longer be inherited.

[breaking-change]
2015-04-09 17:07:02 -07:00
Steve Klabnik
7bb0cd76f3 Write the 'primitive types' section of TRPL
A brief introduction to each type, with pointers to the primitive pages
for more info.
2015-04-09 20:05:10 -04:00
bors
6b95d8bed8 Auto merge of #24205 - brson:debug, r=alexcrichton
This makes the default configuration fully optimized, with no debugging options, no llvm asserts, renames --enable-debug to --enable-debug-assertions, and adds --enable-debug as a blanket option that toggles various things, per #17665. It does not add a `--enable-release` flag since that would be a no-op.

cc @nrc

Fixes https://github.com/rust-lang/rust/issues/22390
Fixes https://github.com/rust-lang/rust/issues/17081
Partially addresses https://github.com/rust-lang/rust/issues/17665
2015-04-09 23:52:02 +00:00
Steve Klabnik
bf88539cc9 TRPL: new introduction 2015-04-09 19:39:06 -04:00
Alex Crichton
2705051e20 std: Make FromRawFd::from_raw_fd an unsafe method
As pointed out in [RFC issue 1043][rfc] it is quite useful to have the standard
I/O types to provide the contract that they are the sole owner of the underlying
object they represent. This guarantee enables writing safe interfaces like the
`MemoryMap` API sketched out in that issue.

[rfc]: https://github.com/rust-lang/rfcs/issues/1043

As constructing objects from these raw handles may end up violating these
ownership gurantees, the functions for construction are now marked unsafe.

[breaking-change]
Closes rust-lang/rfcs#1043
2015-04-09 16:12:33 -07:00