```
error[E0502]: cannot borrow `*collection` as mutable because `collection` is also borrowed as immutable
--> $DIR/issue-42106.rs:13:5
|
12 | let _a = &collection;
| ---------- immutable borrow occurs here
13 | collection.swap(1, 2); //~ ERROR also borrowed as immutable
| ^^^^^^^^^^ mutable borrow occurs here
14 | }
| - immutable borrow ends here
error: aborting due to 2 previous errors
```
The number of errors do not match the diagnostics reported. This PR fixes this problem. The output is now in this case:
```
error[E0502]: cannot borrow `*collection` as mutable because `collection` is also borrowed as immutable
--> $DIR/issue-42106.rs:13:5
|
12 | let _a = &collection;
| ---------- immutable borrow occurs here
13 | collection.swap(1, 2); //~ ERROR also borrowed as immutable
| ^^^^^^^^^^ mutable borrow occurs here
14 | }
| - immutable borrow ends here
error: aborting due to previous error
```
Also, some other tests outputs have been adapted because their count didn't really match the number of diagnostics reported.
As an aside, an outdated comment has been removed (`Handler::cancel` will only call to the `Diagnostic::cancel` method and will not decrease the count of errors).
All tests are passing with this PR (`x.py test` is successful).
bors [Tue, 2 Jan 2018 11:22:40 +0000 (11:22 +0000)]
Auto merge of #47042 - redox-os:redox, r=estebank
Redox - Implement rename using new system call
This does the following:
- Update syscall module to match upstream
- Implement rename using new system call
- Make readlink and symlink utilize O_CLOEXEC
- Make readlink and symlink not leave dangling file handles on failure
bors [Tue, 2 Jan 2018 08:34:27 +0000 (08:34 +0000)]
Auto merge of #47111 - rkruppe:repr-transparent, r=estebank
Check all repr hints together when checking for mis-applied attributes
Fixes #47094
Besides fixing that bug, this change has a user-visible effect on the spans in the "incompatible repr hints" warning and another error: they now point at `foo` and/or `bar` in `repr(foo, bar)` instead of the whole attribute. This is sometimes more precise (e.g., `#[repr(C, packed)]` on an enum points at the `packed`) but sometimes not. I moved a compile-fail test to a ui test to illustrate how it now looks in the common case of only one attribute.
bors [Tue, 2 Jan 2018 00:31:07 +0000 (00:31 +0000)]
Auto merge of #47106 - EdSchouten:compiletest-cloudabi, r=alexcrichton
Tiny fixes to make compiletest work for CloudABI cross builds
I'm currently working toward getting a `src/ci/docker` container working to do isolated/automated builds and testing of `x86_64-unknown-cloudabi`. This is working pretty well, but still requires some fixes to `libtest` and `compiletest`. Here is the first set of fixes that I had to apply.
Robin Kruppe [Mon, 1 Jan 2018 20:42:12 +0000 (21:42 +0100)]
Check all repr hints together when checking for mis-applied attributes
Fixes #47094
Besides fixing that bug, this change has a user-visible effect on the spans in the "incompatible repr hints" warning and another error: they now point at `foo` and/or `bar` in `repr(foo, bar)` instead of the whole attribute. This is sometimes more precise (e.g., `#[repr(C, packed)]` on an enum points at the `packed`) but sometimes not. I moved a compile-fail test to a ui test to illustrate how it now looks in the common case of only one attribute.
Ed Schouten [Mon, 1 Jan 2018 18:30:19 +0000 (19:30 +0100)]
Move the TestPaths structure from libtest to compiletest.
This structure doesn't seem to be used by libtest itself. It is used by
compiletest, but never passed on to anything externally. This makes it
easier to get the testing framework to work for CloudABI crossbuilds, as
CloudABI currently lacks PathBuf, which is used by TestPaths.
bors [Mon, 1 Jan 2018 16:22:26 +0000 (16:22 +0000)]
Auto merge of #46278 - MaloJaffre:ci-compiler-docs, r=kennytm
Add compiler docs testing to CI.
Fixes #47025.
I don't know if `x86_64-gnu` is the right builder for this, but there seems to be time left on [Travis](https://travis-ci.org/rust-lang/rust/jobs/307488864).
Remaining problems blocking this PR:
- [x] broken links caused by rustdoc issues:
- [x] `pub use self::Enum::...`: #46766 and #46767 (fixed by #47050, thanks @ollie27!)
- [x] `impl Deref for DerefToStdType`: #32129 (ignored in linkchecker)
- [x] `#[feature(decl_macro)]` and `use std::vec`: #47038 (ignored in linkchecker)
- [x] `rustc_data_structures::sync::{Lrc, RwLock}` aliases `std` types: #32130 (ignored in linkchecker)
- [x] markdown differences, in rust repository and in external crates, now failing the build with #46880 merged (all fixed)
- [x] multiple crate updates needed: `rand`, `log`, `parking_lot_core`, `flate2`
- [x] submodule updates needed to deduplicate dependencies: `rust-installer`, ~`cargo`~ (done by #47052)
- [x] #44953 test broken by `log` update (removed, this can be controversial)
- [x] Waiting `x86_64-gnu` build results ([done](https://travis-ci.org/rust-lang/rust/builds/323451069))
Malo Jaffré [Fri, 29 Dec 2017 10:24:38 +0000 (11:24 +0100)]
Update crates and submodules to pull doc fixes
Update `rand` crate to `0.3.19`.
Update `log` crate to `0.3.9` and `0.4.1`.
Update `parking_lot_core` crate to `0.2.9`.
Upgrade all flate2 dependencies to `1.0.1`.
- Update `rust-installer` submodule.
Malo Jaffré [Sat, 30 Dec 2017 18:58:37 +0000 (19:58 +0100)]
Remove a test blocking the update of the `log` crate
It tested #44953.
`log` macros in newer versions are no longer recursive, so these duplicated
error messages (about unstable feature uses) previously occurring at each
level of recursion are no longer possible, even with the fix by #45540.
Furthermore this test breaks when multiple versions of `log` are in the
sysroot (`log 0.3.9` depends on`log 0.4.1`)
bors [Mon, 1 Jan 2018 12:51:54 +0000 (12:51 +0000)]
Auto merge of #47098 - estebank:immutable-field, r=nagisa
Reword trying to operate in immutable fields
The previous message ("cannot assign/mutably borrow immutable field")
when trying to modify a field of an immutable binding gave the
(incorrect) impression that fields can be mutable independently of their
ADT's binding. Slightly reword the message to read "cannot
assign/mutably borrow field of immutable binding".
bors [Mon, 1 Jan 2018 04:09:51 +0000 (04:09 +0000)]
Auto merge of #47064 - kennytm:force-trailing-newlines, r=estebank
Add a tidy check for missing or too many trailing newlines.
I've noticed recently there are lots of review comments requesting to fix trailing newlines. If this is going to be an official style here, it's better to let the CI do this repetitive check.
bors [Mon, 1 Jan 2018 01:00:24 +0000 (01:00 +0000)]
Auto merge of #47052 - fschutt:master, r=estebank
Improved error messages for linking failure
Partial fix for #46998
It's unnecessary to print the linker options if there is no linker installed in the first place. Currently, for libraries, the output is still printed, but that should be cleaned up in the future. If you don't have gcc or g++ installed, so that no linker is installed on the system, the output is now this:
```
$ ./rustc hello.rs
error: linker `cc` not found
|
= note: No such file or directory (os error 2)
error: aborting due to previous error
```
For libraries, the linker arguments are still printed, but they should be cleaned up in further commits.
Esteban Küber [Sun, 31 Dec 2017 23:32:41 +0000 (15:32 -0800)]
Reword trying to operate in immutable fields
The previous message ("cannot assign/mutably borrow immutable field")
when trying to modify a field of an immutable binding gave the
(incorrect) impression that fields can be mutable independently of their
ADT's binding. Slightly reword the message to read "cannot
assign/mutably borrow field of immutable binding".
bors [Sun, 31 Dec 2017 22:21:20 +0000 (22:21 +0000)]
Auto merge of #47089 - EdSchouten:cloudabi-is-not-unix, r=kennytm
Don't announce CloudABI as being UNIX.
This was originally brought in, because the definitions are based on
those of FreeBSD, Linux, etc. Even though CloudABI is based on POSIX, it
uses a subset that is so small that it's not reasonable to call it POSIX.
Now that I'm porting libstd, I'm running into some spots where I have to
explicitly disable code paths that were enabled by cfg(unix).
Felix Schütt [Thu, 28 Dec 2017 19:05:33 +0000 (20:05 +0100)]
Removed unnecessary output of linker options when linker is not installed
It's unnecessary to print the linker options if there is no linker installed.
Currently, for libraries, the output is still printed, see #46998 for
discussion
bors [Sun, 31 Dec 2017 19:25:05 +0000 (19:25 +0000)]
Auto merge of #47072 - EdSchouten:cloudabi-jemalloc, r=kennytm
Add CloudABI to the list of systems on which we stub out alloc_jemalloc.
The official jemalloc sources don't build cleanly on CloudABI yet, for
the reason that some of its tracing frameworks try to access the global
filesystem namespace, which CloudABI doesn't provide.
Always make use of the malloc implementation used by the C library,
which already happens to be jemalloc with some tiny build fixes.
Ed Schouten [Sun, 31 Dec 2017 10:14:38 +0000 (11:14 +0100)]
Don't announce CloudABI as being UNIX.
This was originally brought in, because the definitions are based on
those of FreeBSD, Linux, etc. Even though CloudABI is based on POSIX, it
uses a subset that is so small that it's not reasonable to call it POSIX.
Now that I'm porting libstd, I'm running into some spots where I have to
explicitly disable code paths that were enabled by cfg(unix).
bors [Sat, 30 Dec 2017 19:38:24 +0000 (19:38 +0000)]
Auto merge of #47063 - kennytm:gate-tools-on-update, r=alexcrichton
Requires tools to test-pass if the corresponding submodule is updated.
Follow up of #46554. Breaking a tool would not stop bors from accepting a merge, but this also means when we intend to *fix* a tool but failed, bors will *still* accept the PR. This behavior is not helpful to the tool maintainers.
This PR attempts to fix this by rejecting the tool-update merge when a tool failed. It recognizes a PR as "tool-updating" when the corresponding submodule is changed, compared with the previous commit.
kennytm [Fri, 29 Dec 2017 16:05:15 +0000 (00:05 +0800)]
Requires tools to test-pass if the corresponding submodule is updated.
If a PR intends to update a tool but its test has failed, abort the merge
regardless of current channel. This should help the tool maintainers if the
update turns out to be failing due to changes in latest master.
Ed Schouten [Sat, 30 Dec 2017 09:00:35 +0000 (10:00 +0100)]
Add CloudABI to the list of systems on which we stub out alloc_jemalloc.
The official jemalloc sources don't build cleanly on CloudABI yet, for
the reason that some of its tracing frameworks try to access the global
filesystem namespace, which CloudABI doesn't provide.
Always make use of the malloc implementation used by the C library,
which already happens to be jemalloc with some tiny build fixes.
bors [Fri, 29 Dec 2017 14:02:32 +0000 (14:02 +0000)]
Auto merge of #47051 - Xanewok:update-rls, r=kennytm
Update RLS and Rustfmt
Essentially https://github.com/rust-lang/rust/pull/46929 with only RLS update that fixes the build.
The rls wasn't included in the recent nightlies and a lot of people have been wondering what to do about it, so it'd be good to include the RLS back with the nightly builds as soon as we can.
bors [Fri, 29 Dec 2017 03:23:37 +0000 (03:23 +0000)]
Auto merge of #46883 - QuietMisdreavus:faildown, r=GuillaumeGomez
rustdoc: add option to abort the process on markdown differences
In the efforts of keeping the std docs free of markdown warnings, this PR adds a stopgap measure to make sure the CI fails if it detects a markdown difference. It does this by adding a new unstable flag to rustdoc, `--deny-render-differences`, which bootstrap then passes to rustdoc when documenting std and friends.
The implementation is... probably not the cleanest option. It currently adds an extra branch after it prints the markdown warnings, which just prints a final line and calls `::std::process::abort(1)`. I did it like this because if it just panics regularly, it looks like an ICE, an even though `html::render::run` returns a Result, that Result is also just `expect`ed immediately, generating the same problem. This way bypasses the panic handler at the top of the thread and looks like a proper failure. Since i don't have a real error Handler there, this is the best i can do without pulling in a real error system for rustdoc.
This PR is blocked on https://github.com/rust-lang/rust/pull/46853, which will fix the rendering differences that were present on master when i started this branch.
bors [Thu, 28 Dec 2017 19:06:39 +0000 (19:06 +0000)]
Auto merge of #47036 - QuietMisdreavus:i-like-big-chars, r=frewsxcv
update char_indices example to highlight big chars
There was a comment today in IRC where someone thought `char_indices()` and `chars().enumerate()` were equivalent, so i wanted to put an example in the docs where that wasn't true.
Michael Hewson [Wed, 10 May 2017 00:30:47 +0000 (00:30 +0000)]
Resurrecting #33135
Started rebasing @sgrif's PR #33135 off of current master. (Well, actually merging it into a new branch based off current master.)
The following files still need to be fixed or at least reviewed:
- `src/libsyntax/ext/tt/macro_parser.rs`: calls `Parser::parse_lifetime`, which doesn't exist anymore
- `src/libsyntax/parse/parser.rs`: @sgrif added an error message to `Parser::parse_lifetime`. Code has since been refactored, so I just took it out for now.
- `src/libsyntax/ext/tt/transcribe.rs`: This code has been refactored bigtime. Not sure whether @sgrif's changes here are still necessary. Took it out for this commit.
bors [Thu, 28 Dec 2017 04:13:24 +0000 (04:13 +0000)]
Auto merge of #47018 - malbarbo:armv4t, r=alexcrichton
Add armv4t-unknown-linux-gnueabi target
armv4t was left out of https://github.com/rust-lang/rust/pull/37615 (armv5te addition) to be included in a [future PR](https://github.com/rust-lang/rust/pull/37615#issuecomment-259189758). So this PR adds armv4t target.
armv4t target is useful because the [armel](https://wiki.debian.org/ArmEabiPort) port of Debian targets armv4t
bors [Wed, 27 Dec 2017 22:39:00 +0000 (22:39 +0000)]
Auto merge of #47016 - malbarbo:dist-armv5te, r=alexcrichton
Add dist builder for armv5te-unknown-linux-gnueabi (again)
The dist builder was first add in https://github.com/rust-lang/rust/pull/46498 and later remove in https://github.com/rust-lang/rust/pull/46498 because of https://github.com/rust-lang/rust/issues/46822.
https://github.com/rust-lang/rust/issues/46822 seems to be fixed now (I and @green-s have [tested](https://github.com/rust-lang/rust/pull/46498#issuecomment-353901216) it).
bors [Wed, 27 Dec 2017 12:54:25 +0000 (12:54 +0000)]
Auto merge of #47009 - eddyb:issue-46855, r=arielb1
rustc_trans: support ZST indexing involving uninhabited types.
Fixes #46855 in a minimal way. I decided against supporting non-memory `Rvalue::Len` in this PR (see https://github.com/rust-lang/rust/issues/46855#issuecomment-352965807), as `PlaceContext::Inspect` is also used for `Rvalue::Discriminant`.
bors [Wed, 27 Dec 2017 10:19:43 +0000 (10:19 +0000)]
Auto merge of #47007 - eddyb:issue-46897, r=arielb1
rustc: don't use union layouts for tagged union enums.
Fixes #46897, fixes #43517 (AFAICT from the testcases).
This PR doesn't add any testcases, we should try to at least get perf ones (cc @Mark-Simulacrum).
I couldn't find an example in those issues where the choice of LLVM array vs struct (with N identical fields) for padding filler types is still needed, *on top of* this change, to prevent excessive LLVM sinking.
bors [Tue, 26 Dec 2017 20:47:31 +0000 (20:47 +0000)]
Auto merge of #46975 - matthewjasper:mir-moveck-asm, r=arielb1
[MIR Borrowck] Moveck inline asm statements
Closes #45695
New behavior:
* Input operands to `asm!` are moved, direct output operands are initialized.
* Direct, non-read-write outputs match the assignment changes in #46752 (Shallow writes, end borrows).