]> git.lizzy.rs Git - rust.git/log
rust.git
8 years agoMove rounding discussion to integer Div/Rem impls
William Throwe [Mon, 13 Jul 2015 00:28:16 +0000 (20:28 -0400)]
Move rounding discussion to integer Div/Rem impls

8 years agoCorrect and clarify integer division rounding docs
William Throwe [Sun, 12 Jul 2015 00:30:50 +0000 (20:30 -0400)]
Correct and clarify integer division rounding docs

8 years agoAuto merge of #26961 - Manishearth:rollup, r=Manishearth
bors [Sat, 11 Jul 2015 07:40:27 +0000 (07:40 +0000)]
Auto merge of #26961 - Manishearth:rollup, r=Manishearth

- Successful merges: #26932, #26936, #26943, #26944
- Failed merges:

8 years agoRollup merge of #26944 - rick68:patch-11, r=brson
Manish Goregaokar [Sat, 11 Jul 2015 13:10:13 +0000 (18:40 +0530)]
Rollup merge of #26944 - rick68:patch-11, r=brson

fix typos

8 years agoRollup merge of #26943 - brson:installer, r=alexcrichton
Manish Goregaokar [Sat, 11 Jul 2015 13:10:13 +0000 (18:40 +0530)]
Rollup merge of #26943 - brson:installer, r=alexcrichton

8 years agoRollup merge of #26936 - bluss:doc-array, r=steveklabnik
Manish Goregaokar [Sat, 11 Jul 2015 13:10:13 +0000 (18:40 +0530)]
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.

8 years agoRollup merge of #26932 - tsurai:master, r=steveklabnik
Manish Goregaokar [Sat, 11 Jul 2015 13:10:13 +0000 (18:40 +0530)]
Rollup merge of #26932 - tsurai:master, r=steveklabnik

Simple adjustment to auto select the nightly channel for examples using unstable feature.

8 years agoAuto merge of #26903 - steveklabnik:io_function_docs, r=alexcricthon
bors [Sat, 11 Jul 2015 04:44:55 +0000 (04:44 +0000)]
Auto merge of #26903 - steveklabnik:io_function_docs, r=alexcricthon

This round: io::Result and the free functions.

8 years agoAuto merge of #26945 - steveklabnik:doc_io_bufreader, r=alexcrichton
bors [Sat, 11 Jul 2015 03:10:11 +0000 (03:10 +0000)]
Auto merge of #26945 - steveklabnik:doc_io_bufreader, r=alexcrichton

Mostly just adding basic examples, what's there seems mostly good.

r? @alexcrichton

8 years agoAuto merge of #26929 - alexcrichton:windows-dir-junction, r=brson
bors [Sat, 11 Jul 2015 01:35:30 +0000 (01:35 +0000)]
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

8 years agoAuto merge of #26941 - fhartwig:osx-file-debug, r=alexcrichton
bors [Sat, 11 Jul 2015 00:01:51 +0000 (00:01 +0000)]
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.

8 years agoMore docs for std::io::BufReader
Steve Klabnik [Fri, 10 Jul 2015 20:47:48 +0000 (16:47 -0400)]
More docs for std::io::BufReader

8 years agoAuto merge of #26926 - alexcrichton:llvm-archive-writer, r=brson
bors [Fri, 10 Jul 2015 20:18:30 +0000 (20:18 +0000)]
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`.

8 years agoUpdate boxed.rs
Wei-Ming Yang [Fri, 10 Jul 2015 19:50:32 +0000 (03:50 +0800)]
Update boxed.rs

fix typos

8 years agoUpgrade rust-installer. Fixes install on Fedora-based Linuxes.
Brian Anderson [Fri, 10 Jul 2015 17:41:55 +0000 (10:41 -0700)]
Upgrade rust-installer. Fixes install on Fedora-based Linuxes.

8 years agoAuto merge of #26896 - tbu-:pr_getcwd, r=alexcrichton
bors [Fri, 10 Jul 2015 16:26:19 +0000 (16:26 +0000)]
Auto merge of #26896 - tbu-:pr_getcwd, r=alexcrichton

(On Windows, it works already.)

8 years agotrans: Use LLVM's writeArchive to modify archives
Alex Crichton [Thu, 9 Jul 2015 07:14:20 +0000 (00:14 -0700)]
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`.

