Commit Graph

63275 Commits

Author SHA1 Message Date
Austin Hicks
8b00837691 UI test for -Z print-fuel=foo 2017-04-11 14:36:08 +03:00
Austin Hicks
912599944e Tests for -Z fuel=foo=n 2017-04-11 14:36:08 +03:00
Austin Hicks
4db9c7a2a2 Make a comment better. 2017-04-11 14:36:07 +03:00
Austin Hicks
63ebf08be5 Initial attempt at implementing optimization fuel and re-enabling struct field reordering. 2017-04-11 14:36:05 +03:00
bors
6edc596853 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.
2017-04-11 08:57:39 +00:00
Eduard-Mihai Burtescu
0303a3364b Fix pairs of doubles using an illegal <8 x i8> vector. 2017-04-11 11:33:30 +03:00
bors
8d85504410 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
```
2017-04-11 05:44:06 +00:00
Aidan Hobson Sayers
f297767b2c Make sccache a bit quieter 2017-04-11 00:22:26 +01:00
bors
730e5ad04e 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.
2017-04-10 21:56:13 +00:00
Esteban Küber
be8787dfe5 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.
2017-04-10 14:28:38 -07:00
Nathaniel Ringo
b9d662a000 Fixes incorrect formatting in array's documentation. 2017-04-10 16:12:39 -05:00
Esteban Küber
4c80170782 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.
2017-04-10 14:03:17 -07:00
Brian Anderson
1c3f34dba6 Convert HashMap to BTree in build-manifest 2017-04-10 20:50:57 +00:00
bors
3b5754e5ce 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.
2017-04-10 18:00:23 +00:00
lukaramu
12d7c3d9d8 Fixed indent, grammar, and link in std::hash docs 2017-04-10 17:50:54 +02:00
Jorge Aparicio
e192fb3d89 explain why we have a fake cfail test 2017-04-10 09:55:52 -05:00
Jorge Aparicio
251d9be429 --subsystem needs -Wl when using non-ld linkers 2017-04-10 09:53:24 -05:00
bors
8493dd6d6e 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.
2017-04-10 13:07:35 +00:00
bors
2bdf368bde 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.
2017-04-10 09:45:16 +00:00
bors
22bae87f3b 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.
2017-04-10 04:41:15 +00:00
mandeep
1e7f3551d1 Added doc comments for fmt::Result 2017-04-09 23:07:18 -05:00
Andre Bogus
0867981f5e 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.
2017-04-10 05:53:10 +02:00
bors
13744ca91c Auto merge of #41175 - goffrie:patch-1, r=frewsxcv
Minor fix to mutex example

Presumably `N` was supposed to be used in both places.
2017-04-10 02:24:44 +00:00
Geoffry Song
3d60bf45f4 Minor fix to mutex example
Presumably `N` was supposed to be used in both places.
2017-04-09 19:42:01 -04:00
bors
683fa7438f Auto merge of #40653 - frewsxcv:tidy-handling, r=alexcrichton
A couple minor improvements for tidy error handling.

None
2017-04-09 23:23:11 +00:00
Clar Charr
a2b28be3f8 Reduce str transmutes, add mut versions of methods. 2017-04-09 19:13:54 -04:00
bors
ad36c2f552 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;`
```
2017-04-09 20:54:50 +00:00
Esteban Küber
4bc7f5b52c 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;`
```
2017-04-09 13:48:25 -07:00
Nick Cameron
5766d526a2 Remove --enable-save-analysis configure flag 2017-04-10 08:46:20 +12:00
Nick Cameron
223b280f31 Reviewer changes 2017-04-10 08:30:34 +12:00
Nick Cameron
c55325e0f7 Build an RLS package as part of the dist target 2017-04-10 08:30:34 +12:00
Nick Cameron
7da12c8541 Add the RLS as a submodule 2017-04-10 08:30:34 +12:00
Corey Farwell
f789d896cb Print tidy errors to stderr, prefix with 'tidy error: ', handle 'bad' state. 2017-04-09 13:59:09 -04:00
bors
d616f47cd0 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
2017-04-09 17:51:32 +00:00
Guillaume Gomez
d4aecf52db Fix block code headers parsing 2017-04-09 18:31:59 +02:00
Aaron Hill
63a291feba
Fix rustdoc infinitely recursing when an external crate reexports itself
Previously, rustdoc's LibEmbargoVisitor unconditionally visited the
child modules of an external crate. If a module re-exported its parent
via 'pub use super::*', rustdoc would re-walk the parent, leading to
infinite recursion.

This commit makes LibEmbargoVisitor store already visited modules in an
FxHashSet, ensuring that each module is only walked once.

Fixes #40936
2017-04-09 12:12:05 -04:00
Simonas Kazlauskas
c337b99f4c Fix test failures 2017-04-09 18:55:49 +03:00
Simonas Kazlauskas
486345551c into_inner to associated function 2017-04-09 18:55:49 +03:00
Simonas Kazlauskas
c94b3f1266 Replace the forget intrinsic with ManuallyDrop
less intrinsics = better life
2017-04-09 18:55:49 +03:00
Simonas Kazlauskas
38713126dd Move away from the ad-hoc NoDrop unions 2017-04-09 18:55:47 +03:00
Simonas Kazlauskas
f6e566185e Implement Manually Drop 2017-04-09 18:50:50 +03:00
QuietMisdreavus
8dd4c44ef6 merge with master to pick up pulldown switch 2017-04-09 10:38:38 -05:00
bors
fa332c9015 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
2017-04-09 15:30:20 +00:00
bors
2c48ae6f7f 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.
2017-04-09 13:08:10 +00:00
Eduard-Mihai Burtescu
f0636b61c7 rustc_trans: use ty::layout for ABI computation instead of LLVM types. 2017-04-09 16:06:56 +03:00
bors
ebb10a6131 Auto merge of #41095 - clarcharr:as_extras, r=alexcrichton
Add as_c_str

Again, tying up some consistencies with `CString`.
2017-04-09 09:17:34 +00:00
bors
cff81da514 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
2017-04-09 05:49:31 +00:00
bors
c2d186a3c9 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.
2017-04-09 03:30:09 +00:00
bors
b2d9b6323e 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.
2017-04-08 22:37:35 +00:00
Jorge Aparicio
2fed2a2395 this code block is text not Rust code 2017-04-08 15:51:18 -05:00