]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoClarify Iterator::position doc
Sebastian Hahn [Tue, 11 Apr 2017 12:51:56 +0000 (14:51 +0200)]
Clarify Iterator::position doc

Extend the example a little bit to show behaviour better.

7 years agoAuto merge of #41168 - Shizmob:jemalloc-musl, r=alexcrichton
bors [Tue, 11 Apr 2017 08:57:39 +0000 (08:57 +0000)]
Auto merge of #41168 - Shizmob:jemalloc-musl, r=alexcrichton

Fix jemalloc support for musl

Just like DragonFlyBSD, using the same symbols as the system allocator will result in a segmentation fault at runtime due to allocator mismatches. As such, it's better to prefix the jemalloc symbols instead, avoiding crashes.

We encountered this problem on a dynamically-linked musl target (with patches to Rust to make that possible, see #40113). It may not show up immediately obviously on the current statically-linked CRT targets.

7 years agoAuto merge of #41174 - estebank:issue-41155, r=nikomatsakis
bors [Tue, 11 Apr 2017 05:44:06 +0000 (05:44 +0000)]
Auto merge of #41174 - estebank:issue-41155, r=nikomatsakis

Point at only one char on `Span::next_point`

Avoid pointing at two chars so the diagnostic output doesn't display a
multiline span when starting beyond a line end.

Fix #41155.

Instead of

```rust
error: expected one of `(`, `const`, `default`, `extern`, `fn`, `type`, or `unsafe`, found `}`
 --> <anon>:3:1
  |
1 |   impl S { pub
  |  _____________- starting here...
2 | |
  | |  ...ending here: expected one of 7 possible tokens here
3 |   }
  |   ^ unexpected token
```

show

```rust
error: expected one of `(`, `const`, `default`, `extern`, `fn`, `type`, or `unsafe`, found `}`
  --> <anon>:13:1
   |
12 |     pub
   |        - expected one of 7 possible tokens here
13 | }
   | ^ unexpected token
```

7 years agoAuto merge of #40565 - estebank:binops-help, r=arielb1
bors [Mon, 10 Apr 2017 21:56:13 +0000 (21:56 +0000)]
Auto merge of #40565 - estebank:binops-help, r=arielb1

Explicit help message for binop type mismatch

When trying to do `1 + Some(2)`, or some other binary operation on two
types different types without an appropriate trait implementation, provide
an explicit help message:

```rust
help: `{integer} + std::option::Option<{integer}>` has no implementation
```

Re: #39579, #38564, #37626, #39942, #34698.

7 years agoExplicit help message for binop type missmatch
Esteban Küber [Mon, 10 Apr 2017 21:17:49 +0000 (14:17 -0700)]
Explicit help message for binop type missmatch

When trying to do a binary operation with missing implementation, for
example `1 + Some(2)`, provide an explicit help message:

```
note: no implementation for `{integer} + std::option::Option<{integer}>`
```

Use `rustc_on_unimplemented` for the suggestions. Move cfail test to ui.

7 years agoPoint at only one char on `Span::next_point`
Esteban Küber [Sun, 9 Apr 2017 23:28:31 +0000 (16:28 -0700)]
Point at only one char on `Span::next_point`

Avoid pointing at two chars so the diagnostic output doesn't display a
multiline span when starting beyond a line end.

7 years agoAuto merge of #40018 - japaric:ld, r=alexcrichton
bors [Mon, 10 Apr 2017 18:00:23 +0000 (18:00 +0000)]
Auto merge of #40018 - japaric:ld, r=alexcrichton

-Z linker-flavor

(Please read the commit message first)

This PR is an alternative to rust-lang/rust#36120 (internal lld linker). The
main goal of this PR is to make it *possible* to use LLD as a linker to allow
out of tree experimentation. Now that LLD is going to be shipped with LLVM 4.0,
it should become easier to get a hold of LLD (hopefully, it will be packaged by
Linux distros soon).

Since LLD is a multiarch linker, it has the potential to make cross compilation
easier (less tools need to be installed). Supposedly, LLD is also faster than
the gold linker so LLD may improve build times where link times are significant
(e.g. 100% incremental compilation reuse).

The place where LLD shines is at linking Rust programs that don't depend on
system libraries. For example, here's how you would link a bare metal ARM
Cortex-M program:

```
$ xargo rustc --target thumbv7m-none-eabi -- -Z linker-flavor=ld -C linker=ld.lld -Z print-link-args
"ld.lld" \
  "-L" \
  "$XARGO_HOME/lib/rustlib/thumbv7m-none-eabi/lib" \
  "$PWD/target/thumbv7m-none-eabi/debug/deps/app-de1f86df314ad68c.0.o" \
  "-o" \
  "$PWD/target/thumbv7m-none-eabi/debug/deps/app-de1f86df314ad68c" \
  "--gc-sections" \
  "-L" \
  "$PWD/target/thumbv7m-none-eabi/debug/deps" \
  "-L" \
  "$PWD/target/debug/deps" \
  "-L" \
  "$XARGO_HOME/lib/rustlib/thumbv7m-none-eabi/lib" \
  "-Bstatic" \
  "-Bdynamic" \
  "$XARGO_HOME/lib/rustlib/thumbv7m-none-eabi/lib/libcore-11670d2bd4951fa7.rlib"

$ file target/thumbv7m-none-eabi/debug/app
app: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, not stripped, with debug_info
```

This doesn't require installing the `arm-none-eabi-gcc` toolchain.

Even cooler (but I'm biased) is that you can link Rust programs that use
[`steed`] (`steed` is a `std` re-implementation free of C dependencies for Linux
systems) instead of `std` for a bunch of different architectures without having
to install a single cross toolchain.

[`steed`]: https://github.com/japaric/steed

```
$ xargo rustc --target aarch64-unknown-linux-steed --example hello --release -- -Z print-link-args
"ld.lld" \
  "-L" \
  "$XARGO_HOME/lib/rustlib/aarch64-unknown-linux-steed/lib" \
  "$PWD/target/aarch64-unknown-linux-steed/release/examples/hello-80c130ad884c0f8f.0.o" \
  "-o" \
  "$PWD/target/aarch64-unknown-linux-steed/release/examples/hello-80c130ad884c0f8f" \
  "--gc-sections" \
  "-L" \
  "$PWD/target/aarch64-unknown-linux-steed/release/deps" \
  "-L" \
  "$PWD/target/release/deps" \
  "-L" \
  "$XARGO_HOME/lib/rustlib/aarch64-unknown-linux-steed/lib" \
  "-Bstatic" \
  "-Bdynamic" \
  "/tmp/rustc.lAybk9Ltx93Q/libcompiler_builtins-589aede02de78434.rlib"

$ file target/aarch64-unknown-linux-steed/release/examples/hello
hello: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, not stripped, with debug_info
```

All these targets (architectures) worked with LLD:

- [aarch64-unknown-linux-steed](https://github.com/japaric/steed/blob/lld/docker/aarch64-unknown-linux-steed.json)
- [arm-unknown-linux-steedeabi](https://github.com/japaric/steed/blob/lld/docker/arm-unknown-linux-steedeabi.json)
- [arm-unknown-linux-steedeabihf](https://github.com/japaric/steed/blob/lld/docker/arm-unknown-linux-steedeabihf.json)
- [armv7-unknown-linux-steedeabihf](https://github.com/japaric/steed/blob/lld/docker/armv7-unknown-linux-steedeabihf.json)
- [i686-unknown-linux-steed](https://github.com/japaric/steed/blob/lld/docker/i686-unknown-linux-steed.json)
- [mips-unknown-linux-steed](https://github.com/japaric/steed/blob/lld/docker/mips-unknown-linux-steed.json)
- [mipsel-unknown-linux-steed](https://github.com/japaric/steed/blob/lld/docker/mipsel-unknown-linux-steed.json)
- [powerpc-unknown-linux-steed](https://github.com/japaric/steed/blob/lld/docker/powerpc-unknown-linux-steed.json)
- [powerpc64-unknown-linux-steed](https://github.com/japaric/steed/blob/lld/docker/powerpc64-unknown-linux-steed.json)
- [x86_64-unknown-linux-steed](https://github.com/japaric/steed/blob/lld/docker/x86_64-unknown-linux-steed.json)

---

The case where lld is unergonomic is linking binaries that depend on system
libraries. Like "Hello, world" for `x86_64-unknown-linux-gnu`. Because you have
to pass as linker arguments: the path to the startup objects, the path to the
dynamic linker and the library search paths. And all those are system specific
so they can't be encoded in the target itself.

```
$ cargo \
  rustc \
  --release \
  -- \
  -C \
  linker=ld.lld \
  -Z \
  linker-flavor=ld \
  -C \
  link-args='-dynamic-linker /lib64/ld-linux-x86-64.so.2 -L/usr/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1 /usr/lib/Scrt1.o /usr/lib/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/crtbeginS.o /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/crtendS.o /usr/lib/crtn.o'
```

---

Another case where `-Z linker-flavor` may come in handy is directly calling
Solaris' linker which is also a multiarch linker (or so I have heard). cc
@binarycrusader

cc @alexcrichton
Heads up: [breaking-change] due to changes in the target specification format.

7 years agoexplain why we have a fake cfail test
Jorge Aparicio [Mon, 10 Apr 2017 14:55:52 +0000 (09:55 -0500)]
explain why we have a fake cfail test

7 years ago--subsystem needs -Wl when using non-ld linkers
Jorge Aparicio [Mon, 10 Apr 2017 14:53:24 +0000 (09:53 -0500)]
--subsystem needs -Wl when using non-ld linkers

7 years agoAuto merge of #41179 - mandeep:add-fmtresult-example, r=frewsxcv
bors [Mon, 10 Apr 2017 13:07:35 +0000 (13:07 +0000)]
Auto merge of #41179 - mandeep:add-fmtresult-example, r=frewsxcv

Added doc comments for fmt::Result

Added doc comments for fmt::Result in regards to item 3 in issue #29355. I'm not certain that this is all that's needed but I think it's a good starting point on this item.

7 years agoAuto merge of #41103 - projektir:channel_error_docs, r=GuillaumeGomez
bors [Mon, 10 Apr 2017 09:45:16 +0000 (09:45 +0000)]
Auto merge of #41103 - projektir:channel_error_docs, r=GuillaumeGomez

Channel error docs

r? @steveklabnik

I'm going to need some help on this one, a few ambiguities.

7 years agoAuto merge of #41178 - llogiq:collections-doc-markdown, r=frewsxcv
bors [Mon, 10 Apr 2017 04:41:15 +0000 (04:41 +0000)]
Auto merge of #41178 - llogiq:collections-doc-markdown, r=frewsxcv

Apply clippy's doc_markdown improvements to libcollections

Since my last PR led to linker failure, I'm now taking much smaller steps.
This only fixes some doc_markdown warnings; as they are in comments only,
we shouldn't get any problems building.

7 years agoAdded doc comments for fmt::Result
mandeep [Mon, 10 Apr 2017 04:07:18 +0000 (23:07 -0500)]
Added doc comments for fmt::Result

7 years agoApply clippy's doc_markdown improvements to libcollections
Andre Bogus [Mon, 10 Apr 2017 03:53:10 +0000 (05:53 +0200)]
Apply clippy's doc_markdown improvements to libcollections

Since my last PR led to linker failure, I'm now taking much smaller steps.
This only fixes some doc_markdown warnings; as they are in comments only,
we shouldn't get any problems building.

7 years agoAuto merge of #41175 - goffrie:patch-1, r=frewsxcv
bors [Mon, 10 Apr 2017 02:24:44 +0000 (02:24 +0000)]
Auto merge of #41175 - goffrie:patch-1, r=frewsxcv

Minor fix to mutex example

Presumably `N` was supposed to be used in both places.

7 years agoMinor fix to mutex example
Geoffry Song [Sun, 9 Apr 2017 23:42:01 +0000 (19:42 -0400)]
Minor fix to mutex example

Presumably `N` was supposed to be used in both places.

7 years agoAuto merge of #40653 - frewsxcv:tidy-handling, r=alexcrichton
bors [Sun, 9 Apr 2017 23:23:11 +0000 (23:23 +0000)]
Auto merge of #40653 - frewsxcv:tidy-handling, r=alexcrichton

A couple minor improvements for tidy error handling.

None

7 years agoAuto merge of #41136 - estebank:multiline, r=jonathandturner
bors [Sun, 9 Apr 2017 20:54:50 +0000 (20:54 +0000)]
Auto merge of #41136 - estebank:multiline, r=jonathandturner

Always show end line of multiline annotations

```rust
error[E0046]: not all trait items implemented, missing: `Item`
  --> $DIR/issue-23729.rs:20:9
   |
20 |           impl Iterator for Recurrence {
   |  _________^ starting here...
21 | |             //~^ ERROR E0046
22 | |             //~| NOTE missing `Item` in implementation
23 | |             //~| NOTE `Item` from trait: `type Item;`
...  |
36 | |             }
37 | |         }
   | |_________^ ...ending here: missing `Item` in implementation
   |
   = note: `Item` from trait: `type Item;`
```

instead of

```rust
error[E0046]: not all trait items implemented, missing: `Item`
  --> $DIR/issue-23729.rs:20:9
   |
20 |         impl Iterator for Recurrence {
   |         ^ missing `Item` in implementation
   |
   = note: `Item` from trait: `type Item;`
```

7 years agoAlways show end line of multiline annotations
Esteban Küber [Thu, 6 Apr 2017 19:18:18 +0000 (12:18 -0700)]
Always show end line of multiline annotations

```rust
error[E0046]: not all trait items implemented, missing: `Item`
  --> $DIR/issue-23729.rs:20:9
   |
20 |           impl Iterator for Recurrence {
   |  _________^ starting here...
21 | |             //~^ ERROR E0046
22 | |             //~| NOTE missing `Item` in implementation
23 | |             //~| NOTE `Item` from trait: `type Item;`
...  |
36 | |             }
37 | |         }
   | |_________^ ...ending here: missing `Item` in implementation
   |
   = note: `Item` from trait: `type Item;`
```

instead of

```rust
error[E0046]: not all trait items implemented, missing: `Item`
  --> $DIR/issue-23729.rs:20:9
   |
20 |         impl Iterator for Recurrence {
   |         ^ missing `Item` in implementation
   |
   = note: `Item` from trait: `type Item;`
```

7 years agoPrint tidy errors to stderr, prefix with 'tidy error: ', handle 'bad' state.
Corey Farwell [Sun, 19 Mar 2017 15:46:56 +0000 (11:46 -0400)]
Print tidy errors to stderr, prefix with 'tidy error: ', handle 'bad' state.

7 years agoAuto merge of #41084 - QuietMisdreavus:rustdoc-format-redux, r=frewsxcxv,GuillaumeGomez
bors [Sun, 9 Apr 2017 17:51:32 +0000 (17:51 +0000)]
Auto merge of #41084 - QuietMisdreavus:rustdoc-format-redux, r=frewsxcxv,GuillaumeGomez

rustdoc: update formatting of fn signatures and where clauses to match style rfcs

Recent updates to style RFCs ([where clauses](https://github.com/rust-lang-nursery/fmt-rfcs/issues/38), [function definitions](https://github.com/rust-lang-nursery/fmt-rfcs/issues/39)) changed the "canonical" style for these items, so this is a rustdoc update to make it emit that style where necessary. This is mainly a conversion from visual indent to block indent, which helps out in situations where there was excessive indent causing lines to wrap regardless.

Samples:

![std::iter::IntoIterator](https://cloud.githubusercontent.com/assets/5217170/24712947/e586604c-19e9-11e7-87ae-4fe64d689dc3.png)

![excerpt from std::iter::Iterator](https://cloud.githubusercontent.com/assets/5217170/24713209/91e65112-19ea-11e7-9ff8-d4cf6b31aae1.png)

![std::iter::FromIterator](https://cloud.githubusercontent.com/assets/5217170/24713138/59f36114-19ea-11e7-9dbb-5f5ba7126e2e.png)

![std::cmp::min](https://cloud.githubusercontent.com/assets/5217170/24713038/1bab88b4-19ea-11e7-935d-defed5648de4.png)

![some trait impls on std::collections::HashMap](https://cloud.githubusercontent.com/assets/5217170/24713251/b7ef69e8-19ea-11e7-94a7-e01fbf89fa31.png)

![`fn extract_code_blocks`, an example given in #40687](https://cloud.githubusercontent.com/assets/5217170/24713159/672717cc-19ea-11e7-9acb-6ac278b90339.png)

![excerpt from itertools::Itertools](https://cloud.githubusercontent.com/assets/5217170/24713323/f06716ea-19ea-11e7-94cc-6ef68d9980ec.png)

fixes #41025 and #40687

r? @rust-lang/docs

7 years agomerge with master to pick up pulldown switch
QuietMisdreavus [Sun, 9 Apr 2017 15:38:38 +0000 (10:38 -0500)]
merge with master to pick up pulldown switch

7 years agoAuto merge of #40829 - mgattozzi:ChildStderr, r=steveklabnik
bors [Sun, 9 Apr 2017 15:30:20 +0000 (15:30 +0000)]
Auto merge of #40829 - mgattozzi:ChildStderr, r=steveklabnik

Update ChildStderr docs to be clearer

Before the docs only had a line about where it was found and that it was
a handle to stderr. This commit changes it so that the summary second line is
removed and that it's a bit clearer about what can be done with it. Part of
#29370

7 years agoAuto merge of #40658 - eddyb:lay-more-out, r=arielb1
bors [Sun, 9 Apr 2017 13:08:10 +0000 (13:08 +0000)]
Auto merge of #40658 - eddyb:lay-more-out, r=arielb1

Use ty::layout for ABI computation instead of LLVM types.

This is the first step in creating a backend-agnostic library for computing call ABI details from signatures.
I wanted to open the PR *before* attempting to move `cabi_*` from trans to avoid rebase churn in #39999.
**EDIT**: As I suspected, #39999 needs this PR to fully work (see https://github.com/rust-lang/rust/pull/39999#issuecomment-287723379).

The first 3 commits add more APIs to `ty::layout` and replace non-ABI uses of `sizing_type_of`.
These APIs are probably usable by other backends, and miri too (cc @stoklund @solson).

The last commit rewrites `rustc_trans::cabi_*` to use `ty::layout` and new `rustc_trans::abi` APIs.
Also, during the process, a couple trivial bugs were identified and fixed:
* `msp430`, `nvptx`, `nvptx64`: type sizes *in bytes* were compared with `32` and `64`
* `x86` (`fastcall`): `f64` was incorrectly not treated the same way as `f32`

Although not urgent, this PR also uses the more general "homogenous aggregate" logic to fix #32045.

7 years agorustc_trans: use ty::layout for ABI computation instead of LLVM types.
Eduard-Mihai Burtescu [Fri, 10 Mar 2017 04:25:57 +0000 (06:25 +0200)]
rustc_trans: use ty::layout for ABI computation instead of LLVM types.

7 years agoAuto merge of #41095 - clarcharr:as_extras, r=alexcrichton
bors [Sun, 9 Apr 2017 09:17:34 +0000 (09:17 +0000)]
Auto merge of #41095 - clarcharr:as_extras, r=alexcrichton

Add as_c_str

Again, tying up some consistencies with `CString`.

7 years agoAuto merge of #41163 - nagisa:ldflags-llvm-config, r=alexcrichton
bors [Sun, 9 Apr 2017 05:49:31 +0000 (05:49 +0000)]
Auto merge of #41163 - nagisa:ldflags-llvm-config, r=alexcrichton

Specify type libraries for llvm-config --ldflags

This matters on systems where static libraries and dynamic libraries reside in
different location

7 years agoAuto merge of #41154 - bluss:slice-rfind, r=alexcrichton
bors [Sun, 9 Apr 2017 03:30:09 +0000 (03:30 +0000)]
Auto merge of #41154 - bluss:slice-rfind, r=alexcrichton

Implement .rfind() for slice iterators Iter and IterMut

Just like the forward case find, implement rfind explicitly for slice iterators Iter and IterMut.

7 years agoAuto merge of #41092 - jonhoo:std-fence-intrinsics, r=alexcrichton
bors [Sat, 8 Apr 2017 22:37:35 +0000 (22:37 +0000)]
Auto merge of #41092 - jonhoo:std-fence-intrinsics, r=alexcrichton

Add safe wrapper for atomic_compilerfence intrinsics

This PR adds a proposed safe wrapper for the `atomic_singlethreadfence_*` intrinsics introduced by [RFC #888](https://github.com/rust-lang/rfcs/pull/888). See #41091 for further discussion.

7 years agothis code block is text not Rust code
Jorge Aparicio [Sat, 8 Apr 2017 20:51:18 +0000 (15:51 -0500)]
this code block is text not Rust code

7 years agorustc: add some abstractions to ty::layout for a more concise API.
Eduard-Mihai Burtescu [Fri, 10 Mar 2017 04:25:51 +0000 (06:25 +0200)]
rustc: add some abstractions to ty::layout for a more concise API.

7 years agorustc_trans: avoid sizing_type_of everywhere possible.
Eduard-Mihai Burtescu [Thu, 2 Mar 2017 03:35:25 +0000 (05:35 +0200)]
rustc_trans: avoid sizing_type_of everywhere possible.

7 years agorustc: add a TyLayout helper for type-related layout queries.
Eduard-Mihai Burtescu [Tue, 28 Feb 2017 15:50:28 +0000 (17:50 +0200)]
rustc: add a TyLayout helper for type-related layout queries.

7 years agoFix jemalloc support for musl
Shiz [Sat, 8 Apr 2017 18:36:00 +0000 (20:36 +0200)]
Fix jemalloc support for musl

Just like DragonFlyBSD, using the same symbols as the system allocator will
result in a segmentation fault at runtime due to allocator mismatches.
As such, prefix the jemalloc symbols instead.

7 years agoAuto merge of #41148 - arielb1:dead-unwind, r=nagisa
bors [Sat, 8 Apr 2017 19:47:31 +0000 (19:47 +0000)]
Auto merge of #41148 - arielb1:dead-unwind, r=nagisa

borrowck::mir::dataflow: ignore unwind edges of empty drops

This avoids creating drop flags in many unnecessary situations.

Fixes #41110.

r? @nagisa

beta-nominating because regression. However, that is merely a small perf regression and codegen changes are always risky, so we might let this slide for 1.17.

7 years agoborrowck::mir::dataflow: ignore unwind edges of empty drops
Ariel Ben-Yehuda [Thu, 6 Apr 2017 22:00:53 +0000 (01:00 +0300)]
borrowck::mir::dataflow: ignore unwind edges of empty drops

This avoids creating drop flags in many unnecessary situations.

Fixes #41110.

7 years agoAdding links around Sender/SyncSender/Receiver errors; Adding more documentation...
projektir [Tue, 4 Apr 2017 03:32:59 +0000 (23:32 -0400)]
Adding links around Sender/SyncSender/Receiver errors; Adding more documentation to channel() and sync_channel(); adding more links #29377

7 years agoAddress @parched's comments
Jon Gjengset [Sat, 8 Apr 2017 18:03:17 +0000 (14:03 -0400)]
Address @parched's comments

7 years agoSpecify type libraries for llvm-config --ldflags
Simonas Kazlauskas [Sat, 8 Apr 2017 14:53:16 +0000 (17:53 +0300)]
Specify type libraries for llvm-config --ldflags

This matters on systems where static libraries and dynamic libraries reside in
different location

7 years agoAuto merge of #41055 - Archytaus:compile-fail/const-match-pattern-arm, r=arielb1
bors [Sat, 8 Apr 2017 14:05:06 +0000 (14:05 +0000)]
Auto merge of #41055 - Archytaus:compile-fail/const-match-pattern-arm, r=arielb1

Fixed ICEs with pattern matching in const expression

Fixed 2 ICEs with when pattern matching inside a constant expression.

Both of these ICEs now resolve to an appropriate compiler error.

1. ICE was caused by a compiler bug to implement discriminant const qualify.

    I removed this intentionally thrown bug and changed it to a FIXME as the unimplemented expression type is handled as a compiler error elsewhere.

2. ICE was caused during a drop check when checking if a variable lifetime outlives the current scope if there was no parent scope .

    I've changed it to stop checking if there is no parent scope for the current scope. It is valid syntax for a const variable to be assigned a match expression with no enclosing scope.

    The ICE seemed to mainly be used as a defensive check for bugs elsewhere.

Fixes #38199.
Fixes #31577.
Fixes #29093.
Fixes #40012.

7 years agoAuto merge of #40887 - estebank:ty-placeholder, r=petrochenkov
bors [Sat, 8 Apr 2017 11:47:48 +0000 (11:47 +0000)]
Auto merge of #40887 - estebank:ty-placeholder, r=petrochenkov

Introduce `TyErr` independent from `TyInfer`

Add a `TyErr` type to represent unknown types in places where
parse errors have happened, while still able to build the AST.

Initially only used to represent incorrectly written fn arguments and
avoid "expected X parameters, found Y" errors when called with the
appropriate amount of parameters. We cannot use `TyInfer` for this as
`_` is not allowed as a valid argument type.

Example output:

```rust
error: expected one of `:` or `@`, found `,`
  --> file.rs:12:9
   |
12 | fn bar(x, y: usize) {}
   |         ^

error[E0061]: this function takes 2 parameters but 3 parameters were supplied
  --> file.rs:19:9
   |
12 | fn bar(x, y) {}
   | --------------- defined here
...
19 |     bar(1, 2, 3);
   |         ^^^^^^^ expected 2 parameters
```

Fix #34264.

7 years agoAuto merge of #40775 - estebank:variant-as-type, r=petrochenkov
bors [Sat, 8 Apr 2017 09:23:28 +0000 (09:23 +0000)]
Auto merge of #40775 - estebank:variant-as-type, r=petrochenkov

Suggest using enum when a variant is used as a type

Given a file:

```rust
enum Fruit {
    Apple(i64),
    Orange(i64),
}

fn should_return_fruit() -> Apple {
    Apple(5)
}
```

Provide the following output:

```rust
error[E0412]: cannot find type `Apple` in this scope
  --> file.rs:16:29
   |
16 | fn should_return_fruit() -> Apple {
   |                             ^^^^^ not found in this scope
   |
help: there is an enum variant `Fruit::Apple`, did you mean to use `Fruit`?
  --> file.rs:12:5
   |
12 |     Apple(i64),
   |     ^^^^^^^^^^

error[E0425]: cannot find function `Apple` in this scope
  --> file.rs:17:5
   |
17 |     Apple(5)
   |     ^^^^^ not found in this scope
   |
   = help: possible candidate is found in another module, you can import it into scope:
             `use Fruit::Apple;`
```

Fix #35675.

7 years agoAuto merge of #41156 - TimNN:rollup, r=TimNN
bors [Sat, 8 Apr 2017 06:56:17 +0000 (06:56 +0000)]
Auto merge of #41156 - TimNN:rollup, r=TimNN

Rollup of 4 pull requests

- Successful merges: #41135, #41143, #41146, #41152
- Failed merges:

7 years agoRollup merge of #41152 - cuviper:bootstrap-armv7, r=japaric
Tim Neumann [Sat, 8 Apr 2017 06:55:10 +0000 (08:55 +0200)]
Rollup merge of #41152 - cuviper:bootstrap-armv7, r=japaric

bootstrap.py: fix armv7 detection

This matches the logic that was in `./configure` before f8ca805422db8.

7 years agoRollup merge of #41146 - est31:master, r=nrc
Tim Neumann [Sat, 8 Apr 2017 06:55:10 +0000 (08:55 +0200)]
Rollup merge of #41146 - est31:master, r=nrc

pub(restricted) didn't make it into 1.17

Gets shipped in 1.18 instead.

7 years agoRollup merge of #41143 - stjepang:optimize-bool-fetch-nand, r=nagisa
Tim Neumann [Sat, 8 Apr 2017 06:55:09 +0000 (08:55 +0200)]
Rollup merge of #41143 - stjepang:optimize-bool-fetch-nand, r=nagisa

Optimize AtomicBool::fetch_nand

This is an attempt to push the PR #40563 to completion.

Benchmark: [source](https://gist.github.com/stjepang/023f5025623f5474184f9f4dfd6379ae)
Improvement:

```
 name  old_ ns/iter  new_ce_ ns/iter  diff ns/iter   diff %
 1t    146,440       89,904                -56,536  -38.61%
 2t    561,456       316,835              -244,621  -43.57%
 4t    2,822,821     1,005,424          -1,817,397  -64.38%
```

r? @eddyb
cc @alexcrichton @nagisa

7 years agoRollup merge of #41135 - japaric:unstable-docs, r=steveklabnik
Tim Neumann [Sat, 8 Apr 2017 06:55:08 +0000 (08:55 +0200)]
Rollup merge of #41135 - japaric:unstable-docs, r=steveklabnik

document some existing unstable features

"msp430-interrupt", "ptx-kernel" and #![compiler_builtins_lib]

r? @steveklabnik

7 years agoAuto merge of #41147 - aidanhs:aphs-fix-appveyor-cache, r=TimNN
bors [Sat, 8 Apr 2017 04:21:43 +0000 (04:21 +0000)]
Auto merge of #41147 - aidanhs:aphs-fix-appveyor-cache, r=TimNN

Disable errexit for sanity checking git repo

Unblock appveyor

7 years agofake the feature-gate-linker-flavor compile fail test
Jorge Aparicio [Sat, 8 Apr 2017 02:47:58 +0000 (21:47 -0500)]
fake the feature-gate-linker-flavor compile fail test

as there's no way to generate a `#![feature(linker_flavor)]` error

7 years agoslice: Implement .rfind() for slice iterators Iter and IterMut
Ulrik Sverdrup [Sat, 8 Apr 2017 01:43:18 +0000 (03:43 +0200)]
slice: Implement .rfind() for slice iterators Iter and IterMut

Just like the forward case find, implement rfind explicitly

7 years agoMove tests from ui to cfail
Esteban Küber [Fri, 7 Apr 2017 23:08:07 +0000 (16:08 -0700)]
Move tests from ui to cfail

7 years agobootstrap.py: fix armv7 detection
Josh Stone [Sat, 8 Apr 2017 00:16:52 +0000 (17:16 -0700)]
bootstrap.py: fix armv7 detection

This matches the logic that was in `./configure` before f8ca805422db8.

7 years agoMerge branch 'master' into ty-placeholder
Esteban Küber [Fri, 7 Apr 2017 14:19:44 +0000 (07:19 -0700)]
Merge branch 'master' into ty-placeholder

7 years agoAdd as_c_str.
Clar Charr [Wed, 5 Apr 2017 21:13:46 +0000 (17:13 -0400)]
Add as_c_str.

7 years agoDisable errexit for sanity checking git repo
Aidan Hobson Sayers [Fri, 7 Apr 2017 18:55:52 +0000 (19:55 +0100)]
Disable errexit for sanity checking git repo

7 years agopub(restricted) didn't make it into 1.17
est31 [Fri, 7 Apr 2017 18:47:22 +0000 (20:47 +0200)]
pub(restricted) didn't make it into 1.17

Gets shipped in 1.18 instead.

7 years agoReplace compare_exchange with swap
Stjepan Glavina [Fri, 7 Apr 2017 16:04:15 +0000 (18:04 +0200)]
Replace compare_exchange with swap

7 years agohack: add a linker_flavor feature gate
Jorge Aparicio [Fri, 7 Apr 2017 15:51:36 +0000 (10:51 -0500)]
hack: add a linker_flavor feature gate

to make tidy accept `-Z linker-flavor` documentation

7 years agoadd some documentation to the unstable book
Jorge Aparicio [Fri, 7 Apr 2017 03:36:30 +0000 (22:36 -0500)]
add some documentation to the unstable book

7 years agoremove workaround for rust-lang/rust#39880
Jorge Aparicio [Fri, 7 Apr 2017 01:39:10 +0000 (20:39 -0500)]
remove workaround for rust-lang/rust#39880

committed by mistake

7 years ago-Z linker-flavor
Jorge Aparicio [Tue, 21 Feb 2017 19:47:15 +0000 (14:47 -0500)]
-Z linker-flavor

This patch adds a `-Z linker-flavor` flag to rustc which can be used to invoke
the linker using a different interface.

For example, by default rustc assumes that all the Linux targets will be linked
using GCC. This makes it impossible to use LLD as a linker using just `-C
linker=ld.lld` because that will invoke LLD with invalid command line
arguments. (e.g. rustc will pass -Wl,--gc-sections to LLD but LLD doesn't
understand that; --gc-sections would be the right argument)

With this patch one can pass `-Z linker-flavor=ld` to rustc to invoke the linker
using a LD-like interface. This way, `rustc -C linker=ld.lld -Z
linker-flavor=ld` will invoke LLD with the right arguments.

`-Z linker-flavor` accepts 4 different arguments: `em` (emcc), `ld`,
`gcc`, `msvc` (link.exe). `em`, `gnu` and `msvc` cover all the existing linker
interfaces. `ld` is a new flavor for interfacing GNU's ld and LLD.

This patch also changes target specifications. `linker-flavor` is now a
mandatory field that specifies the *default* linker flavor that the target will
use. This change also makes the linker interface *explicit*; before, it used to
be derived from other fields like linker-is-gnu, is-like-msvc,
is-like-emscripten, etc.

Another change to target specifications is that the fields `pre-link-args`,
`post-link-args` and `late-link-args` now expect a map from flavor to linker
arguments.

``` diff
-    "pre-link-args": ["-Wl,--as-needed", "-Wl,-z,-noexecstack"],
+    "pre-link-args": {
+        "gcc": ["-Wl,--as-needed", "-Wl,-z,-noexecstack"],
+        "ld": ["--as-needed", "-z,-noexecstack"],
+    },
```

[breaking-change]  for users of custom targets specifications

7 years agoOptimize AtomicBool::fetch_nand
Stjepan Glavina [Fri, 7 Apr 2017 15:28:55 +0000 (17:28 +0200)]
Optimize AtomicBool::fetch_nand

7 years agoAuto merge of #41138 - frewsxcv:rollup, r=frewsxcv
bors [Fri, 7 Apr 2017 15:25:47 +0000 (15:25 +0000)]
Auto merge of #41138 - frewsxcv:rollup, r=frewsxcv

Rollup of 9 pull requests

- Successful merges: #40797, #41047, #41056, #41061, #41075, #41080, #41120, #41130, #41131
- Failed merges:

7 years agochange the format of the linked issue number
Jorge Aparicio [Fri, 7 Apr 2017 14:46:55 +0000 (09:46 -0500)]
change the format of the linked issue number

7 years agoRollup merge of #41131 - euclio:collapse-animation, r=GuillaumeGomez
Corey Farwell [Fri, 7 Apr 2017 13:20:11 +0000 (09:20 -0400)]
Rollup merge of #41131 - euclio:collapse-animation, r=GuillaumeGomez

rustdoc: collapse docblock before showing label

The animation for collapsing descriptions is currently pretty jarring, as the label starts fading in as the description is collapsing. This causes the description to jump down a line (and sometimes change indentation) while animating.

This PR modifies this behavior to collapse the block entirely before starting to fade in the collapse button label.

While this PR works well for descriptions of structs, traits, etc., it still does not look ideal for attributes. I'd appreciate any suggestions for improving that animation. Perhaps we want to optimize for the single-attribute case, and try not to collapse the attribute list entirely before fading in the label?

7 years agoRollup merge of #41130 - petrhosek:fuchsia-ci-upstream, r=alexcrichton
Corey Farwell [Fri, 7 Apr 2017 13:20:10 +0000 (09:20 -0400)]
Rollup merge of #41130 - petrhosek:fuchsia-ci-upstream, r=alexcrichton

travis: Use upstream LLVM repositories for Fuchsia

The Fuchsia copies of LLVM repositories contain additional patches
for work-in-progress features and there is some amount of churn that
may break Rust. Use upstream LLVM repositories instead for building
the toolchain used by the Fuchsia builder.

7 years agoRollup merge of #41120 - clarcharr:c_str_transmute, r=alexcrichton
Corey Farwell [Fri, 7 Apr 2017 13:20:09 +0000 (09:20 -0400)]
Rollup merge of #41120 - clarcharr:c_str_transmute, r=alexcrichton

Remove some CStr transmutes.

Because dedicated methods exist for these, we don't have to add other transmutes.

7 years agoRollup merge of #41080 - cuviper:generic-powerpc, r=alexcrichton
Corey Farwell [Fri, 7 Apr 2017 13:20:08 +0000 (09:20 -0400)]
Rollup merge of #41080 - cuviper:generic-powerpc, r=alexcrichton

dist-powerpc-linux: use a pure 32-bit CPU profile

With `-mcpu=power4`, code might use instructions like `fcfid`, excluding
older CPUs like the PowerPC G4, which apparently some users would like
to use.  The generic `-mcpu=powerpc` should stick to pure 32-bit PowerPC
instructions.

Fixes rust-lang/cargo#3852.

7 years agoRollup merge of #41075 - aidanhs:aphs-enable-appveyor-cache, r=alexcrichton
Corey Farwell [Fri, 7 Apr 2017 13:20:07 +0000 (09:20 -0400)]
Rollup merge of #41075 - aidanhs:aphs-enable-appveyor-cache, r=alexcrichton

Re-enable appveyor cache

After breaking the queue last time, I'm cautiously back with a PR to re-enable caching on appveyor.

If you look at https://ci.appveyor.com/project/rust-lang/rust/build/1.0.2623/job/46o90by4ari6gege (one of the multiple runs that started failed, there are actually two errors - one for restoring the cache, one right at the bottom for creating a directory. I only noticed the restore error at the time as I was a bit rushed to revert and didn't stop to wonder why it continued - turns out appveyor [does not abort on cache restore failure](https://github.com/appveyor/ci/issues/723).

Turns out the cause of the build failures was the cache directory existing and me being thinking that because mkdir on windows is [recursive by default](http://stackoverflow.com/a/905239/2352259), it ignores the error if the directory already exists. Apparently this is not true, so now it checks if the directory exists before attempting to create.

In addition, I've added some more paranoia to double check everything is sane.

7 years agoRollup merge of #41061 - arielb1:parent-lock, r=eddyb
Corey Farwell [Fri, 7 Apr 2017 13:20:06 +0000 (09:20 -0400)]
Rollup merge of #41061 - arielb1:parent-lock, r=eddyb

cstore: return an immutable borrow from `visible_parent_map`

This prevents an ICE when `visible_parent_map` is called multiple times, for example when an item referenced in an impl signature is imported from an  `extern crate` statement occurs within an impl.

Fixes #41053.

r? @eddyb

7 years agoRollup merge of #41056 - michaelwoerister:central-defpath-hashes, r=nikomatsakis
Corey Farwell [Fri, 7 Apr 2017 13:20:05 +0000 (09:20 -0400)]
Rollup merge of #41056 - michaelwoerister:central-defpath-hashes, r=nikomatsakis

Handle DefPath hashing centrally as part of DefPathTable (+ save work during SVH calculation)

In almost all cases where we construct a `DefPath`, we just hash it and throw it away again immediately.
With this PR, the compiler will immediately compute and store the hash for each `DefPath` as it is allocated. This way we
+ can get rid of any subsequent `DefPath` hash caching (e.g. the `DefPathHashes`),
+ don't need to allocate a transient `Vec` for holding the `DefPath` (although I'm always surprised how little these small, dynamic allocations seem to hurt performance), and
+ we don't hash `DefPath` prefixes over and over again.

That last part is because we construct the hash for `prefix::foo` by hashing `(hash(prefix), foo)` instead of hashing every component of prefix.

The last commit of this PR is pretty neat, I think:
```
The SVH (Strict Version Hash) of a crate is currently computed
by hashing the ICHes (Incremental Computation Hashes) of the
crate's HIR. This is fine, expect that for incr. comp. we compute
two ICH values for each HIR item, one for the complete item and
one that just includes the item's interface. The two hashes are
are needed for dependency tracking but if we are compiling
non-incrementally and just need the ICH values for the SVH,
one of them is enough, giving us the opportunity to save some
work in this case.
```

r? @nikomatsakis

This PR depends on https://github.com/rust-lang/rust/pull/40878 to be merged first (you can ignore the first commit for reviewing, that's just https://github.com/rust-lang/rust/pull/40878).

7 years agoRollup merge of #41047 - cuviper:src_is_git, r=alexcrichton
Corey Farwell [Fri, 7 Apr 2017 13:20:04 +0000 (09:20 -0400)]
Rollup merge of #41047 - cuviper:src_is_git, r=alexcrichton

Only use cargo-vendor if building from git sources

The only time we need to vendor sources is when building from git.  If one is
building from a rustc source tarball, everything should already be in place.
This also matters for distros which do offline builds, as they can't install
cargo-vendor this way.

This adds a common `Build::src_is_git` flag, and then uses it in the dist-src
target to decide whether to install or use `cargo-vendor` at all.

Fixes #41042.

7 years agoRollup merge of #40797 - GAJaloyan:patch-1, r=arielb1
Corey Farwell [Fri, 7 Apr 2017 13:20:03 +0000 (09:20 -0400)]
Rollup merge of #40797 - GAJaloyan:patch-1, r=arielb1

Correcting mistakes in the README.md

Correcting the two mistakes in the README.md (issue #40793)

7 years agoMention interrupts and green threads
Jon Gjengset [Fri, 7 Apr 2017 13:13:06 +0000 (09:13 -0400)]
Mention interrupts and green threads

7 years agorustdoc needs space after # to ignore
Jon Gjengset [Fri, 7 Apr 2017 13:11:07 +0000 (09:11 -0400)]
rustdoc needs space after # to ignore

7 years agoAuto merge of #40971 - malbarbo:android-emulator-64, r=alexcrichton
bors [Fri, 7 Apr 2017 12:51:18 +0000 (12:51 +0000)]
Auto merge of #40971 - malbarbo:android-emulator-64, r=alexcrichton

Use 64 bits emulator to run android tests

Also install headless jre instead of the full jre.

7 years agoSVH: Don't hash the HIR twice when once is enough.
Michael Woerister [Mon, 3 Apr 2017 17:39:12 +0000 (19:39 +0200)]
SVH: Don't hash the HIR twice when once is enough.

The SVH (Strict Version Hash) of a crate is currently computed
by hashing the ICHes (Incremental Computation Hashes) of the
crate's HIR. This is fine, expect that for incr. comp. we compute
two ICH values for each HIR item, one for the complete item and
one that just includes the item's interface. The two hashes are
are needed for dependency tracking but if we are compiling
non-incrementally and just need the ICH values for the SVH,
one of them is enough, giving us the opportunity to save some
work in this case.

7 years agoICH: Centrally compute and cache DefPath hashes as part of DefPathTable.
Michael Woerister [Mon, 3 Apr 2017 17:20:26 +0000 (19:20 +0200)]
ICH: Centrally compute and cache DefPath hashes as part of DefPathTable.

7 years agoAuto merge of #40873 - cramertj:on-demandify-queries, r=nikomatsakis
bors [Fri, 7 Apr 2017 08:36:11 +0000 (08:36 +0000)]
Auto merge of #40873 - cramertj:on-demandify-queries, r=nikomatsakis

On demandify reachability

cc https://github.com/rust-lang/rust/issues/40746

I tried following this guidance from #40746:
> The following tasks currently execute before a tcx is built, but they could be easily converted into queries that are requested after tcx is built. The main reason they are the way they are was to avoid a gratuitious refcell (but using the refcell map seems fine)...

but the result of moving `region_maps` out of `TyCtxt` and into a query caused a lot of churn, and seems like it could potentially result in a rather large performance hit, since it means a dep-graph lookup on every use of `region_maps` (rather than just a field access). Possibly `TyCtxt` could store a `RefCell<Option<RegionMap>>` internally and use that to prevent repeat lookups, but that feels like it's duplicating the work of the dep-graph. @nikomatsakis What did you have in mind for this?

7 years agotravis: Use upstream LLVM repositories for Fuchsia
Petr Hosek [Fri, 7 Apr 2017 01:49:41 +0000 (18:49 -0700)]
travis: Use upstream LLVM repositories for Fuchsia

The Fuchsia copies of LLVM repositories contain additional patches
for work-in-progress features and there is some amount of churn that
may break Rust. Use upstream LLVM repositories instead for building
the toolchain used by the Fuchsia builder.

7 years agodocument some existing unstable features
Jorge Aparicio [Fri, 7 Apr 2017 06:05:03 +0000 (01:05 -0500)]
document some existing unstable features

"msp430-interrupt", "ptx-kernel" and #![compiler_builtins_lib]

7 years agoAuto merge of #39987 - japaric:used, r=arielb1
bors [Fri, 7 Apr 2017 04:56:45 +0000 (04:56 +0000)]
Auto merge of #39987 - japaric:used, r=arielb1

#[used] attribute

(For an explanation of what this feature does, read the commit message)

I'd like to propose landing this as an experimental feature (experimental as in:
no clear stabilization path -- like `asm!`, `#[linkage]`) as it's low
maintenance (I think) and relevant to the "Usage in resource-constrained
environments" exploration area.

The main use case I see is running code before `main`. This could be used, for
instance, to cheaply initialize an allocator before `main` where the alternative
is to use `lazy_static` to initialize the allocator on its first use which it's
more expensive (atomics) and doesn't work on ARM Cortex-M0 microcontrollers (no
`AtomicUsize` on that platform)

Here's a `std` example of that:

``` rust

unsafe extern "C" fn before_main_1() {
    println!("Hello");
}

unsafe extern "C" fn before_main_2() {
    println!("World");
}

#[link_section = ".init_arary"]
#[used]
static INIT_ARRAY: [unsafe extern "C" fn(); 2] = [before_main_1, before_main_2];

fn main() {
    println!("Goodbye");
}
```

```
$ rustc -C lto -C opt-level=3 before_main.rs
$ ./before_main
Hello
World
Goodbye
```

In general, this pattern could be used to let *dependencies* run code before
`main` (which sounds like it could go very wrong in some cases). There are
probably other use cases; I hope that the people I have cc-ed can comment on
those.

Note that I'm personally unsure if the above pattern is something we want to
promote / allow and that's why I'm proposing this feature as experimental. If
this leads to more footguns than benefits then we can just axe the feature.

cc @nikomatsakis ^ I know you have some thoughts on having a process for
experimental features though I'm fine with writing an RFC before landing this.

- `dead_code` lint will have to be updated to special case `#[used]` symbols.

- Should we extend `#[used]` to work on non-generic functions?

cc rust-lang/rfcs#1002
cc rust-lang/rfcs#1459
cc @dpc @JinShil

7 years agodon't pass -C to nm
Jorge Aparicio [Fri, 7 Apr 2017 04:53:32 +0000 (23:53 -0500)]
don't pass -C to nm

the nm in our macOS bots don't support that flag and it's not really required

7 years agoCorrect book examples for hardware re-ordering
Jon Gjengset [Fri, 7 Apr 2017 03:29:16 +0000 (23:29 -0400)]
Correct book examples for hardware re-ordering

7 years agoChanges based on PR feedback
Ryan Scott [Fri, 7 Apr 2017 03:20:37 +0000 (12:20 +0900)]
Changes based on PR feedback

7 years agorustdoc: collapse docblock before showing label
Andy Russell [Thu, 6 Apr 2017 18:53:15 +0000 (14:53 -0400)]
rustdoc: collapse docblock before showing label

7 years agorustdoc: move the space at the end of where clauses
QuietMisdreavus [Thu, 6 Apr 2017 23:36:14 +0000 (18:36 -0500)]
rustdoc: move the space at the end of where clauses

...so that we don't indent the next line by one extra space

7 years agoignore the .init_array doctest
Jorge Aparicio [Thu, 6 Apr 2017 23:32:39 +0000 (18:32 -0500)]
ignore the .init_array doctest

as it's specific to ELF and won't pass on macOS / Windows

7 years agoAuto merge of #41121 - frewsxcv:rollup, r=frewsxcv
bors [Thu, 6 Apr 2017 22:51:51 +0000 (22:51 +0000)]
Auto merge of #41121 - frewsxcv:rollup, r=frewsxcv

Rollup of 8 pull requests

- Successful merges: #40878, #40976, #41089, #41090, #41108, #41111, #41112, #41114
- Failed merges:

7 years agoRemove some CStr transmutes.
Clar Charr [Thu, 6 Apr 2017 18:43:37 +0000 (14:43 -0400)]
Remove some CStr transmutes.

7 years agoAuto merge of #40863 - eddyb:coerce-only-once, r=arielb1
bors [Thu, 6 Apr 2017 20:15:17 +0000 (20:15 +0000)]
Auto merge of #40863 - eddyb:coerce-only-once, r=arielb1

Avoid type-checking addition and indexing twice.

Fixes #40610 by moving the common `check_expr_coercable_to_type` call before the error reporting logic for binops and removing the one from `check_str_addition`.
Fixes #40861 by removing an unnecessary `check_expr_coercable_to_type` call.

7 years agorustdoc: where clause adjustment to fix tests
QuietMisdreavus [Thu, 6 Apr 2017 19:19:45 +0000 (14:19 -0500)]
rustdoc: where clause adjustment to fix tests

- add spaces to output so stripping lines and breaking spaces renders
  the same
- add commas to where clauses in rustdoc tests to match the new output

7 years agoRollup merge of #41114 - nodakai:patch-2, r=petrochenkov
Corey Farwell [Thu, 6 Apr 2017 18:55:09 +0000 (14:55 -0400)]
Rollup merge of #41114 - nodakai:patch-2, r=petrochenkov

.gitmodules: use the official Git URL w/o redirect

7 years agoRollup merge of #41112 - ollie27:rustdoc_pull, r=GuillaumeGomez
Corey Farwell [Thu, 6 Apr 2017 18:55:08 +0000 (14:55 -0400)]
Rollup merge of #41112 - ollie27:rustdoc_pull, r=GuillaumeGomez

rustdoc: Use pulldown-cmark for Markdown HTML rendering

Instead of rendering all of the HTML in rustdoc this relies on
pulldown-cmark's `push_html` to do most of the work. A few iterator
adapters are used to make rustdoc specific modifications to the output.

This also fixes MarkdownHtml and link titles in plain_summary_line.

https://ollie27.github.io/rust_doc_test/ is the docs built with this change and #41111.

Part of #40912.

cc @GuillaumeGomez

r? @steveklabnik

7 years agoRollup merge of #41111 - ollie27:docs_markdown_fix, r=GuillaumeGomez
Corey Farwell [Thu, 6 Apr 2017 18:55:07 +0000 (14:55 -0400)]
Rollup merge of #41111 - ollie27:docs_markdown_fix, r=GuillaumeGomez

Fix Markdown issues in the docs

* Since the switch to pulldown-cmark reference links need a blank line
before the URLs. (#40912)
* Reference link references are not case sensitive.
* Doc comments need to be indented uniformly otherwise rustdoc gets
confused.

7 years agoRollup merge of #41108 - arielb1:tuple-blame, r=estebank
Corey Farwell [Thu, 6 Apr 2017 18:55:06 +0000 (14:55 -0400)]
Rollup merge of #41108 - arielb1:tuple-blame, r=estebank

don't try to blame tuple fields for immutability

Tuple fields don't have an `&T` in their declaration that can be changed
to `&mut T` - skip them..

Fixes #41104.

r? @nikomatsakis

7 years agoRollup merge of #41090 - rap2hpoutre:patch-2, r=steveklabnik
Corey Farwell [Thu, 6 Apr 2017 18:55:05 +0000 (14:55 -0400)]
Rollup merge of #41090 - rap2hpoutre:patch-2, r=steveklabnik

Add example to std::process::abort

This is a second step in order to complete this issue: https://github.com/rust-lang/rust/issues/29370
I submitted this PR with the help of @steveklabnik again. Thanks to him! More info here: https://github.com/rust-lang/rust/issues/29370#issuecomment-290653877

7 years agoRollup merge of #41089 - alexcrichton:update-musl, r=brson
Corey Farwell [Thu, 6 Apr 2017 18:55:04 +0000 (14:55 -0400)]
Rollup merge of #41089 - alexcrichton:update-musl, r=brson

travis: Update musl for i686/x86_64

This is a random stab towards #38618, no idea if it'll work. But hey more
up-to-date software is better, right?

7 years agoRollup merge of #40976 - matthewjasper:char-const-expr, r=eddyb
Corey Farwell [Thu, 6 Apr 2017 18:55:03 +0000 (14:55 -0400)]
Rollup merge of #40976 - matthewjasper:char-const-expr, r=eddyb

Don't warn about `char` comparisons in constexprs

Fixes #40970 by evaluating const-exprs for comparisons on `char`s properly.

7 years agoRollup merge of #40878 - michaelwoerister:dmh, r=nikomatsakis
Corey Farwell [Thu, 6 Apr 2017 18:55:02 +0000 (14:55 -0400)]
Rollup merge of #40878 - michaelwoerister:dmh, r=nikomatsakis

Introduce HashStable trait and base ICH implementations on it.

This PR introduces the `HashStable` trait which marks that a type can be hashed in a way that is stable across multiple compilation sessions. The PR also moves HIR incr. comp. hashing over to implementations of this trait instead of doing this via a HIR visitor. It also provides many `HashStable` implementations that are not used yet (e.g. for MIR types) but soon will be used when we directly hash crate metadata for incr. comp.

I've only done superficial performance measurements but it looks like the new implementation is a bit faster than the current one (due, I suppose, to some bugs I fixed and some unnecessary inefficiencies I removed). Here is the time in seconds for the `compute_incremental_hashes_map` pass for various crates:

|                 |  OLD  |  NEW  |
|:---------------:|:-----:|:-----:|
| libcore         | 0.507 | 0.409 |
| libsyntax       | 0.320 | 0.260 |
| librustc        | 0.730 | 0.611 |
| librustc_driver | 0.024 | 0.015 |

Some notes regarding the implementation:
* Most `HashStable` implementations are provided via the `impl_hash_stable_for!` macro (as suggested by @nikomatsakis). This works out quite well. A custom_derive would have been better but Macros 1.1 are not available in the compiler.
* The trait implementation take care to exhaustively destructure everything they hash so that fields added in the future don't fall through the cracks. This is a bit verbose but I think it's well worth the trouble since we've had quite a few issues with missing fields or visitor callbacks in this area in the past. Most of it is behind the macro anyway.

cc @rust-lang/compiler
r? @nikomatsakis