8 years agostd: Consider directory junctions as directories
Alex Crichton [Thu, 9 Jul 2015 17:45:40 +0000 (10:45 -0700)]
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

8 years agoAuto merge of #26928 - reem:cstr-is-a-cow, r=Gankro
bors [Fri, 10 Jul 2015 14:52:48 +0000 (14:52 +0000)]
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.

8 years agoAdd more std::io documentation.
Steve Klabnik [Wed, 8 Jul 2015 22:31:08 +0000 (18:31 -0400)]
Add more std::io documentation.

This round: io::Result and the free functions.

8 years agoShow file name and access mode in Debug instance for File on OS X
Florian Hartwig [Fri, 10 Jul 2015 14:23:14 +0000 (16:23 +0200)]
Show file name and access mode in Debug instance for File on OS X

8 years agoSmall tweaks for the documentation of the primitive type array
Ulrik Sverdrup [Fri, 10 Jul 2015 12:50:35 +0000 (14:50 +0200)]
Small tweaks for the documentation of the primitive type array

8 years agoAuto merge of #26919 - alexcrichton:msvc-turn-off-unwinding, r=brson
bors [Fri, 10 Jul 2015 12:40:25 +0000 (12:40 +0000)]
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

8 years agoAuto merge of #26751 - retep998:copy-that-floppy, r=alexcrichton
bors [Fri, 10 Jul 2015 11:07:25 +0000 (11:07 +0000)]
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

8 years agoRemove the generic `fill_bytes_buf` function
Tobias Bucher [Fri, 10 Jul 2015 10:33:10 +0000 (12:33 +0200)]
Remove the generic `fill_bytes_buf` function

8 years agoAuto merge of #26613 - brson:relnotes, r=alexcrichton
bors [Fri, 10 Jul 2015 09:16:38 +0000 (09:16 +0000)]
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.

8 years agoUse CopyFileEx for fs::copy on Windows
Peter Atashian [Fri, 10 Jul 2015 08:54:00 +0000 (04:54 -0400)]
Use CopyFileEx for fs::copy on Windows
Adds a couple more tests for fs::copy

Signed-off-by: Peter Atashian <retep998@gmail.com>
8 years agodoc: set playground to nightly for unstable code
Cristian Kubis [Fri, 10 Jul 2015 07:40:44 +0000 (09:40 +0200)]
doc: set playground to nightly for unstable code

9 years agoAuto merge of #26907 - nrc:save-fns, r=brson
bors [Fri, 10 Jul 2015 00:47:35 +0000 (00:47 +0000)]
Auto merge of #26907 - nrc:save-fns, r=brson

r? @huonw

9 years agoTest that CStr and CString have equivalent hashes.
Jonathan Reem [Fri, 10 Jul 2015 00:33:00 +0000 (17:33 -0700)]
Test that CStr and CString have equivalent hashes.

9 years agoImplement Borrow<CStr> for CString and ToOwned for CStr
Jonathan Reem [Thu, 9 Jul 2015 23:38:55 +0000 (16:38 -0700)]
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.

9 years agoUpdate RELEASES.md for 1.2
Brian Anderson [Thu, 9 Jul 2015 21:34:30 +0000 (14:34 -0700)]
Update RELEASES.md for 1.2

9 years agoUpdate AUTHORS.txt for 1.2
Brian Anderson [Thu, 9 Jul 2015 21:44:44 +0000 (14:44 -0700)]
Update AUTHORS.txt for 1.2

9 years agoAuto merge of #26923 - bluss:doc-array, r=alexcrichton
bors [Thu, 9 Jul 2015 21:52:43 +0000 (21:52 +0000)]
Auto merge of #26923 - bluss:doc-array, r=alexcrichton

Expand documentation for the primitive type array

9 years agoExpand documentation for the primitive type array
Ulrik Sverdrup [Thu, 9 Jul 2015 20:43:12 +0000 (22:43 +0200)]
Expand documentation for the primitive type array

9 years agoRevert "msvc: Enable landing pads by default"
Alex Crichton [Thu, 9 Jul 2015 16:50:08 +0000 (09:50 -0700)]
Revert "msvc: Enable landing pads by default"

