Commit Graph

44296 Commits

Author SHA1 Message Date
Nick Hamann
5559d2ba04 Add explanation for E0210 and revise E0117. 2015-07-11 21:43:45 -05:00
bors
1b28ffa521 Auto merge of #26961 - Manishearth:rollup, r=Manishearth
- Successful merges: #26932, #26936, #26943, #26944
- Failed merges:
2015-07-11 07:40:27 +00:00
Manish Goregaokar
25b14375b7 Rollup merge of #26944 - rick68:patch-11, r=brson
fix typos
2015-07-11 18:40:13 +05:30
Manish Goregaokar
a36411d9db Rollup merge of #26943 - brson:installer, r=alexcrichton 2015-07-11 18:40:13 +05:30
Manish Goregaokar
ba6c808feb Rollup merge of #26936 - bluss:doc-array, r=steveklabnik
Small tweaks for the documentation of the primitive type array

Follow up to PR #26923, fix a few small details.
2015-07-11 18:40:13 +05:30
Manish Goregaokar
bb73c7a38d Rollup merge of #26932 - tsurai:master, r=steveklabnik
Simple adjustment to auto select the nightly channel for examples using unstable feature.
2015-07-11 18:40:13 +05:30
bors
f7f28c8b26 Auto merge of #26903 - steveklabnik:io_function_docs, r=alexcricthon
This round: io::Result and the free functions.
2015-07-11 04:44:55 +00:00
bors
96e64ec987 Auto merge of #26945 - steveklabnik:doc_io_bufreader, r=alexcrichton
Mostly just adding basic examples, what's there seems mostly good.

r? @alexcrichton
2015-07-11 03:10:11 +00:00
bors
64db3aac0f Auto merge of #26929 - alexcrichton:windows-dir-junction, r=brson
Previously on Windows a directory junction would return false from `is_dir`,
causing various odd behavior, specifically calls to `create_dir_all` might fail
when they would otherwise continue to succeed.

Closes #26716
2015-07-11 01:35:30 +00:00
bors
98dcd5e10a Auto merge of #26941 - fhartwig:osx-file-debug, r=alexcrichton
This makes `Debug` for `File` show the file path and access mode of the file on OS X, just like on Linux.
I'd be happy about any feedback how to make this code better. In particular, I'm not sure how to handle the buffer passed to `fnctl`. This way works, but it feels a bit cumbersome. `fcntl` unfortunately doesn't return the length of the path.
2015-07-11 00:01:51 +00:00
Steve Klabnik
18201d7db1 More docs for std::io::BufReader 2015-07-10 16:47:48 -04:00
bors
072d07ce9f Auto merge of #26926 - alexcrichton:llvm-archive-writer, r=brson
We have previously always relied upon an external tool, `ar`, to modify archives
that the compiler produces (staticlibs, rlibs, etc). This approach, however, has
a number of downsides:

* Spawning a process is relatively expensive for small compilations
* Encoding arguments across process boundaries often incurs unnecessary overhead
  or lossiness. For example `ar` has a tough time dealing with files that have
  the same name in archives, and the compiler copies many files around to ensure
  they can be passed to `ar` in a reasonable fashion.
* Most `ar` programs found do **not** have the ability to target arbitrary
  platforms, so this is an extra tool which needs to be found/specified when
  cross compiling.

The LLVM project has had a tool called `llvm-ar` for quite some time now, but it
wasn't available in the standard LLVM libraries (it was just a standalone
program). Recently, however, in LLVM 3.7, this functionality has been moved to a
library and is now accessible by consumers of LLVM via the `writeArchive`
function.

This commit migrates our archive bindings to no longer invoke `ar` by default
but instead make a library call to LLVM to do various operations. This solves
all of the downsides listed above:

* Archive management is now much faster, for example creating a "hello world"
  staticlib is now 6x faster (50ms => 8ms). Linking dynamic libraries also
  recently started requiring modification of rlibs, and linking a hello world
  dynamic library is now 2x faster.
* The compiler is now one step closer to "hassle free" cross compilation because
  no external tool is needed for managing archives, LLVM does the right thing!

