Commit Graph

44334 Commits

Author SHA1 Message Date
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
Steven Fackler
0bcbd16931 Change tuple Debug impls to use builders 2015-07-08 23:38:42 -07: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
Esption
dad8cd19d3 'iff' for docs to 'if and only if' 2015-07-08 21:17:13 -05: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
Nick Cameron
df5a1ca880 save-analysis: factor out helper method 2015-07-09 12:24:39 +12:00
Nick Cameron
f28f79b796 Fix a span bug for qualified paths 2015-07-09 12:24:39 +12:00
Nick Cameron
374af4aea7 save-analysis: API-ify paths 2015-07-09 12:24:39 +12:00
Nick Cameron
84cb4ad969 Fix a bug where macros in expression position don't have expansion inidices in their spans 2015-07-09 12:24:39 +12:00
Nick Cameron
8ac0bce64e save-analysis: api-ify method calls 2015-07-09 12:24:39 +12:00
bors
16f64c3880 Auto merge of #26879 - GuillaumeGomez:patch-1, r=arielb1
Part of #24407.
r? @Manishearth
2015-07-09 00:16:56 +00:00
Ulrik Sverdrup
5b6a464358 io: Use Vec::resize in Cursor<Vec<u8>> for more efficient zero fill
Vec::resize compiles to better code than .extend(repeat(0).take(n)) does
right now.
2015-07-09 01:18:29 +02:00
bors
9f26f14dc9 Auto merge of #26869 - alexcrichton:fix-msvc-sepcomp, r=nrc
This commit alters the implementation of multiple codegen units slightly to be
compatible with the MSVC linker. Currently the implementation will take the N
object files created by each codegen unit and will run `ld -r` to create a new
object file which is then passed along. The MSVC linker, however, is not able to
do this operation.

The compiler will now no longer attempt to assemble object files together but
will instead just pass through all the object files as usual. This implies that
rlibs may not contain more than one object file (if the library is compiled with
more than one codegen unit) and the output of `-C save-temps` will have changed
slightly as object files with the extension `0.o` will not be renamed to `o`
unless requested otherwise.
2015-07-08 22:45:19 +00:00
Alex Crichton
9bc8e6d147 trans: Link rlibs to dylibs with --whole-archive
This commit starts passing the `--whole-archive` flag (`-force_load` on OSX) to
the linker when linking rlibs into dylibs. The primary purpose of this commit is
to ensure that the linker doesn't strip out objects from an archive when
creating a dynamic library. Information on how this can go wrong can be found in
issues #14344 and #25185.

The unfortunate part about passing this flag to the linker is that we have to
preprocess the rlib to remove the metadata and compressed bytecode found within.
This means that creating a dylib will now take longer to link as we've got to
copy around the input rlibs to a temporary location, modify them, and then
invoke the linker. This isn't done for executables, however, so the "hello
world" compile time is not affected.

This fix was instigated because of the previous commit where rlibs may not
contain multiple object files instead of one due to codegen units being greater
than one. That change prevented the main distribution from being compiled with
more than one codegen-unit and this commit fixes that.

Closes #14344
Closes #25185
2015-07-08 15:24:23 -07:00
Alex HotShot Newman
830e82df14 Update the installer to support netbsd 2015-07-08 14:18:27 -07:00
bors
020d201a66 Auto merge of #26849 - bluss:read-to-end-memset, r=alexcrichton
Improve zerofill in Vec::resize and Read::read_to_end

We needed a more efficient way to zerofill the vector in read_to_end.
This to reduce the memory intialization overhead to a minimum.

Use the implementation of `std::vec::from_elem` (used for the vec![]
macro) for Vec::resize as well. For simple element types like u8, this
compiles to memset, so it makes Vec::resize much more efficient.
2015-07-08 21:12:54 +00:00
Tobias Bucher
c8a5b1368e Make std::env::current_dir work for path names longer than 2048 bytes on non-Windows 2015-07-08 21:38:10 +02:00
bors
15952ac6cf Auto merge of #26894 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #26687, #26784, #26850, #26889, #26891, #26892, #26893
- Failed merges:
2015-07-08 19:26:30 +00:00
Ulrik Sverdrup
a5cc17adaa io: Simplify BufReader::with_capacity
Use the vec![] macro directly to create a sized, zeroed vector.

This should result in a big speedup when creating BufReader, because
vec![0; cap] compiles to a memset call, while the previous extend code
currently did not.
2015-07-08 19:40:40 +02:00
Ulrik Sverdrup
6ac0ba3c3a Improve Vec::resize so that it can be used in Read::read_to_end
We needed a more efficient way to zerofill the vector in read_to_end.
This to reduce the memory intialization overhead to a minimum.

Use the implementation of `std::vec::from_elem` (used for the vec![]
macro) for Vec::resize as well. For simple element types like u8, this
compiles to memset, so it makes Vec::resize much more efficient.
2015-07-08 19:40:40 +02:00
Guillaume Gomez
6f01aa0fc8 Add E0232 error explanation 2015-07-08 18:05:18 +02:00