This reverts commit f9de964ccf767498ed7b1b4a879aaca1777a9d3d.

Conflicts:
src/librustc_trans/trans/base.rs

9 years agoAuto merge of #26766 - jespino:add-more-filetypes, r=alexcrichton
bors [Thu, 9 Jul 2015 16:38:00 +0000 (16:38 +0000)]
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.

9 years agoAuto merge of #26814 - tshepang:array-examples, r=bluss
bors [Thu, 9 Jul 2015 14:50:32 +0000 (14:50 +0000)]
Auto merge of #26814 - tshepang:array-examples, r=bluss

9 years agoAddress some comments on the pull request
Tobias Bucher [Thu, 9 Jul 2015 13:03:10 +0000 (15:03 +0200)]
Address some comments on the pull request

9 years agoAuto merge of #26909 - rick68:patch-10, r=dotdash
bors [Thu, 9 Jul 2015 12:57:17 +0000 (12:57 +0000)]
Auto merge of #26909 - rick68:patch-10, r=dotdash

fix typos

9 years agoAuto merge of #26904 - bluss:no-repeat, r=alexcrichton
bors [Thu, 9 Jul 2015 10:36:41 +0000 (10:36 +0000)]
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

9 years agoUse vec![elt; n] where possible
Ulrik Sverdrup [Wed, 8 Jul 2015 20:52:55 +0000 (22:52 +0200)]
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.)

9 years agoAuto merge of #26899 - posix4e:netbsd, r=alexcrichton
bors [Thu, 9 Jul 2015 09:04:04 +0000 (09:04 +0000)]
Auto merge of #26899 - posix4e:netbsd, r=alexcrichton

9 years agoAdd FileTypeUnix trait to add unix special file types
Jesús Espino [Sun, 5 Jul 2015 21:16:25 +0000 (23:16 +0200)]
Add FileTypeUnix trait to add unix special file types

9 years agoAuto merge of #26885 - mvdnes:wrapping_div, r=alexcrichton
bors [Thu, 9 Jul 2015 07:13:14 +0000 (07:13 +0000)]
Auto merge of #26885 - mvdnes:wrapping_div, r=alexcrichton

Resolves #26867