This commit does not remove support for calling a system `ar` utility currently.
We will continue to maintain compatibility with LLVM 3.5 and 3.6 looking forward
(so the system LLVM can be used wherever possible), and in these cases we must
shell out to a system utility. All nightly builds of Rust, however, will stop
needing a system `ar`.
2015-07-10 20:18:30 +00:00
Wei-Ming Yang
2509702314 Update boxed.rs
fix typos
2015-07-11 03:50:32 +08:00
Brian Anderson
e6d3780e22 Upgrade rust-installer. Fixes install on Fedora-based Linuxes. 2015-07-10 11:33:29 -07:00
bors
fe0b5c0d38 Auto merge of #26896 - tbu-:pr_getcwd, r=alexcrichton
(On Windows, it works already.)
2015-07-10 16:26:19 +00:00
Alex Crichton
4a824275b9 trans: Use LLVM's writeArchive to modify archives
We have previously always relied upon an external tool, `ar`, to modify archives
that the compiler produces (staticlibs, rlibs, etc). This approach, however, has
a number of downsides:

* Spawning a process is relatively expensive for small compilations
* Encoding arguments across process boundaries often incurs unnecessary overhead
  or lossiness. For example `ar` has a tough time dealing with files that have
  the same name in archives, and the compiler copies many files around to ensure
  they can be passed to `ar` in a reasonable fashion.
* Most `ar` programs found do **not** have the ability to target arbitrary
  platforms, so this is an extra tool which needs to be found/specified when
  cross compiling.

The LLVM project has had a tool called `llvm-ar` for quite some time now, but it
wasn't available in the standard LLVM libraries (it was just a standalone
program). Recently, however, in LLVM 3.7, this functionality has been moved to a
library and is now accessible by consumers of LLVM via the `writeArchive`
function.

This commit migrates our archive bindings to no longer invoke `ar` by default
but instead make a library call to LLVM to do various operations. This solves
all of the downsides listed above:

* Archive management is now much faster, for example creating a "hello world"
  staticlib is now 6x faster (50ms => 8ms). Linking dynamic libraries also
  recently started requiring modification of rlibs, and linking a hello world
  dynamic library is now 2x faster.
* The compiler is now one step closer to "hassle free" cross compilation because
  no external tool is needed for managing archives, LLVM does the right thing!

This commit does not remove support for calling a system `ar` utility currently.
We will continue to maintain compatibility with LLVM 3.5 and 3.6 looking forward
(so the system LLVM can be used wherever possible), and in these cases we must
shell out to a system utility. All nightly builds of Rust, however, will stop
needing a system `ar`.
2015-07-10 09:06:21 -07:00
Alex Crichton
72750c7c6e std: Consider directory junctions as directories
Previously on Windows a directory junction would return false from `is_dir`,
causing various odd behavior, specifically calls to `create_dir_all` might fail
when they would otherwise continue to succeed.

Closes #26716
2015-07-10 08:25:37 -07:00
bors
fddfd089b7 Auto merge of #26928 - reem:cstr-is-a-cow, r=Gankro
This allows CString and CStr to be used with the Cow type,
which is extremely useful when interfacing with C libraries
that make extensive use of C-style strings.
2015-07-10 14:52:48 +00:00
Steve Klabnik
1239e34261 Add more std::io documentation.
This round: io::Result and the free functions.
2015-07-10 10:24:11 -04:00
Florian Hartwig
f200ad85bd Show file name and access mode in Debug instance for File on OS X 2015-07-10 16:23:54 +02:00
Ulrik Sverdrup
da03fc68ac Small tweaks for the documentation of the primitive type array 2015-07-10 14:50:35 +02:00
bors
cdcce3ba44 Auto merge of #26919 - alexcrichton:msvc-turn-off-unwinding, r=brson
There are a number of problems with MSVC landing pads today:

* They only work about 80% of the time with optimizations enabled. For example when running the run-pass test suite a failing test will cause `compiletest` to segfault (b/c of a thread panic). There are also a large number of run-fail tests which will simply crash.
* Enabling landing pads caused the regression seen in #26915.

Overall it looks like LLVM's support for MSVC landing pads isn't as robust as we'd like for now, so let's take a little more time before we turn them on by default.


