]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agorollup merge of #24873: alexcrichton/fix-windows-stdio
Alex Crichton [Wed, 29 Apr 2015 22:48:38 +0000 (15:48 -0700)]
rollup merge of #24873: alexcrichton/fix-windows-stdio

Conflicts:
src/libstd/sys/windows/fs2.rs

9 years agorollup merge of #24962: tamird/unignore-android-tests
Alex Crichton [Wed, 29 Apr 2015 22:45:58 +0000 (15:45 -0700)]
rollup merge of #24962: tamird/unignore-android-tests

r? @alexcrichton I've tested these locally, so they should all be good to go.

9 years agorollup merge of #24961: nham/net_docs_cleanup
Alex Crichton [Wed, 29 Apr 2015 22:45:57 +0000 (15:45 -0700)]
rollup merge of #24961: nham/net_docs_cleanup

Changes made include adding missing punctuation, adding missing words, and converting uses of "Gets" to "Returns" in libstd/net/addr.rs to make it more consistent with the other documentation.

Fixes #24925.

9 years agorollup merge of #24953: tamird/android-pie
Alex Crichton [Wed, 29 Apr 2015 22:45:56 +0000 (15:45 -0700)]
rollup merge of #24953: tamird/android-pie

This is OK to do given:
  - PIE is supported on Android starting with API 16.
  - The bots are running API 18.
  - API < 16 now has a 12.5% market share[0] as of 2015-04-29.

Closes #17437.

[0] https://developer.android.com/about/dashboards/index.html

r? @alexcrichton

9 years agorollup merge of #24952: pnkfelix/put-back-missing-dash-g-in-24687-test
Alex Crichton [Wed, 29 Apr 2015 22:45:55 +0000 (15:45 -0700)]
rollup merge of #24952: pnkfelix/put-back-missing-dash-g-in-24687-test

Add `-g` (to testcase) that I should have included in PR #24932.

Note it is safe, with respect to autobuilds, to land before #24945.

(In other words, landing this sooner won't break things for anyone any
worse than they were already broken, since there are *other* tests
that also add `-g` to their flags via `compile-flags: -g`.)

9 years agorollup merge of #24945: pnkfelix/fixes-for-dash-g-handling
Alex Crichton [Wed, 29 Apr 2015 22:45:54 +0000 (15:45 -0700)]
rollup merge of #24945: pnkfelix/fixes-for-dash-g-handling

Fixes for -g handling

First:
 * decouples our handling of `-g` for the test suite from our handling of `-g` for the rest of the compiler/stdlib building.
 * Namely, if you do `--enable-debug` or `--enable-debuginfo`, that should only affect `rustc` and the standard library crates; the tests should all continue to compile without `-g` unless:
   * you pass `--enable-debuginfo-tests`, or
   * the test itself requests the `-g` option (e.g. via a `// compile-flags: -g` embedded comment).