9 years agoAuto merge of #26884 - dotdash:fast, r=alexcrichton
bors [Thu, 9 Jul 2015 05:15:48 +0000 (05:15 +0000)]
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)
```

9 years agoUpdate intrinsics.rs
Wei-Ming Yang [Thu, 9 Jul 2015 04:09:54 +0000 (12:09 +0800)]
Update intrinsics.rs

fix typos

9 years agoAuto merge of #26515 - quantheory:check_enum_recursion, r=nrc
bors [Thu, 9 Jul 2015 03:41:22 +0000 (03:41 +0000)]
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.

9 years agoAdd comments about the checks for recursive variant definition, as requested by ...
Sean Patrick Santos [Thu, 9 Jul 2015 02:51:47 +0000 (20:51 -0600)]
Add comments about the checks for recursive variant definition, as requested by @nrc.

9 years agoAuto merge of #26883 - retep998:download-more-ram, r=alexcrichton
bors [Thu, 9 Jul 2015 01:49:25 +0000 (01:49 +0000)]
Auto merge of #26883 - retep998:download-more-ram, r=alexcrichton

Extension of https://github.com/rust-lang/rust/pull/26691

r? @alexcrichton

9 years agosave-analysis: API-ify methods
Nick Cameron [Thu, 9 Jul 2015 00:23:29 +0000 (12:23 +1200)]
save-analysis: API-ify methods

9 years agosave-analysis: factor out helper method
Nick Cameron [Wed, 8 Jul 2015 08:54:45 +0000 (20:54 +1200)]
save-analysis: factor out helper method

9 years agoFix a span bug for qualified paths
Nick Cameron [Wed, 8 Jul 2015 05:47:27 +0000 (17:47 +1200)]
Fix a span bug for qualified paths

9 years agosave-analysis: API-ify paths
Nick Cameron [Wed, 8 Jul 2015 02:30:18 +0000 (14:30 +1200)]
save-analysis: API-ify paths

9 years agoFix a bug where macros in expression position don't have expansion inidices in their...
Nick Cameron [Wed, 8 Jul 2015 02:29:43 +0000 (14:29 +1200)]
Fix a bug where macros in expression position don't have expansion inidices in their spans

9 years agosave-analysis: api-ify method calls
Nick Cameron [Mon, 6 Jul 2015 23:42:43 +0000 (11:42 +1200)]
save-analysis: api-ify method calls

9 years agoAuto merge of #26879 - GuillaumeGomez:patch-1, r=arielb1
bors [Thu, 9 Jul 2015 00:16:56 +0000 (00:16 +0000)]
Auto merge of #26879 - GuillaumeGomez:patch-1, r=arielb1

Part of #24407.
r? @Manishearth

9 years agoio: Use Vec::resize in Cursor<Vec<u8>> for more efficient zero fill
Ulrik Sverdrup [Wed, 8 Jul 2015 20:52:06 +0000 (22:52 +0200)]
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.

9 years agoAuto merge of #26869 - alexcrichton:fix-msvc-sepcomp, r=nrc
bors [Wed, 8 Jul 2015 22:45:19 +0000 (22:45 +0000)]
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.

9 years agotrans: Link rlibs to dylibs with --whole-archive
Alex Crichton [Wed, 8 Jul 2015 04:33:44 +0000 (21:33 -0700)]
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

9 years agoUpdate the installer to support netbsd
Alex HotShot Newman [Wed, 8 Jul 2015 21:18:27 +0000 (14:18 -0700)]
Update the installer to support netbsd

9 years agoAuto merge of #26849 - bluss:read-to-end-memset, r=alexcrichton
bors [Wed, 8 Jul 2015 21:12:54 +0000 (21:12 +0000)]
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.

9 years agoMake `std::env::current_dir` work for path names longer than 2048 bytes on non-Windows
Tobias Bucher [Wed, 8 Jul 2015 19:36:46 +0000 (21:36 +0200)]
Make `std::env::current_dir` work for path names longer than 2048 bytes on non-Windows

9 years agoAuto merge of #26894 - steveklabnik:rollup, r=steveklabnik
bors [Wed, 8 Jul 2015 19:26:30 +0000 (19:26 +0000)]
Auto merge of #26894 - steveklabnik:rollup, r=steveklabnik

- Successful merges: #26687, #26784, #26850, #26889, #26891, #26892, #26893
- Failed merges:

9 years agoio: Simplify BufReader::with_capacity
Ulrik Sverdrup [Wed, 8 Jul 2015 01:20:00 +0000 (03:20 +0200)]
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.

9 years agoImprove Vec::resize so that it can be used in Read::read_to_end
Ulrik Sverdrup [Tue, 7 Jul 2015 11:50:23 +0000 (13:50 +0200)]
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.

9 years agoAdd E0232 error explanation
Guillaume Gomez [Wed, 8 Jul 2015 12:28:14 +0000 (14:28 +0200)]
Add E0232 error explanation

9 years agoAdd E0220 error explanation
Guillaume Gomez [Wed, 8 Jul 2015 11:04:12 +0000 (13:04 +0200)]
Add E0220 error explanation

9 years agoRollup merge of #26893 - dhuseby:fixing_freebsd_tests, r=alexcrichton
Steve Klabnik [Wed, 8 Jul 2015 14:34:27 +0000 (10:34 -0400)]
Rollup merge of #26893 - dhuseby:fixing_freebsd_tests, r=alexcrichton

9 years agothis fixes the test failures on freebsd
Dave Huseby [Wed, 8 Jul 2015 17:31:27 +0000 (10:31 -0700)]
this fixes the test failures on freebsd

9 years agoRollup merge of #26892 - steveklabnik:gh26482, r=alexcrichton
Steve Klabnik [Wed, 8 Jul 2015 14:34:27 +0000 (10:34 -0400)]
Rollup merge of #26892 - steveklabnik:gh26482, r=alexcrichton

We weren't explicit enough about Cargo's default version behavior.

For rust-lang/rust at least,

Fixes #26482

9 years agoTRPL: make version constraits explicit
Steve Klabnik [Wed, 8 Jul 2015 17:09:22 +0000 (13:09 -0400)]
TRPL: make version constraits explicit

We weren't explicit enough about Cargo's default version behavior.

For rust-lang/rust at least,

Fixes #26482

9 years agoRollup merge of #26891 - steveklabnik:gh26552, r=huonw
Steve Klabnik [Wed, 8 Jul 2015 14:34:27 +0000 (10:34 -0400)]
Rollup merge of #26891 - steveklabnik:gh26552, r=huonw

Added a proper Unsafety header, as well as mentioning that
the pointer shouldn't be null.

Fixes #26552

9 years agoFix up unsafe section of slice::from_raw_parts
Steve Klabnik [Wed, 8 Jul 2015 17:04:41 +0000 (13:04 -0400)]
Fix up unsafe section of slice::from_raw_parts

Added a proper Unsafety header, as well as mentioning that
the pointer shouldn't be null.

Fixes #26552

9 years agoRollup merge of #26889 - sanxiyn:fixme, r=alexcrichton
Steve Klabnik [Wed, 8 Jul 2015 14:34:26 +0000 (10:34 -0400)]
Rollup merge of #26889 - sanxiyn:fixme, r=alexcrichton

Fix #4951.

9 years agoRollup merge of #26850 - steveklabnik:more_format_docs, r=alexcrichton
Steve Klabnik [Wed, 8 Jul 2015 14:34:26 +0000 (10:34 -0400)]
Rollup merge of #26850 - steveklabnik:more_format_docs, r=alexcrichton

https://www.reddit.com/r/rust/comments/3ceaui/psa_produces_prettyprinted_debug_output/

9 years agoMake mention of alternate flags in std::fmt traits
Steve Klabnik [Tue, 7 Jul 2015 13:07:05 +0000 (09:07 -0400)]
Make mention of alternate flags in std::fmt traits

https://www.reddit.com/r/rust/comments/3ceaui/psa_produces_prettyprinted_debug_output/

9 years agoRollup merge of #26784 - birkenfeld:patch-2, r=steveklabnik
Steve Klabnik [Wed, 8 Jul 2015 14:34:26 +0000 (10:34 -0400)]
Rollup merge of #26784 - birkenfeld:patch-2, r=steveklabnik

* fix probable copy-paste error in BufWriter.get_mut()
* more consistent punctuation

9 years agoRollup merge of #26687 - christianweinz:patch-1, r=huonw
Steve Klabnik [Wed, 8 Jul 2015 14:34:26 +0000 (10:34 -0400)]
Rollup merge of #26687 - christianweinz:patch-1, r=huonw

The ‘_‘ wildcard does exactly not handle specific cases but all not specified ones.

9 years agoRemove a FIXME
Seo Sanghyeon [Wed, 8 Jul 2015 14:30:19 +0000 (23:30 +0900)]
Remove a FIXME

9 years agoUse wrapping_div call and correct the feature name
Mathijs van de Nes [Wed, 8 Jul 2015 13:44:50 +0000 (15:44 +0200)]
Use wrapping_div call and correct the feature name

9 years agoImplement Div for Wrapping<T>
Mathijs van de Nes [Wed, 8 Jul 2015 13:02:18 +0000 (15:02 +0200)]
Implement Div for Wrapping<T>

Resolves #26867

9 years agoImprove PartialEq for slices
Björn Steinbrink [Wed, 8 Jul 2015 12:49:55 +0000 (14:49 +0200)]
Improve PartialEq for slices

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)
```