Closes #26915
2015-07-10 12:40:25 +00:00
bors
d0d37075a5 Auto merge of #26751 - retep998:copy-that-floppy, r=alexcrichton
Using the OS mechanism for copying files allows the OS to optimize the transfer using stuff such as [Offloaded Data Transfers (ODX)](https://msdn.microsoft.com/en-us/library/windows/desktop/hh848056%28v=vs.85%29.aspx).
Also preserves a lot more information, including NTFS [File Streams](https://msdn.microsoft.com/en-us/library/windows/desktop/aa364404%28v=vs.85%29.aspx), which the manual implementation threw away.
In addition, it is an atomic operation, unlike the manual implementation which has extra calls for copying over permissions.

r? @alexcrichton
2015-07-10 11:07:25 +00:00
Tobias Bucher
b83ec47808 Remove the generic fill_bytes_buf function 2015-07-10 12:33:10 +02:00
bors
4695fbde21 Auto merge of #26613 - brson:relnotes, r=alexcrichton
Haven't finished these, but since [others](https://github.com/rust-lang/rust/pull/26579) are also working on this and I'm on vacation I figured I should get this in.
2015-07-10 09:16:38 +00:00
Peter Atashian
1d202692ec Use CopyFileEx for fs::copy on Windows
Adds a couple more tests for fs::copy

Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-07-10 04:54:00 -04:00
Cristian Kubis
682a007d24 doc: set playground to nightly for unstable code 2015-07-10 09:40:44 +02:00
bors
736886c84b Auto merge of #26907 - nrc:save-fns, r=brson
r? @huonw
2015-07-10 00:47:35 +00:00
Jonathan Reem
69579e4d37 Test that CStr and CString have equivalent hashes. 2015-07-09 17:41:09 -07:00
Jonathan Reem
84f9c61c69 Implement Borrow<CStr> for CString and ToOwned for CStr
This allows CString and CStr to be used with the Cow type,
which is extremely useful when interfacing with C libraries
that make extensive use of C-style strings.
2015-07-09 17:32:50 -07:00
Brian Anderson
0d60e8d002 Update RELEASES.md for 1.2 2015-07-09 15:39:26 -07:00
Brian Anderson
e7dbcf8f57 Update AUTHORS.txt for 1.2 2015-07-09 15:28:08 -07:00
bors
67256dff6d Auto merge of #26923 - bluss:doc-array, r=alexcrichton
Expand documentation for the primitive type array
2015-07-09 21:52:43 +00:00
Ulrik Sverdrup
1abdd130d8 Expand documentation for the primitive type array 2015-07-09 22:51:00 +02:00
Alex Crichton
813cfa5073 Revert "msvc: Enable landing pads by default"
This reverts commit f9de964ccf.

Conflicts:
	src/librustc_trans/trans/base.rs
2015-07-09 09:50:08 -07:00
bors
6c4e236b95 Auto merge of #26766 - jespino:add-more-filetypes, r=alexcrichton
I find that isn't supported on the current API and I think is necesary.

It is my first PR to rust (I'm not a rust expert and I'm not sure if this is the better way to propose this thinks), of course any suggestion of change will be welcome.

I'm almost sure that in windows aren't supported this filetypes, then, i put in the api of win::fs the functions with a fixed false in the response, I hope this is correct.
2015-07-09 16:38:00 +00:00
bors
92a95fe550 Auto merge of #26814 - tshepang:array-examples, r=bluss 2015-07-09 14:50:32 +00:00
Tobias Bucher
d99d4fbf70 Address some comments on the pull request 2015-07-09 15:03:10 +02:00
bors
5b15923026 Auto merge of #26909 - rick68:patch-10, r=dotdash
fix typos
2015-07-09 12:57:17 +00:00
bors
f11502cda8 Auto merge of #26904 - bluss:no-repeat, r=alexcrichton
In a followup to PR #26849, improve one more location for I/O where
we can use `Vec::resize` to ensure better performance when zeroing
buffers.

Use the `vec![elt; n]` macro everywhere we can in the tree. It replaces
`repeat(elt).take(n).collect()` which is more verbose, requires type
hints, and right now produces worse code. `vec![]` is preferable for vector
initialization.

The `vec![]` replacement touches upon one I/O path too, Stdin::read
for windows, and that should be a small improvement.

r? @alexcrichton
2015-07-09 10:36:41 +00:00
Ulrik Sverdrup
836f32e769 Use vec![elt; n] where possible
The common pattern `iter::repeat(elt).take(n).collect::<Vec<_>>()` is
exactly equivalent to `vec![elt; n]`, do this replacement in the whole
tree.

(Actually, vec![] is smart enough to only call clone n - 1 times, while
the former solution would call clone n times, and this fact is
virtually irrelevant in practice.)
2015-07-09 11:05:32 +02:00
bors
517e087c16 Auto merge of #26899 - posix4e:netbsd, r=alexcrichton 2015-07-09 09:04:04 +00:00
Jesús Espino
74f42980e1 Add FileTypeUnix trait to add unix special file types 2015-07-09 10:31:28 +02:00
bors
9c3ba76389 Auto merge of #26885 - mvdnes:wrapping_div, r=alexcrichton
Resolves #26867
2015-07-09 07:13:14 +00:00
bors
66b9277b13 Auto merge of #26884 - dotdash:fast, r=alexcrichton
Exploiting the fact that getting the length of the slices is known, we
can use a counted loop instead of iterators, which means that we only
need a single counter, instead of having to increment and check one
pointer for each iterator.

Benchmarks comparing vectors with 100,000 elements:

Before:

```
running 8 tests
test eq1_u8  ... bench:      66,757 ns/iter (+/- 113)
test eq2_u16 ... bench:     111,267 ns/iter (+/- 149)
test eq3_u32 ... bench:     126,282 ns/iter (+/- 111)
test eq4_u64 ... bench:     126,418 ns/iter (+/- 155)
test ne1_u8  ... bench:      88,990 ns/iter (+/- 161)
test ne2_u16 ... bench:      89,126 ns/iter (+/- 265)
test ne3_u32 ... bench:      96,901 ns/iter (+/- 92)
test ne4_u64 ... bench:      96,750 ns/iter (+/- 137)
```

After:

```
running 8 tests
test eq1_u8  ... bench:      46,413 ns/iter (+/- 521)
test eq2_u16 ... bench:      46,500 ns/iter (+/- 74)
test eq3_u32 ... bench:      50,059 ns/iter (+/- 92)
test eq4_u64 ... bench:      54,001 ns/iter (+/- 92)
test ne1_u8  ... bench:      47,595 ns/iter (+/- 53)
test ne2_u16 ... bench:      47,521 ns/iter (+/- 59)
test ne3_u32 ... bench:      44,889 ns/iter (+/- 74)
test ne4_u64 ... bench:      47,775 ns/iter (+/- 68)
```
2015-07-09 05:15:48 +00:00
Wei-Ming Yang
a15c3c5ef5 Update intrinsics.rs
fix typos
2015-07-09 12:09:54 +08:00
bors
afe25a2d6a Auto merge of #26515 - quantheory:check_enum_recursion, r=nrc
Fixes #23302.

Note that there's an odd situation regarding the following, most likely due to some inadequacy in `const_eval`:

```rust
enum Y {
    A = 1usize,
    B,
}
```

In this case, `Y::B as usize` might be considered a constant expression in some cases, but not others.  (See #23513, for a related problem where there is only one variant, with no discriminant, and it doesn't behave nicely as a constant expression either.)

Most of the complexity in this PR is basically future-proofing, to ensure that when `Y::B as usize` is fully made to be a constant expression, it can't be used to set `Y::A`, and thus indirectly itself.
2015-07-09 03:41:22 +00:00
Sean Patrick Santos
b952c0e4e9 Add comments about the checks for recursive variant definition, as requested by @nrc. 2015-07-08 20:51:47 -06:00
bors
3198e1acf3 Auto merge of #26883 - retep998:download-more-ram, r=alexcrichton
Extension of https://github.com/rust-lang/rust/pull/26691

r? @alexcrichton
2015-07-09 01:49:25 +00:00
Nick Cameron
0c766cb8bc save-analysis: API-ify methods 2015-07-09 12:24:39 +12:00