Taylor Cramer [Thu, 4 Jan 2018 19:34:03 +0000 (11:34 -0800)]
Add transpose conversions for Option and Result
These impls are useful when working with combinator
methods that expect an option or a result, but you
have a Result<Option<T>, E> instead of an Option<Result<T, E>>
or vice versa.
bors [Thu, 4 Jan 2018 05:52:39 +0000 (05:52 +0000)]
Auto merge of #47124 - estebank:loan-paths, r=nikomatsakis
Reword reason for move note
On move errors, when encountering an enum variant, be more ambiguous and do not refer to the type on the cause note, to avoid referring to `(maybe as std::prelude::v1::Some).0`, and instead refer to `the value`.
Sidesteps part of the problem with #41962:
```
error[E0382]: use of partially moved value: `maybe`
--> file.rs:5:30
|
5 | if let Some(thing) = maybe {
| ----- ^^^^^ value used here after move
| |
| value moved here
= note: move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `(maybe as std::prelude::v1::Some).0`
--> file.rs:5:21
|
5 | if let Some(thing) = maybe {
| ^^^^^ value moved here in previous iteration of loop
= note: move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait
bors [Wed, 3 Jan 2018 21:06:21 +0000 (21:06 +0000)]
Auto merge of #46984 - arielb1:pre-statement-effect, r=nikomatsakis
NLL fixes
First, introduce pre-statement effects to dataflow to fix #46875. Edge dataflow effects might make that redundant, but I'm not sure of the best way to integrate them with liveness etc., and if this is a hack, this is one of the cleanest hacks I've seen.
And I want a small fix to avoid the torrent of bug reports.
bors [Wed, 3 Jan 2018 17:00:24 +0000 (17:00 +0000)]
Auto merge of #47127 - EdSchouten:cloudabi-tests, r=kennytm
First cut at getting some part of the test suite working for CloudABI
I am currently working on creating a Docker container for automated CI for CloudABI. Here are some of the trivial changes that need to land to make tests pass.
kennytm [Wed, 3 Jan 2018 08:58:02 +0000 (16:58 +0800)]
Rollup merge of #47125 - daboross:patch-3, r=estebank
Mention SliceConcatExt's stability in its docs
Just saw someone in IRC mention there being no stable way to join string slices! It isn't entirely clear from the rust documentation that `SliceConcatExt` is usable. While this is mentioned in https://doc.rust-lang.org/std/prelude/, the trait has nothing to indicate that it's currently usable if found via a documentation search.
The wording on this could probably be improved, but I'm hoping its better than nothing.
bors [Wed, 3 Jan 2018 06:24:23 +0000 (06:24 +0000)]
Auto merge of #47088 - clarcharr:cleanup_unicode_py, r=alexcrichton
Move static code outside of unciode.py.
This script in libstd_unicode is a mess and also contains code that shouldn't be output by a script, and instead just put in modules. So, this change does that.
```
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).
Ed Schouten [Tue, 2 Jan 2018 13:22:37 +0000 (14:22 +0100)]
Provide a copy of stdout_isatty() on CloudABI.
CloudABI doesn't make any distinction between TTYs and ordinary pipes.
While there, remove the redundant implementation used by Redox. It can
use the same stub function.
Ed Schouten [Tue, 2 Jan 2018 13:11:41 +0000 (14:11 +0100)]
Add 'ignore-cloudabi' to tests that don't and won't build on CloudABI.
It looks like many of these tests are already disabled on emscripten,
which also doesn't seem to support environment variables and subprocess
spawning. Just add a similar tag for CloudABI. While there, sort some of
the lists of operating systems alphabetically.
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
David Ross [Tue, 2 Jan 2018 03:14:32 +0000 (19:14 -0800)]
Mention SliceConcatExt's stability in its docs
SliceConcatExt's status as an unstable trait with stable methods is
documented in the compiler error for using it, and in
https://doc.rust-lang.org/std/prelude/, but it is not mentioned in the
trait itself.
Mentioning the methods can be used in stable rust today should help
users who are looking for a `join` method while working on stable rust.
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.