9 years agoReport memory use in time-passes on Windows
Peter Atashian [Wed, 8 Jul 2015 12:29:41 +0000 (08:29 -0400)]
Report memory use in time-passes on Windows

Signed-off-by: Peter Atashian <retep998@gmail.com>
9 years agoAdd E0191 error explanation
Guillaume Gomez [Wed, 8 Jul 2015 10:57:48 +0000 (12:57 +0200)]
Add E0191 error explanation

9 years agoAuto merge of #26863 - brson:revert-stageversion, r=alexcrichton
bors [Wed, 8 Jul 2015 07:26:42 +0000 (07:26 +0000)]
Auto merge of #26863 - brson:revert-stageversion, r=alexcrichton

This reverts https://github.com/rust-lang/rust/pull/26599, which puts the stage number in the output of `--version -v`, but is not supposed to put it in the 'stage2' compiler, which is what most people refer to the binary we deploy.

The picture is not so clear though because of how stage 'promotions' happen in the build and also because the windows build deploys stage3, not stage2.

cc @richo

9 years agoAuto merge of #26859 - arielb1:const-deref-again, r=eddyb
bors [Wed, 8 Jul 2015 03:11:36 +0000 (03:11 +0000)]
Auto merge of #26859 - arielb1:const-deref-again, r=eddyb

