Ariel Ben-Yehuda [Thu, 29 Jun 2017 08:40:02 +0000 (08:40 +0000)]
Rollup merge of #42831 - rthomas:master, r=QuietMisdreavus
Update docs for fmt::write.
#29355
I reworded it slightly to make it more clear that the function only take
two arguments - the output and the Arguments struct that can be
generated from the format_args! macro.
Ariel Ben-Yehuda [Thu, 29 Jun 2017 08:40:01 +0000 (08:40 +0000)]
Rollup merge of #42219 - pwoolcoc:add-allow-fail-to-libtest, r=GuillaumeGomez
add `allow_fail` test attribute
This change allows the user to add an `#[allow_fail]` attribute to
tests that will cause the test to compile & run, but if the test fails
it will not cause the entire test run to fail. The test output will
show the failure, but in yellow instead of red, and also indicate that
it was an allowed failure.
Here is an example of the output: http://imgur.com/a/wt7ga
bors [Wed, 28 Jun 2017 20:16:13 +0000 (20:16 +0000)]
Auto merge of #42850 - estebank:unwanted-return-rotj, r=nikomatsakis
Detect missing `;` on methods with return type `()`
- Point out the origin of a type requirement when it is the return type
of a method
- Point out possibly missing semicolon when the return type is `()` and
the implicit return makes sense as a statement
- Suggest changing the return type of methods with default return type
- Don't suggest changing the return type on `fn main()`
- Don't suggest changing the return type on impl fn
- Suggest removal of semicolon (instead of being help)
bors [Wed, 28 Jun 2017 14:33:00 +0000 (14:33 +0000)]
Auto merge of #42819 - scottmcm:swap-nonoverlapping, r=sfackler
Reuse the mem::swap optimizations to speed up slice::rotate
This is most helpful for compound types where LLVM didn't vectorize the loop. Highlight: bench slice::rotate_medium_by727_strings gets 38% faster.
Exposes the swapping logic from PR https://github.com/rust-lang/rust/pull/40454 as `pub unsafe fn ptr::swap_nonoverlapping` under library feature `swap_nonoverlapping` https://github.com/rust-lang/rust/issues/42818.
(The new method seemed plausible, and was the simplest way to share the logic. I'm not attached to it, though, so let me know if a different way would be better.)
bors [Wed, 28 Jun 2017 08:47:29 +0000 (08:47 +0000)]
Auto merge of #42931 - arielb1:statement-visitor, r=eddyb
re-add the call to `super_statement` in EraseRegions
The move gathering code is sensitive to type-equality - that is rather
un-robust and I plan to fix it eventually, but that's a more invasive
change. And we want to fix the visitor anyway.
Ariel Ben-Yehuda [Tue, 27 Jun 2017 15:34:07 +0000 (18:34 +0300)]
re-add the call to `super_statement` in EraseRegions
The move gathering code is sensitive to type-equality - that is rather
un-robust and I plan to fix it eventually, but that's a more invasive
change. And we want to fix the visitor anyway.
bors [Wed, 28 Jun 2017 01:12:12 +0000 (01:12 +0000)]
Auto merge of #42417 - eddyb:separate-fn-sig, r=nikomatsakis
Don't drag function signatures along function item types.
This PR separates the signature of a function from the "function item type" (`TyFnDef`), leaving only the `DefId` and parameter `Substs`, making them even more like (captureless) closure types.
The motivation for this change is reducing typesystem complexity, and its consequences:
* operating on the signature instead of just the parameters was less efficient
* specifically, signatures can easily add several levels of depth on top of the parameter types
* and the signatured were always substituted and normalized, so typically even more complex
* it was *the only* type that was *both* nominal (identity) and structural (signature)
* harder to model in Chalk than either a purely nominal or structural type
* subtyping worked on the signature but parameters were always invariant
* call type-checking was transforming signatures but keeping the nominal half intact
* the signature could therefore get out of sync during type inference in several ways
That last point comes with a `[breaking-change]`, because functions with `'static` in their return types will now *not* be as usable as if they were using lifetime parameters instead:
```rust
// Will cause lifetime mismatch in main after this PR.
fn bar() -> &'static str { "bar" }
// Will continue to work fine, as every use can choose its own lifetime.
fn bar<'a>() -> &'a str { "bar" }
fn main() {
let s = String::from("foo");
Some(&s[..]).unwrap_or_else(bar);
}
```
Corey Farwell [Tue, 27 Jun 2017 03:34:11 +0000 (23:34 -0400)]
Rollup merge of #42874 - zackmdavis:overzealous_by_outer_forbid, r=nikomatsakis
only set "overruled by outer forbid" once for lint groups, by group name
Previously, conflicting forbid/allow attributes for a lint group would
result in a separate "allow(L) overruled by outer forbid(L)" error for
every lint L in the group. This was needlessly and annoyingly verbose;
we prefer to just have one error pointing out the conflicting
attributes.
(Also, while we're touching context.rs, clean up some unused arguments.)
Corey Farwell [Tue, 27 Jun 2017 03:34:10 +0000 (23:34 -0400)]
Rollup merge of #42871 - llogiq:for_lowering_vs_clippy, r=arielb1
change binding name of for loop lowering to appease clippy
With the latest change to for loop lowering (#42634), a `_next` binding was introduced.
Unfortunately, this [disturbs](https://github.com/Manishearth/rust-clippy/issues/1846) clippy's `used_underscore_binding` lint. This commit just renames the binding to `__next` so clippy will be happy. It should have no other effect.
bors [Mon, 26 Jun 2017 22:42:08 +0000 (22:42 +0000)]
Auto merge of #42916 - Mark-Simulacrum:update-cargo, r=alexcrichton
Update Cargo
Haven't run extensive tests locally (not really sure what to test) but this primarily pulls in minor changes: https://github.com/rust-lang/cargo/pull/4215, https://github.com/rust-lang/cargo/pull/4209, and https://github.com/rust-lang/cargo/pull/4218. The last one fixes the flaky cargo test by ignoring it, which should unblock https://github.com/rust-lang/rust/pull/42745 -- that's beta nominated.
bors [Sun, 25 Jun 2017 17:39:26 +0000 (17:39 +0000)]
Auto merge of #42865 - ollie27:rustdoc_assoc_consts, r=GuillaumeGomez
rustdoc: Fix a few issues with associated consts
* Make sure private consts are stripped.
* Don't show a code block for the value if there is none.
* Make sure default values are shown in impls.
* Make sure docs from the trait are used if the impl has no docs.
bors [Sat, 24 Jun 2017 22:34:08 +0000 (22:34 +0000)]
Auto merge of #42784 - tlively:wasm-bot, r=alexcrichton
Make wasm32 buildbot test LLVM backend
This adds the experimental targets option to configure so it can be used
by the builders and changes the wasm32 Dockerfile accordingly. Instead
of using LLVM from the emsdk, the builder's emscripten tools now uses
the Rust in-tree LLVM, since this is the one built with wasm support.
bors [Sat, 24 Jun 2017 12:18:40 +0000 (12:18 +0000)]
Auto merge of #42541 - gilescope:patch-1, r=alexcrichton
assert_eq failure message easier to read
By having the left and right strings aligned with one another it helps spot the difference between the two far quicker than if they are on the same line.
When the strings are both on the same line it take a lot longer to spot the difference. It is a small change but the small time savings add up with repetition. This would help Rust be an excellent language to write tests in out of the box.
Paul Woolcock [Wed, 24 May 2017 17:58:37 +0000 (13:58 -0400)]
add `allow_fail` test attribute
This change allows the user to add an `#[allow_fail]` attribute to
tests that will cause the test to compile & run, but if the test fails
it will not cause the entire test run to fail. The test output will
show the failure, but in yellow instead of red, and also indicate that
it was an allowed failure.
bors [Sat, 24 Jun 2017 09:32:20 +0000 (09:32 +0000)]
Auto merge of #42854 - razielgn:relaxed-debug-constraints-on-maps-iterators, r=sfackler
Relaxed Debug constraints on {HashMap,BTreeMap}::{Keys,Values}.
I has hit by this yesterday too. 😄
And I've realised that Debug for BTreeMap::{Keys,Values} wasn't formatting just keys and values respectively, but the whole map. 🤔
Esteban Küber [Sat, 24 Jun 2017 07:57:39 +0000 (00:57 -0700)]
Detect missing `;` on methods with return type `()`
- Point out the origin of a type requirement when it is the return type
of a method
- Point out possibly missing semicolon when the return type is () and
the implicit return makes sense as a statement
- Suggest changing the return type of methods with default return type
- Don't suggest changing the return type on fn main()
- Don't suggest changing the return type on impl fn
Zack M. Davis [Sat, 24 Jun 2017 02:22:06 +0000 (19:22 -0700)]
only set "overruled by outer forbid" once for lint groups, by group name
Previously, conflicting forbid/allow attributes for a lint group would
result in a separate "allow(L) overruled by outer forbid(L)" error for
every lint L in the group. This was needlessly and annoyingly verbose;
we prefer to just have one error pointing out the conflicting
attributes.
bors [Sat, 24 Jun 2017 04:42:18 +0000 (04:42 +0000)]
Auto merge of #42687 - alexcrichton:windows-tls, r=sfackler
rustc: Enable #[thread_local] for Windows
I think LLVM has had support for quite some time now for this, we just never got
around to testing it out and binding it. We've had some trouble landing this in
the past I believe, but it's time to try again!
This commit flags the `#[thread_local]` attribute as being available for Windows
targets and adds an implementation of `register_dtor` in the `thread::local`
module to ensure we can destroy these keys. The same functionality is
implemented in clang via a function called `__tlregdtor` (presumably provided in
some Windows runtime somewhere), but this function unfortunately does not take a
data pointer (just a thunk) which means we can't easily call it. For now
destructors are just run in the same way the Linux fallback is implemented,
which is just keeping track via a single OS-based TLS key.
Zack M. Davis [Sat, 24 Jun 2017 01:29:30 +0000 (18:29 -0700)]
remove unused parameters from LintStore.find_lint
Long ago, in the before-time, the find_lint method was created with the
unused_variables ("unused_variable" in the singular, as it was called at
the time) attribute in anticipation of using the session and span in the
handling of renamed lints (31b7d64fd), and indeed, the session and span
came to be used in this method, while the unused_variables attribute
remained (1ad1e2e29). In modern times, the session and span are again no
longer used (ca81d3dd); it seems we can safely prune them from the
method signature, for justice, and mercy.
Alex Crichton [Wed, 17 Feb 2016 07:07:09 +0000 (23:07 -0800)]
rustc: Enable #[thread_local] for Windows
I think LLVM has had support for quite some time now for this, we just never got
around to testing it out and binding it. We've had some trouble landing this in
the past I believe, but it's time to try again!
This commit flags the `#[thread_local]` attribute as being available for Windows
targets and adds an implementation of `register_dtor` in the `thread::local`
module to ensure we can destroy these keys. The same functionality is
implemented in clang via a function called `__tlregdtor` (presumably provided in
some Windows runtime somewhere), but this function unfortunately does not take a
data pointer (just a thunk) which means we can't easily call it. For now
destructors are just run in the same way the Linux fallback is implemented,
which is just keeping track via a single OS-based TLS key.
Oliver Middleton [Fri, 23 Jun 2017 17:39:27 +0000 (18:39 +0100)]
rustdoc: Fix a few issues with associated consts
* Make sure private consts are stripped.
* Don't show a code block for the value if there is none.
* Make sure default values are shown in impls.
* Make sure docs from the trait are used if the impl has no docs.
Andre Bogus [Fri, 23 Jun 2017 16:23:23 +0000 (18:23 +0200)]
change binding name of for loop lowering to appease clippy
With the latest change to for loop lowering, a `_next` binding was introduced.
Unfortunately, this disturbs clippy's `used_underscore_binding` lint. This
commit just renames the binding to `__next` so clippy will be happy. It should
have no other effect.
Mark Simulacrum [Fri, 23 Jun 2017 12:02:14 +0000 (06:02 -0600)]
Rollup merge of #42829 - ids1024:cxx, r=alexcrichton
Set CXX_<target> in bootstrap
I came across this trying to cross-compile rustc for Redox. It was also mentioned in a comment on https://github.com/rust-lang/rust/pull/42206, but doesn't seem to have been corrected.
Mark Simulacrum [Fri, 23 Jun 2017 12:02:10 +0000 (06:02 -0600)]
Rollup merge of #42821 - michaelwoerister:incr-debug-output-on-stderr, r=alexcrichton
Print -Zincremental-info to stderr instead of stdout.
Fixes #42583.
The [cargo-incremental](https://github.com/nikomatsakis/cargo-incremental) tool probably does not need to be updated. It already merges stdout and stderr before parsing the compiler's output.
Mark Simulacrum [Fri, 23 Jun 2017 12:02:08 +0000 (06:02 -0600)]
Rollup merge of #42777 - kennytm:kill-ignore-doctest, r=estebank
Remove most "```ignore" doc tests.
Unconditional ` ```ignore ` doc tests lead to outdated examples (e.g. https://github.com/rust-lang/rust/issues/42729#issuecomment-309346572). This PR tries to change all existing ` ```ignore ` tests into one of the following:
* Add import and declarations to ensure the code is run-pass
* If the code is not Rust, change to ` ```text `/` ```sh `/` ```json `/` ```dot `
* If the code is expected compile-fail, change to ` ```compile_fail `
* If the code is expected run-fail, change to ` ```should_panic `
* If the code can type-check but cannot link/run, change to ` ```no_run `
* Otherwise, add an explanation after the ` ```ignore `
The `--explain` handling is changed to cope with hidden lines from the error index.
Tidy is changed to reject any unexplained ` ```ignore ` and ` ```rust,ignore `.
kennytm [Tue, 20 Jun 2017 07:15:16 +0000 (15:15 +0800)]
Removed as many "```ignore" as possible.
Replaced by adding extra imports, adding hidden code (`# ...`), modifying
examples to be runnable (sorry Homura), specifying non-Rust code, and
converting to should_panic, no_run, or compile_fail.
Remaining "```ignore"s received an explanation why they are being ignored.
Thomas Lively [Fri, 23 Jun 2017 01:04:20 +0000 (18:04 -0700)]
Add wasm32-experimental-emscripten to wasm builder
This modifies the builder to download and use the LLVM tools from the
last known good build on the WebAssembly buildbot waterfall, since these
tools are built with the WebAssembly LLVM backend enabled.
Thomas Lively [Thu, 22 Jun 2017 22:16:54 +0000 (15:16 -0700)]
Add target option for linker environment variables
This is used in wasm32-experimental-emscripten to ensure that emscripten
links against the libc bitcode files produced by the wasm LLVM backend,
instead of using fastcomp.