Second:
 * Makes `rustc` more flexible in that it now accepts multiple occurrences of `-g -g`
 * (as a drive-by, I gave `-O` the same treatment: multiple occurrences of `-O` are treated as synonymous as a single occurrence of `-O`.

Fix #24937

9 years agorollup merge of #24935: pnkfelix/lint-repr-c-drop
Alex Crichton [Wed, 29 Apr 2015 22:45:53 +0000 (15:45 -0700)]
rollup merge of #24935: pnkfelix/lint-repr-c-drop

Lint: warn when mixing `#[repr(C)]` with Drop

Fix #24585

9 years agorollup merge of #24933: oli-obk/patch-1
Alex Crichton [Wed, 29 Apr 2015 22:45:52 +0000 (15:45 -0700)]
rollup merge of #24933: oli-obk/patch-1

compiler plugins are hosted unter "compiler-plugins.html" not "plugins.html"

9 years agorollup merge of #24931: jooert/patch-1
Alex Crichton [Wed, 29 Apr 2015 22:45:51 +0000 (15:45 -0700)]
rollup merge of #24931: jooert/patch-1

Since #24783, the style guidelines recommend that unit tests should live in a submodule `tests` rather than `test` to not clash with the possible use of libtest. This is especially important for benchmark tests as they require libtest. Fixes #24923.

9 years agorollup merge of #24930: nrc/save-fn
Alex Crichton [Wed, 29 Apr 2015 22:45:50 +0000 (15:45 -0700)]
rollup merge of #24930: nrc/save-fn

9 years agorollup merge of #24929: tamird/unstub-some-tests
Alex Crichton [Wed, 29 Apr 2015 22:45:49 +0000 (15:45 -0700)]
rollup merge of #24929: tamird/unstub-some-tests

r? @alexcrichton

9 years agorollup merge of #24926: frewsxcv/patch-20
Alex Crichton [Wed, 29 Apr 2015 22:45:49 +0000 (15:45 -0700)]
rollup merge of #24926: frewsxcv/patch-20

9 years agorollup merge of #24917: zecozephyr/nullptropt
Alex Crichton [Wed, 29 Apr 2015 22:45:47 +0000 (15:45 -0700)]
rollup merge of #24917: zecozephyr/nullptropt

9 years agorollup merge of #24911: GBGamer/patch-4
Alex Crichton [Wed, 29 Apr 2015 22:45:46 +0000 (15:45 -0700)]
rollup merge of #24911: GBGamer/patch-4

9 years agorollup merge of #24908: inrustwetrust/once_memory_ordering
Alex Crichton [Wed, 29 Apr 2015 22:45:45 +0000 (15:45 -0700)]
rollup merge of #24908: inrustwetrust/once_memory_ordering

`call_once` guarantees that there is a happens-before relationship between its closure and code following it via the sequentially consistent atomic store/loads of `self.cnt`.

9 years agorollup merge of #24904: steveklabnik/remove_std_net_warning
Alex Crichton [Wed, 29 Apr 2015 22:45:45 +0000 (15:45 -0700)]
rollup merge of #24904: steveklabnik/remove_std_net_warning

This is served by stability markers.

9 years agorollup merge of #24903: pnkfelix/fsk-enum-swapindrop
Alex Crichton [Wed, 29 Apr 2015 22:45:44 +0000 (15:45 -0700)]
rollup merge of #24903: pnkfelix/fsk-enum-swapindrop

rename `schedule_drop_{enum,adt}_contents`.

addresses review nit from #24765 (it was my mistake for not doing this earlier before it landed).

9 years agorollup merge of #24894: bguiz/diagnostic-E0267
Alex Crichton [Wed, 29 Apr 2015 22:45:43 +0000 (15:45 -0700)]
rollup merge of #24894: bguiz/diagnostic-E0267

This error indicates that a constant references itself.
All constants need to resolve to a value in an acyclic manner.

For example, neither of the following can be sensibly compiled:

```
const X: u32 = X;
```

```
const X: u32 = Y;
const Y: u32 = X;
```

9 years agorollup merge of #24886: GBGamer/master
Alex Crichton [Wed, 29 Apr 2015 22:45:42 +0000 (15:45 -0700)]
rollup merge of #24886: GBGamer/master

These are useful when you want to catch the signals, like when you're making a kernel, or if you just don't want the overhead. (I don't know if there are any of the second kind of people, I don't think it's a good idea, but hey, choice is good).

9 years agorollup merge of #24881: chris-morgan/issue-24872
Alex Crichton [Wed, 29 Apr 2015 22:45:41 +0000 (15:45 -0700)]
rollup merge of #24881: chris-morgan/issue-24872

Fixes #24872.

9 years agorollup merge of #24871: mbrubeck/doc-edit
Alex Crichton [Wed, 29 Apr 2015 22:45:40 +0000 (15:45 -0700)]
rollup merge of #24871: mbrubeck/doc-edit

r? @steveklabnik

9 years agorollup merge of #24870: tshepang/reference-fix-brackets
Alex Crichton [Wed, 29 Apr 2015 22:45:39 +0000 (15:45 -0700)]
rollup merge of #24870: tshepang/reference-fix-brackets

Also, remove the other brackets, because they make the whole sentence look awkward.

9 years agorollup merge of #24862: barometz/intro-push-err-fix
Alex Crichton [Wed, 29 Apr 2015 22:45:38 +0000 (15:45 -0700)]
rollup merge of #24862: barometz/intro-push-err-fix

The error in the Brief Introduction shows the problematic line as "x.push(4)", while the example code uses a vector of strings.

9 years agorollup merge of #24846: dotdash/fast_cttz8
Alex Crichton [Wed, 29 Apr 2015 22:45:37 +0000 (15:45 -0700)]
rollup merge of #24846: dotdash/fast_cttz8

Currently, LLVM lowers a cttz8 on x86_64 to these instructions:

```asm
    movzbl      %dil, %eax
    bsfl        %eax, %eax
    movl        $32, %ecx
    cmovnel     %eax, %ecx
    cmpl        $32, %ecx
    movl        $8, %eax
    cmovnel     %ecx, %eax
```

To improve the codegen, we can zero extend the 8 bit integer, then set
bit 8 and perform a cttz operation on the extended value. That way
there's no conditional operation involved at all.

This was discovered by  this benchmark: https://github.com/Kimundi/long_strings_without_repeats

Timings on my box with the current nightly:
```
running 4 tests
test bench_cpp_naive_big     ... bench:   5479222 ns/iter (+/- 254222)
test bench_noop_big          ... bench:    571405 ns/iter (+/- 111950)
test bench_rust_naive_big    ... bench:   7798102 ns/iter (+/- 148841)
test bench_rust_unsafe_big   ... bench:   6606488 ns/iter (+/- 67529)
```

Timings with the patch applied:
```
running 4 tests
test bench_cpp_naive_big     ... bench:   5470944 ns/iter (+/- 7109)
test bench_noop_big          ... bench:    568944 ns/iter (+/- 6895)
test bench_rust_naive_big    ... bench:   6795901 ns/iter (+/- 43806)
test bench_rust_unsafe_big   ... bench:   5584879 ns/iter (+/- 5291)
```

9 years agorollup merge of #24833: tari/rfc888
Alex Crichton [Wed, 29 Apr 2015 22:45:36 +0000 (15:45 -0700)]
rollup merge of #24833: tari/rfc888

Closes #24118, implementing RFC 888.

9 years agorollup merge of #24762: nrc/mod-debug-2
Alex Crichton [Wed, 29 Apr 2015 22:45:35 +0000 (15:45 -0700)]
rollup merge of #24762: nrc/mod-debug-2

Closes #20780

r? @michaelwoerister

I'm sure this could be done better with deeper knowledge of debuginfo, but this seems like a good start.

9 years agorollup merge of #24711: alexcrichton/fs2.1
Alex Crichton [Wed, 29 Apr 2015 22:45:34 +0000 (15:45 -0700)]
rollup merge of #24711: alexcrichton/fs2.1

This commit is an implementation of [RFC 1044][rfc] which adds additional
surface area to the `std::fs` module. All new APIs are `#[unstable]` behind
assorted feature names for each one.

[rfc]: https://github.com/rust-lang/rfcs/pull/1044

The new APIs added are:

* `fs::canonicalize` - bindings to `realpath` on unix and
  `GetFinalPathNameByHandle` on windows.
* `fs::symlink_metadata` - similar to `lstat` on unix
* `fs::FileType` and accessor methods as `is_{file,dir,symlink}`
* `fs::Metadata::file_type` - accessor for the raw file type
* `fs::DirEntry::metadata` - acquisition of metadata which is free on Windows
  but requires a syscall on unix.
* `fs::DirEntry::file_type` - access the file type which may not require a
  syscall on most platforms.
* `fs::DirEntry::file_name` - access just the file name without leading
  components.
* `fs::PathExt::symlink_metadata` - convenience method for the top-level
  function.
* `fs::PathExt::canonicalize` - convenience method for the top-level
  function.
* `fs::PathExt::read_link` - convenience method for the top-level
  function.
* `fs::PathExt::read_dir` - convenience method for the top-level
  function.
* `std::os::raw` - type definitions for raw OS/C types available on all
  platforms.
* `std::os::$platform` - new modules have been added for all currently supported
  platforms (e.g. those more specific than just `unix`).
* `std::os::$platform::raw` - platform-specific type definitions. These modules
  are populated with the bare essentials necessary for lowing I/O types into
  their raw representations, and currently largely consist of the `stat`
  definition for unix platforms.

This commit also deprecates `Metadata::{modified, accessed}` in favor of
inspecting the raw representations via the lowering methods of `Metadata`.

Closes https://github.com/rust-lang/rust/issues/24796

9 years agorollup merge of #24610: nagisa/offset-docs
Alex Crichton [Wed, 29 Apr 2015 22:45:34 +0000 (15:45 -0700)]
rollup merge of #24610: nagisa/offset-docs

9 years agoRe-enable tests on Android
Tamir Duberstein [Wed, 22 Apr 2015 05:00:47 +0000 (22:00 -0700)]
Re-enable tests on Android

Addresses part of #10381.

9 years agoRe-enable test on Android
Tamir Duberstein [Wed, 22 Apr 2015 05:05:01 +0000 (22:05 -0700)]
Re-enable test on Android

Closes #9116.

9 years agoReference the correct issue
Tamir Duberstein [Wed, 29 Apr 2015 21:22:54 +0000 (14:22 -0700)]
Reference the correct issue

The problem here is that this test doesn't even compile for Android.

See #24958.

9 years agoImprove libstd/net/addr.rs documentation.
Nick Hamann [Wed, 29 Apr 2015 21:24:44 +0000 (16:24 -0500)]
Improve libstd/net/addr.rs documentation.

This adds some missing punctuation and converts uses of "Gets" to
"Returns". This sounds better to my ear, but more importantly is
more consistent with the documentation from other files.

9 years agoAdd some missing punctuation in the libstd/net/tcp.rs docs.
Nick Hamann [Wed, 29 Apr 2015 21:21:39 +0000 (16:21 -0500)]
Add some missing punctuation in the libstd/net/tcp.rs docs.

9 years agoAdd some missing punctuation in the libstd/net/ip.rs docs.
Nick Hamann [Wed, 29 Apr 2015 21:19:35 +0000 (16:19 -0500)]
Add some missing punctuation in the libstd/net/ip.rs docs.

9 years agotests for lint that warns about mixing #[repr(C)] with Drop.
Felix S. Klock II [Wed, 29 Apr 2015 10:08:53 +0000 (12:08 +0200)]
tests for lint that warns about mixing #[repr(C)] with Drop.

THis includes tests for struct and enum. (I suspect the closure case
is actually unreachable, but i see no harm in including it.)

9 years agolint for mixing `#[repr(C)]` with an impl of `Drop`.
Felix S. Klock II [Wed, 29 Apr 2015 09:37:19 +0000 (11:37 +0200)]
lint for mixing `#[repr(C)]` with an impl of `Drop`.

9 years agoImprove libstd/net/udp.rs documentation.
Nick Hamann [Wed, 29 Apr 2015 20:57:17 +0000 (15:57 -0500)]
Improve libstd/net/udp.rs documentation.

This adds some missing punctuation, adds a missing word, and
corrects a bug in the description of `send_to`, which actually
returns the number of bytes written on success.

Fixes #24925.

9 years agoUse PIE on Android
Tamir Duberstein [Wed, 29 Apr 2015 18:12:25 +0000 (11:12 -0700)]
Use PIE on Android

This is OK to do given:
  - PIE is supported on Android starting with API 16.
  - The bots are running API 18.
  - API < 16 now has a 12.5% market share[0] as of 2015-04-29.

Unfortunately, this breaks backtrace support. See #17520.

Closes #17437.

[0] https://developer.android.com/about/dashboards/index.html

9 years agoUpdate SNAPs to latest snapshot.
Peter Marheine [Wed, 29 Apr 2015 19:11:31 +0000 (13:11 -0600)]
Update SNAPs to latest snapshot.

9 years agoDRY Android targets
Tamir Duberstein [Wed, 29 Apr 2015 17:53:01 +0000 (10:53 -0700)]
DRY Android targets

9 years agoAdd `-g` that I should have included in PR #24932.
Felix S. Klock II [Wed, 29 Apr 2015 16:58:42 +0000 (18:58 +0200)]
Add `-g` that I should have included in PR #24932.

Note it is safe, with respect to autobuilds, to land before #24945.

(In other words, landing this sooner won't break things for anyone any
worse than they were already broken, since there are *other* tests
that also add `-g` to their flags via `compile-flags: -g`.)

9 years agoUnit test ensuring we accept repeated `-g` and `-O`.
Felix S. Klock II [Wed, 29 Apr 2015 16:54:20 +0000 (18:54 +0200)]
Unit test ensuring we accept repeated `-g` and `-O`.

9 years agoAllow `-g` and `-O` options to be specified multiple times at command line.
Felix S. Klock II [Wed, 29 Apr 2015 15:20:36 +0000 (17:20 +0200)]
Allow `-g` and `-O` options to be specified multiple times at command line.

9 years agoadd `--enable-debuginfo-tests`, analogous to `--disable-optimize-tests`.
Felix S. Klock II [Wed, 29 Apr 2015 15:18:44 +0000 (17:18 +0200)]
add `--enable-debuginfo-tests`, analogous to `--disable-optimize-tests`.

Then, decouple the question of whether the compiler/stdlib carry
debuginfo (which is controlled via `--enable-debuginfo` and implied by
`--enable-debug`) from the question of whether the tests carry
debuginfo (which now no longer is implied by `--enable-debug` nor
`--enable-debuginfo`, and is off by default).

9 years agostd: Fix inheriting standard handles on windows
Alex Crichton [Mon, 27 Apr 2015 20:44:20 +0000 (13:44 -0700)]
std: Fix inheriting standard handles on windows

Currently if a standard I/O handle is set to inherited on Windows, no action is
taken and the slot in the process information description is set to
`INVALID_HANDLE_VALUE`. Due to our passing of `STARTF_USESTDHANDLES`, however,
this means that the handle is actually set to nothing and if a child tries to
print it will generate an error.

This commit fixes this behavior by explicitly creating stdio handles to be
placed in these slots by duplicating the current process's I/O handles. This is
presumably what previously happened silently by using a file-descriptor-based
implementation instead of a `HANDLE`-centric implementation.

Along the way this cleans up a lot of code in `Process::spawn` for Windows by
ensuring destructors are always run, using more RAII, and limiting the scope of
`unsafe` wherever possible.

9 years agoCurrently, LLVM lowers a cttz8 on x86_64 to these instructions:
Björn Steinbrink [Sun, 26 Apr 2015 22:18:02 +0000 (00:18 +0200)]
Currently, LLVM lowers a cttz8 on x86_64 to these instructions:

```asm
    movzbl      %dil, %eax
    bsfl        %eax, %eax
    movl        $32, %ecx
    cmovnel     %eax, %ecx
    cmpl        $32, %ecx
    movl        $8, %eax
    cmovnel     %ecx, %eax
```

which has some unnecessary overhead, having two conditional moves.

To improve the codegen, we can zero extend the 8 bit integer, then set
bit 8 and perform a cttz operation on the extended value. That way
there's no conditional operation involved at all.

9 years agoAuto merge of #24932 - pnkfelix:fix-issue-24687, r=huonw
bors [Wed, 29 Apr 2015 10:40:03 +0000 (10:40 +0000)]
Auto merge of #24932 - pnkfelix:fix-issue-24687, r=huonw

metdata: Fix zero-normalization of the pos of a `MultiByteChar`

Fix #24687

The source byte/character mappings for every crate track the collection of multi-characters from its source files specially.  When we import the source information for another file into the current compilation unit, we assign its byte-positions unique values by shifting them all by a fixed adjustment, tracked in the `start_pos` field.  But when we pull out the source span information for one function from one crate and into our own crate, we need to re-normalize the byte positions: subtracting the old `start_pos` and adding the new `start_pos`. The `new_imported_filemap(..)` method handles adding the new `start_pos`, so all `creader` needs to do is re-normalize each `pos` to zero.

It seems like it was indeed trying to do this, but it mistakenly added the old `start_pos` instead of subtracting it.

9 years agofix broken link
Oliver Schneider [Wed, 29 Apr 2015 09:41:00 +0000 (11:41 +0200)]
fix broken link

compiler plugins are hosted unter "compiler-plugins.html" not "plugins.html"

9 years agoRegression test for issue 24687.
Felix S. Klock II [Wed, 29 Apr 2015 08:21:47 +0000 (10:21 +0200)]
Regression test for issue 24687.

use visible characters for the multibyte character filler.

9 years agoAdapt benchmark tests to unit test guidelines
jooert [Wed, 29 Apr 2015 08:36:43 +0000 (10:36 +0200)]
Adapt benchmark tests to unit test guidelines

Since #24783, the style guidelines recommend that unit tests should live in a submodule `tests` rather than `test` to not clash with the possible use of libtest. This is especially important for benchmark tests as they require libtest. Fixes #24923.

9 years agoFix zero-normalization of the pos of a `MultiByteChar`.
Felix S. Klock II [Wed, 29 Apr 2015 08:21:29 +0000 (10:21 +0200)]
Fix zero-normalization of the pos of a `MultiByteChar`.

Fix #24687

9 years agoAuto merge of #24893 - robinst:issue-24407-E0013, r=nrc
bors [Wed, 29 Apr 2015 07:37:58 +0000 (07:37 +0000)]
Auto merge of #24893 - robinst:issue-24407-E0013, r=nrc

Part of #24407.

9 years agosave-analysis: fix impl functions
Nick Cameron [Wed, 29 Apr 2015 07:21:18 +0000 (19:21 +1200)]
save-analysis: fix impl functions

9 years agoReviewer changes
Nick Cameron [Wed, 29 Apr 2015 06:14:37 +0000 (18:14 +1200)]
Reviewer changes

9 years agoTidy up
Nick Cameron [Fri, 24 Apr 2015 05:25:35 +0000 (17:25 +1200)]
Tidy up

9 years agodebuginfo: extract adt.rs
Nick Cameron [Fri, 24 Apr 2015 05:20:13 +0000 (17:20 +1200)]
debuginfo: extract adt.rs

9 years agodebuginfo: extract metadata.rs
Nick Cameron [Fri, 24 Apr 2015 04:48:10 +0000 (16:48 +1200)]
debuginfo: extract metadata.rs

9 years agodebuginfo: extract types.rs
Nick Cameron [Fri, 24 Apr 2015 04:08:11 +0000 (16:08 +1200)]
debuginfo: extract types.rs

9 years agodebuginfo: extract namespace.rs
Nick Cameron [Fri, 24 Apr 2015 04:00:47 +0000 (16:00 +1200)]
debuginfo: extract namespace.rs

9 years agodebuginfo: extract create.rs
Nick Cameron [Fri, 24 Apr 2015 03:49:20 +0000 (15:49 +1200)]
debuginfo: extract create.rs

9 years agodebuginfo: extract utils.rs
Nick Cameron [Fri, 24 Apr 2015 03:36:43 +0000 (15:36 +1200)]
debuginfo: extract utils.rs

9 years agodebuginfo: extract gdb.rs
Nick Cameron [Fri, 24 Apr 2015 03:25:42 +0000 (15:25 +1200)]
debuginfo: extract gdb.rs

9 years agodebuginfo: pull out docs
Nick Cameron [Fri, 24 Apr 2015 01:20:54 +0000 (13:20 +1200)]
debuginfo: pull out docs

9 years agoTidy up word-wrapping in debuginfo
Nick Cameron [Thu, 23 Apr 2015 23:38:53 +0000 (11:38 +1200)]
Tidy up word-wrapping in debuginfo

9 years agoMove debuginfo.rs to its own directory
Nick Cameron [Thu, 23 Apr 2015 23:31:13 +0000 (11:31 +1200)]
Move debuginfo.rs to its own directory

9 years agoUnstub some tests
Tamir Duberstein [Wed, 29 Apr 2015 04:23:28 +0000 (21:23 -0700)]
Unstub some tests

9 years agoTests need not be public
Tamir Duberstein [Wed, 29 Apr 2015 04:22:58 +0000 (21:22 -0700)]
Tests need not be public

9 years agoRemove unused variable
Tamir Duberstein [Wed, 29 Apr 2015 04:22:06 +0000 (21:22 -0700)]
Remove unused variable

9 years agoAuto merge of #24681 - tamird:unignore-android, r=alexcrichton
bors [Wed, 29 Apr 2015 04:09:45 +0000 (04:09 +0000)]
Auto merge of #24681 - tamird:unignore-android, r=alexcrichton

There are still quite a few ignored Android tests kicking around, most of which were added in 445faca8441aae34c91318b6ad9e2049885af8dc, which has a pretty unfortunate commit message.

r? @alexcrichton

9 years agoFix punctuation placement in doc-comment
Corey Farwell [Wed, 29 Apr 2015 03:06:00 +0000 (23:06 -0400)]
Fix punctuation placement in doc-comment

9 years agoAuto merge of #24888 - tamird:snapshot, r=alexcrichton
bors [Wed, 29 Apr 2015 02:16:01 +0000 (02:16 +0000)]
Auto merge of #24888 - tamird:snapshot, r=alexcrichton

r? @alexcrichton cc @brson

9 years agoAdd intrinsics for unchecked division and modulo
Nicholas Mazzuca [Wed, 29 Apr 2015 01:20:30 +0000 (18:20 -0700)]
Add intrinsics for unchecked division and modulo

The "unchecked_" div and rem functions will give UB in case of rhs == 0, or,
in the signed versions, lhs == INT::min and rhs == -1

9 years agoReference the correct issue
Tamir Duberstein [Wed, 22 Apr 2015 05:10:47 +0000 (22:10 -0700)]
Reference the correct issue

9 years ago#10356: Warnings
Tamir Duberstein [Wed, 22 Apr 2015 05:10:22 +0000 (22:10 -0700)]
#10356: Warnings

9 years ago#10381: Warnings
Tamir Duberstein [Wed, 22 Apr 2015 04:53:07 +0000 (21:53 -0700)]
#10381: Warnings

9 years agoReference the correct issue and clarify failure
Tamir Duberstein [Wed, 22 Apr 2015 04:28:46 +0000 (21:28 -0700)]
Reference the correct issue and clarify failure

9 years ago#10393 & #13206: Warnings
Tamir Duberstein [Wed, 22 Apr 2015 04:27:29 +0000 (21:27 -0700)]
#10393 & #13206: Warnings

9 years agostd: Implement fs::DirBuilder
Alex Crichton [Tue, 28 Apr 2015 00:29:35 +0000 (17:29 -0700)]
std: Implement fs::DirBuilder

This is the last remaining portion of #24796

9 years agoRegister new snapshots
Tamir Duberstein [Mon, 27 Apr 2015 21:10:49 +0000 (14:10 -0700)]
Register new snapshots

9 years agoAuto merge of #24865 - bluss:range-size, r=alexcrichton
bors [Wed, 29 Apr 2015 00:15:22 +0000 (00:15 +0000)]
Auto merge of #24865 - bluss:range-size, r=alexcrichton

core: Fix size_hint for signed integer `Range<T>` iterators

There was an overflow bug in .size_hint() for signed iterators, which
produced an hilariously incorrect size or an overflow panic.

Incorrect size is a serious bug since the iterators are marked
ExactSizeIterator. (And leads to abort() on (-1i8..127).collect() when
the collection tries to preallocate too much).

> (-1i8..127).size_hint()
(18446744073709551488, Some(18446744073709551488))

Bug found using quickcheck.

Fixes #24851

9 years agoExtend the nullable pointer optimization to captured vars of closures
J Bailey [Tue, 28 Apr 2015 23:24:16 +0000 (19:24 -0400)]
Extend the nullable pointer optimization to captured vars of closures

9 years agoAuto merge of #24781 - bluss:vec-drain-range, r=alexcrichton
bors [Tue, 28 Apr 2015 22:13:42 +0000 (22:13 +0000)]
Auto merge of #24781 - bluss:vec-drain-range, r=alexcrichton

Implement Vec::drain(\<range type\>) from rust-lang/rfcs#574, tracking issue #23055.

This is a big step forward for vector usability. This is an introduction of an API for removing a range of *m* consecutive elements from a vector, as efficently as possible.

New features:

- Introduce trait `std::collections::range::RangeArgument` implemented by all four built-in range types.
- Change `Vec::drain()` to use `Vec::drain<R: RangeArgument>(R)`

Implementation notes:

- Use @Gankro's idea for memory safety: Use `set_len` on the source vector when creating the iterator, to make sure that the part of the vector that will be modified is unreachable. Fix up things in Drain's destructor — but even if it doesn't run, we don't expose any moved-out-from slots of the vector.
- This `.drain<R>(R)` very close to how it is specified in the RFC.
- Introduced as unstable
- Drain reuses the slice iterator — copying and pasting the same iterator pointer arithmetic again felt very bad
- The `usize` index as a range argument in the RFC is not included. The ranges trait would have to change to accomodate it.

Please help me with:

- Name and location of the new ranges trait.
- Design of the ranges trait
- Understanding Niko's comments about variance (Note: for a long time I was using a straight up &mut Vec in the iterator, but I changed this to permit reusing the slice iterator).

Previous PR and discussion: #23071

9 years agoCorrect the entry point in librustc/README.md
Nicholas [Tue, 28 Apr 2015 21:40:03 +0000 (14:40 -0700)]
Correct the entry point in librustc/README.md

9 years agoAuto merge of #24777 - alexcrichton:musl, r=brson
bors [Tue, 28 Apr 2015 20:12:59 +0000 (20:12 +0000)]
Auto merge of #24777 - alexcrichton:musl, r=brson

These commits build on [some great work on reddit](http://www.reddit.com/r/rust/comments/33boew/weekend_experiment_link_rust_programs_against/) for adding MUSL support to the compiler. This goal of this PR is to enable a `--target x86_64-unknown-linux-musl` argument to the compiler to work A-OK. The outcome here is that there are 0 compile-time dependencies for a MUSL-targeting build *except for a linker*. Currently this also assumes that MUSL is being used for statically linked binaries so there is no support for dynamically linked binaries with MUSL.

MUSL support largely just entailed munging around with the linker and where libs are located, and the major highlights are:

* The entirety of `libc.a` is included in `liblibc.rlib` (statically included as an archive).
* The entirety of `libunwind.a` is included in `libstd.rlib` (like with liblibc).
* The target specification for MUSL passes a number of ... flavorful options! Each option is documented in the relevant commit.
* The entire test suite currently passes with MUSL as a target, except for:
  * Dynamic linking tests are all ignored as it's not supported with MUSL
  * Stack overflow detection is not working MUSL yet (I'm not sure why)
* There is a language change included in this PR to add a `target_env` `#[cfg]` directive. This is used to conditionally build code for only MUSL (or for linux distros not MUSL). I highly suspect that this will also be used by Windows to target MSVC instead of a MinGW-based toolchain.

To build a compiler targeting MUSL you need to follow these steps:

1. Clone the current MUSL repo from `git://git.musl-libc.org/musl`. Build this as usual and install it.
2. Clone and build LLVM's [libcxxabi](http://libcxxabi.llvm.org/) library. Only the `libunwind.a` artifact is needed. I have tried using upstream libunwind's source repo but I have not gotten unwinding to work with it unfortunately. Move `libunwind.a` adjacent to MUSL's `libc.a`
3. Configure a Rust checkout with `--target=x86_64-unknown-linux-musl --musl-root=$MUSL_ROOT` where `MUSL_ROOT` is where you installed MUSL in step 1.

I hope to improve building a copy of libunwind as it's still a little sketchy and difficult to do today, but other than that everything should "just work"! This PR is not intended to include 100% comprehensive support for MUSL, as future modifications will probably be necessary.

9 years agoClarify Once::call_once memory ordering guarantees in docs
inrustwetrust [Tue, 28 Apr 2015 19:07:21 +0000 (21:07 +0200)]
Clarify Once::call_once memory ordering guarantees in docs

9 years agoClarify offset rules a bit
Simonas Kazlauskas [Sun, 19 Apr 2015 17:17:47 +0000 (20:17 +0300)]
Clarify offset rules a bit

9 years agoAuto merge of #24906 - pnkfelix:fsk-fix-24895, r=alexcrichton
bors [Tue, 28 Apr 2015 17:12:36 +0000 (17:12 +0000)]
Auto merge of #24906 - pnkfelix:fsk-fix-24895, r=alexcrichton

dropck: Remove `Copy` from special-cased traits

Fix #24895.

[breaking-change]

What does this break?  Basically, code that implements `Drop` and is
using `T:Copy` for one of its type parameters and is relying on the
Drop Check rule not applying to it.

Here is an example:

```rust
#![allow(dead_code,unused_variables,unused_assignments)]
struct D<T:Copy>(T);
impl<T:Copy> Drop for D<T> { fn drop(&mut self) { } }

trait UserT { fn c(&self) { } }
impl<T:Copy> UserT for T { }
struct E<T:UserT>(T);
impl<T:UserT> Drop for E<T> { fn drop(&mut self) { } }

// This one will start breaking.
fn foo() { let (d2, d1); d1 = D(34); d2 = D(&d1); }

#[cfg(this_one_does_and_should_always_break)]
fn bar() { let (e2, e1); e1 = E(34); e2 = E(&e1); }

fn main() {
    foo();
}
```

9 years agotest: Fix some tests to run with musl
Alex Crichton [Fri, 24 Apr 2015 01:41:37 +0000 (18:41 -0700)]
test: Fix some tests to run with musl

There were a few test cases to fix:

* Dynamic libraries are not supported with MUSL right now, so all of those
  related test which force or require dylibs are ignored.
* Looks like the default stack for MUSL is smaller than glibc, so a few stack
  allocations in benchmarks were boxed up (shouldn't have a perf impact).
* Some small linkage tweaks here and there
* Out-of-stack detection does not currently work with MUSL

9 years agoregression test for Issue 24895.
Felix S. Klock II [Tue, 28 Apr 2015 15:51:08 +0000 (17:51 +0200)]
regression test for Issue 24895.

9 years agoFix #24895.
Felix S. Klock II [Tue, 28 Apr 2015 15:47:16 +0000 (17:47 +0200)]
Fix #24895.

[breaking-change]

What does this break?  Basically, code that implements `Drop` and is
using `T:Copy` for one of its type parameters and is relying on the
Drop Check rule not applying to it.

Here is an example:

```rust
#![allow(dead_code,unused_variables,unused_assignments)]
struct D<T:Copy>(T);
impl<T:Copy> Drop for D<T> { fn drop(&mut self) { } }

trait UserT { fn c(&self) { } }
impl<T:Copy> UserT for T { }
struct E<T:UserT>(T);
impl<T:UserT> Drop for E<T> { fn drop(&mut self) { } }

// This one will start breaking.
fn foo() { let (d2, d1); d1 = D(34); d2 = D(&d1); }

#[cfg(this_one_does_and_should_always_break)]
fn bar() { let (e2, e1); e1 = E(34); e2 = E(&e1); }

fn main() {
    foo();
}
```

9 years agoremove stability note from std::net
Steve Klabnik [Tue, 28 Apr 2015 15:18:10 +0000 (11:18 -0400)]
remove stability note from std::net

This is served by stability markers.

9 years agorename schedule_drop_{enum,adt}_contents.
Felix S. Klock II [Tue, 28 Apr 2015 14:40:02 +0000 (16:40 +0200)]
rename schedule_drop_{enum,adt}_contents.

9 years agoAuto merge of #24891 - tcard:patch-1, r=steveklabnik
bors [Tue, 28 Apr 2015 14:21:22 +0000 (14:21 +0000)]
Auto merge of #24891 - tcard:patch-1, r=steveklabnik

`Type` should be `Trait` to match the next example line.

r? @steveklabnik

9 years agoAdd error explanation for E0013
Robin Stocker [Tue, 28 Apr 2015 09:49:09 +0000 (19:49 +1000)]
Add error explanation for E0013

9 years ago=BG= change definition to use 'statics' as well as 'constants'
Brendan Graetz [Tue, 28 Apr 2015 10:22:26 +0000 (20:22 +1000)]
=BG= change definition to use 'statics' as well as 'constants'

9 years ago=BG= Add detailed error message for E0265
Brendan Graetz [Tue, 28 Apr 2015 09:53:10 +0000 (19:53 +1000)]
=BG= Add detailed error message for E0265

This error indicates that a constant references itself.
All constants need to resolve to a value in an acyclic manner.

For example, neither of the following can be sensibly compiled:

```
const X: u32 = X;
```

```
const X: u32 = Y;
const Y: u32 = X;
```

9 years agocollections: Implement vec::drain(range) according to RFC 574
Ulrik Sverdrup [Mon, 27 Apr 2015 17:37:13 +0000 (19:37 +0200)]
collections: Implement vec::drain(range) according to RFC 574

Old `.drain()` on vec is performed using `.drain(..)` now.

`.drain(range)` is unstable and under feature(collections_drain)

[breaking-change]

9 years agoTRPL: Tiny incoherence in UFCS example.
Toni Cárdenas [Tue, 28 Apr 2015 09:10:01 +0000 (11:10 +0200)]
TRPL: Tiny incoherence in UFCS example.

`Type` should be `Trait` to match the next example line.

r? @steveklabnik

9 years agoAuto merge of #24835 - rprichard:rfail-full, r=alexcrichton
bors [Tue, 28 Apr 2015 05:37:48 +0000 (05:37 +0000)]
Auto merge of #24835 - rprichard:rfail-full, r=alexcrichton

This commit gets `make check-stage1` working again after #24718.

cc @tamird

r? @alexcrichton

9 years agoFix #24872, XSS in docs not found page.
Chris Morgan [Tue, 28 Apr 2015 03:31:45 +0000 (13:31 +1000)]
Fix #24872, XSS in docs not found page.