Fixes #25901

r? @eddyb

9 years agomsvc: Get codegen-units working
Alex Crichton [Tue, 7 Jul 2015 01:21:57 +0000 (18:21 -0700)]
msvc: Get codegen-units working

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.

9 years agoAuto merge of #26861 - steveklabnik:rollup, r=steveklabnik
bors [Tue, 7 Jul 2015 21:28:54 +0000 (21:28 +0000)]
Auto merge of #26861 - steveklabnik:rollup, r=steveklabnik

- Successful merges: #26742, #26852, #26853, #26854, #26855, #26857
- Failed merges: #26796

9 years agoRevert "rustc_driver: Print stage info in --version --verbose"
Brian Anderson [Tue, 7 Jul 2015 17:54:06 +0000 (10:54 -0700)]
Revert "rustc_driver: Print stage info in --version --verbose"

This reverts commit 555b021c6e531fc375c62160a176dcc4fe77b798.

9 years agoRevert "rustc_driver: Omit stage info for stage2+"
Brian Anderson [Tue, 7 Jul 2015 17:53:54 +0000 (10:53 -0700)]
Revert "rustc_driver: Omit stage info for stage2+"

This reverts commit e66ac43ea4ca489486c5c5dc59974577449fad44.

9 years agoAuto merge of #26747 - huonw:stability-issue, r=alexcrichton
bors [Tue, 7 Jul 2015 17:41:43 +0000 (17:41 +0000)]
Auto merge of #26747 - huonw:stability-issue, r=alexcrichton

This takes an issue number and points people to it in the printed error
message. This commit does not make it an error to have no `issue` field.

9 years agomark user-defined derefs as non-constant
Ariel Ben-Yehuda [Tue, 7 Jul 2015 15:45:52 +0000 (18:45 +0300)]
mark user-defined derefs as non-constant

Fixes #25901

9 years agouse is_method_call rather than directly accessing the method_map
Ariel Ben-Yehuda [Tue, 7 Jul 2015 15:45:21 +0000 (18:45 +0300)]
use is_method_call rather than directly accessing the method_map

9 years agoRollup merge of #26857 - GuillaumeGomez:patch-1, r=steveklabnik
Steve Klabnik [Tue, 7 Jul 2015 13:49:56 +0000 (09:49 -0400)]
Rollup merge of #26857 - GuillaumeGomez:patch-1, r=steveklabnik

9 years agoAdd missing "```"
Guillaume Gomez [Tue, 7 Jul 2015 15:01:32 +0000 (17:01 +0200)]
Add missing "```"

9 years agoRollup merge of #26855 - steveklabnik:gh26344, r=alexcrichton
Steve Klabnik [Tue, 7 Jul 2015 13:49:56 +0000 (09:49 -0400)]
Rollup merge of #26855 - steveklabnik:gh26344, r=alexcrichton

Fixes #26344

9 years agoRollup merge of #26854 - steveklabnik:gh26345, r=alexcrichton
Steve Klabnik [Tue, 7 Jul 2015 13:49:56 +0000 (09:49 -0400)]
Rollup merge of #26854 - steveklabnik:gh26345, r=alexcrichton

I am not mentioning #[unsafe_drop_flag] because it should go away
eventually, and also because it's just an attribute, it's not
really a use of the `unsafe` keyword.

Fixes #26345

9 years agoRollup merge of #26853 - steveklabnik:gh26346, r=Gankro
Steve Klabnik [Tue, 7 Jul 2015 13:49:55 +0000 (09:49 -0400)]
Rollup merge of #26853 - steveklabnik:gh26346, r=Gankro

This incorrectly implied that doing things is fine in unsafe code

Fixes #26346

9 years agoRe-word UB in unsafe guide
Steve Klabnik [Tue, 7 Jul 2015 13:23:07 +0000 (09:23 -0400)]
Re-word UB in unsafe guide

This incorrectly implied that doing things is fine in unsafe code

Fixes #26346