Commit Graph

73373 Commits

Author SHA1 Message Date
Niko Matsakis
b452c432cd avoid ICE when fields are not laid out in order 2017-12-26 12:26:39 +01:00
Bastian Köcher
d7918fb2e8 Implements RFC 1937: ? in main
This is the first part of the RFC 1937 that supports new
`Termination` trait in the rust `main` function.
2017-12-26 12:26:39 +01:00
Marco A L Barbosa
606a0a5da0 Add dist builder for armv5te-unknown-linux-gnueabi 2017-12-26 09:21:09 -02:00
bors
0efdfa1d62 Auto merge of #46941 - ScottAbbey:freebsd-build-update, r=alexcrichton
Re-do the FreeBSD cross-builds to use Clang and libc++. Fixes #44433

Reviving #45077, from @jld:

> The main goal here is to use FreeBSD's normal libc++, instead of
> statically linking the libstdc++ packaged with GCC, because that
> libstdc++ has bugs that cause rustc to deadlock inside LLVM.
>
> But the easiest way to use libc++ is to switch the build from GCC to
> Clang, and the Clang package in the Ubuntu image already knows how to
> cross-compile (given a sysroot and preferably cross-binutils), so the
> toolchain script now uses that instead of building a custom compiler.
>
> This also de-duplicates the build-toolchain.sh script.

#45077 was close but didn't quite make it.  I rebased @jld's work off the current `master` and started with that.

I was able to determine that this Travis error (https://github.com/rust-lang/rust/pull/45077#issuecomment-336029862) was ultimately caused by `src/librustc_llvm/build.rs` attempting to follow a wrong value in `LLVM_STATIC_STDCPP` (https://github.com/rust-lang/rust/pull/45077#issuecomment-352639456).

I looked at the downstream port for FreeBSD (https://svnweb.freebsd.org/ports/head/lang/rust/) and it seems like they do not use `--enable-llvm-static-stdcpp`.

Since `libc++` is included in the FreeBSD 10+ base system, we don't need to statically link it either?

So in b989428f7d I have set the FreeBSD build to not actually use `LLVM_STATIC_STDCPP`.

I was able to run `./src/ci/docker/run.sh` with both `dist-i686-freebsd` and `dist-x86_64-freebsd` successfully and in about 1 minute of testing it seemed like the dist-x86_64-freebsd results worked on a FreeBSD 11 system.

It should fix #44433, which seems to be affecting many potential users.  Also FreeBSD users should be able to `./x.py build` which should help anyone who wants to upstream fixes for FreeBSD.

Questions:

Does this approach seem to be the right way to go? Do we actually really want to statically link `libc++`? (I tried that here, but it ultimately ran into a roadblock on x86_64: https://github.com/rust-lang/rust/pull/45077#issuecomment-353293414)

Can we rewrite the comment here to be more clear about why some systems aren't going to actually use this option:
b989428f7d/src/bootstrap/compile.rs (L550-L553)

How does this affect users of older FreeBSD systems? It seemed like no one was complaining about using a 10.3 base version in the thread for #45077.  FreeBSD seems to only officially support 10.3, 10.4, and 11.x right now, do we have to consider older users? The `libc++` stuff came in for FreeBSD 10, older FreeBSD used `libstdc++`.

Looks like @alexcrichton was leading the discussion on the previous issue:

r? @alexcrichton

Let me know what I can do to help get this through.
2017-12-26 11:16:12 +00:00
Seiichi Uchida
f6f9cbe560 Add tests to fixed ICEs
Closes #27078. Closes #27985. Closes #39848. Closes #42164.
Closes #42479. Closes #45152. Closes #45662. Closes #45876.
Closes #45965.
2017-12-26 19:24:48 +09:00
bors
8cdde6db71 Auto merge of #47012 - kennytm:rollup, r=kennytm
Rollup of 8 pull requests

- Successful merges: #46928, #46930, #46933, #46939, #46940, #46943, #46979, #46986
- Failed merges:
2017-12-26 08:33:23 +00:00
Seiichi Uchida
18da3c671b Do not expand a derive invocation when derive is not allowed
1. Change the return type of `expand_invoc()` and its subroutines to
   `Option<Expansion>` from `Expansion`.
2. Return `None` when expanding a derive invocation if the item cannot
   have derive on it (in `expand_derive_invoc()`).
2017-12-26 16:47:32 +09:00
kennytm
6b1aa5301f Rollup merge of #46986 - nvzqz:basic-usage, r=steveklabnik
Add "Basic Usage" to int min_value and max_value docs

This adds "Basic Usage:" to the docs of `min_value` and `max_value`, which makes it consistent with docs of other integer methods.
2017-12-26 15:19:00 +08:00
kennytm
c1d2eca7ba Rollup merge of #46979 - clarcharr:rustc_docs, r=arielb1
Make internal docs build properly.

`'1` isn't a valid lifetime and resulted in a syntax error.
2017-12-26 15:18:59 +08:00
kennytm
4ababefc55 Rollup merge of #46943 - malbarbo:process-test-busybox, r=alexcrichton
Fix process test when using busybox mkdir

busybox mkdir . returns 0
busybox mkdir ./ returns 1
2017-12-26 15:18:59 +08:00
kennytm
720a4b53f5 Rollup merge of #46940 - EdSchouten:cloudabi, r=alexcrichton
Add support for CloudABI targets to the rustc backend.

CloudABI is a sandboxed UNIX-like runtime environment. It is a
programming environment that uses a capability-based security model. In
practice this means that many POSIX interfaces are present, except for
ones that try to access resources out of thin air. For example, open()
is gone, but openat() is present.

Right now I'm at the point where I can compile very basic CloudABI
applications on all four supported architectures (ARM and x86, 32 and 64
bits). The next step will be to get libstd to work. Patches for that are
outside the scope of this change.

More info: https://nuxi.nl/cloudabi/ https://github.com/NuxiNL/cloudlibc/
2017-12-26 15:18:58 +08:00
kennytm
32016d5eb1 Rollup merge of #46939 - davidalber:code-of-conduct-mod-team-link, r=kennytm
Fixing Rust Moderation Team link in Code of Conduct

The [Code of Conduct](https://github.com/rust-lang/rust/blob/master/CODE_OF_CONDUCT.md) has two broken links to the Rust Moderation Team.
- The current link is https://github.com/rust-lang/rust/blob/master/team.html#Moderation. That happened because the link is relative.
- The link in this PR is https://www.rust-lang.org/team.html#Moderation-team. Note: at the moment this is redirected client-side to a language-specific page and loses the fragment identifier. rust-lang/rust-www#992 aims to correct that.
2017-12-26 15:18:57 +08:00
kennytm
0ca5ce26ba Rollup merge of #46933 - clarcharr:float_docs, r=steveklabnik
Make core::f32/f64 docs match std.

For some reason these weren't in sync.
2017-12-26 15:18:56 +08:00
kennytm
ba39972378 Rollup merge of #46930 - lucis-fluxum:patch-1, r=QuietMisdreavus
Clarify docs for split_at_mut

The `&mut` here didn't make immediate sense to me. Keep the docs for this function consistent with the non-mut version.
2017-12-26 15:18:55 +08:00
kennytm
a4a3de6ba2 Rollup merge of #46928 - varkor:contrib-10, r=alexcrichton
Correct the return type for `x86_mm256_sad_epu8`

Fixes #43439.
2017-12-26 15:18:53 +08:00
bors
2e83f3c968 Auto merge of #47000 - kennytm:follow-up-46924, r=arielb1
Follow up to #46924, fix massive spurious failure when starting docker

It seems using `fe80::/64` causes `docker start` to fail with "Address already in use". Try to change to a unique local address range instead.

`fe80::/64` is a link-local address (similar to `169.254.0.0/16` in IPv4). Let's try to use a random "private network" address to see whether that fixes things.

cc #47002

r? @aidanhs
2017-12-26 05:46:11 +00:00
Clar Charr
8e80c57113 Make internal docs build properly. 2017-12-25 18:11:45 -05:00
bors
ebddfcb0b1 Auto merge of #46973 - arielb1:tuple-casting, r=estebank
Update check::cast::pointer_kind logic to new rustc

Make the match exhaustive, adding handling for anonymous types and
tuple coercions on the way.

Also, exit early when type errors are detected, to avoid error cascades
and the like.

Fixes #33690.
Fixes #46365.
Fixes #46880.
2017-12-25 23:00:39 +00:00
Nikolai Vazquez
0fbcb7b873 Remove transmute in From<&str> impls for Arc/Rc 2017-12-25 17:04:45 -05:00
kennytm
472a3c104b
Follow up to #46924
It seems using `fe80::/64` causes `docker start` to fail with "Address
already in use". Try to change to a unique local address range instead.
2017-12-26 02:36:17 +08:00
kennytm
ec302a2714
Fixup some previous configuration errors. 2017-12-26 02:14:54 +08:00
Esteban Küber
fed4fcb318 "incompatible arm" diagnostic span tweak
Use span label instead of span note for single line spans in
"incompatible arm" diagnostic.
2017-12-25 09:47:22 -08:00
est31
6081989adc Fix docs mistake 2017-12-25 14:15:59 +01:00
bors
4a7c072fa6 Auto merge of #46971 - green-s:master, r=alexcrichton
Update compiler_builtins

Fixes #46822 (see https://github.com/rust-lang-nursery/compiler-builtins/pull/219)
2017-12-25 12:55:52 +00:00
bors
b159eeb6b9 Auto merge of #46949 - davidtwco:issue-46631, r=arielb1
MIR borrowck: no "move occurs because `X` is not Copy` error

Fixes #46631.

r? @arielb1
2017-12-25 10:07:28 +00:00
Manish Goregaokar
85919a0b5f Pass tidy for tests 2017-12-25 14:41:16 +05:30
bors
0cd67581e7 Auto merge of #46924 - kennytm:revert-46694, r=aidanhs
Revert #46694 (Temporarily use the old Travis image)

This PR reverts #46694, and applies the solution recommended in https://github.com/travis-ci/travis-ci/issues/8891#issuecomment-353403729.

r? @aidanhs
2017-12-25 07:29:16 +00:00
Corey Farwell
66ef6b9c09 Deprecate [T]::rotate in favor of [T]::rotate_{left,right}.
Background
==========

Slices currently have an unstable [`rotate`] method which rotates
elements in the slice to the _left_ N positions. [Here][tracking] is the
tracking issue for this unstable feature.

```rust
let mut a = ['a', 'b' ,'c', 'd', 'e', 'f'];
a.rotate(2);
assert_eq!(a, ['c', 'd', 'e', 'f', 'a', 'b']);
```

Proposal
========

Deprecate the [`rotate`] method and introduce `rotate_left` and
`rotate_right` methods.

```rust
let mut a = ['a', 'b' ,'c', 'd', 'e', 'f'];
a.rotate_left(2);
assert_eq!(a, ['c', 'd', 'e', 'f', 'a', 'b']);
```

```rust
let mut a = ['a', 'b' ,'c', 'd', 'e', 'f'];
a.rotate_right(2);
assert_eq!(a, ['e', 'f', 'a', 'b', 'c', 'd']);
```

Justification
=============

I used this method today for my first time and (probably because I’m a
naive westerner who reads LTR) was surprised when the docs mentioned that
elements get rotated in a left-ward direction. I was in a situation
where I needed to shift elements in a right-ward direction and had to
context switch from the main problem I was working on and think how much
to rotate left in order to accomplish the right-ward rotation I needed.

Ruby’s `Array.rotate` shifts left-ward, Python’s `deque.rotate` shifts
right-ward. Both of their implementations allow passing negative numbers
to shift in the opposite direction respectively.

Introducing `rotate_left` and `rotate_right` would:

- remove ambiguity about direction (alleviating need to read docs 😉)
- make it easier for people who need to rotate right

[`rotate`]: https://doc.rust-lang.org/std/primitive.slice.html#method.rotate
[tracking]: https://github.com/rust-lang/rust/issues/41891
2017-12-24 23:01:24 -08:00
bors
a6fc84440f Auto merge of #46914 - mikeyhew:raw_pointer_self, r=arielb1
Convert warning about `*const _` to a future-compat lint

#46664 was merged before I could convert the soft warning about method lookup on `*const _` into a future-compatibility lint. This PR makes that change.

fixes #46837
tracking issue for the future-compatibility lint: #46906

r? @arielb1
2017-12-25 04:55:57 +00:00
bors
ae65dcc30f Auto merge of #46910 - alexcrichton:thinlto-default, r=michaelwoerister
rustc: Set release mode cgus to 16 by default

This commit is the next attempt to enable multiple codegen units by default in
release mode, getting some of those sweet, sweet parallelism wins by running
codegen in parallel. Performance should not be lost due to ThinLTO being on by
default as well.

Closes #45320
2017-12-25 02:14:35 +00:00
bors
a834b86178 Auto merge of #46899 - m4b:linkage_name_equals_symbol_name, r=michaelwoerister
Set the dwarf linkage_name to the mangled name

ref #46453

@michaelwoerister or anyone else who knows, i'm not sure if this is the correct instance to pass here (or how to get the correct one precisely): 5a94a48678/src/librustc_trans/debuginfo/namespace.rs (L36)

So don't merge this yet, I'd like to learn about correct instance first; however, I think this already fixes a bunch of weirdness i'm seeing debugging from time to time, not to mention backtraces in gdb via `bt` are now ~readable~ meaningful 🎉

E.g.:

new:
```
(gdb) bt
#0  <inline::Foo as core::convert::From<()>>::from () at /home/m4b/tmp/bad_debug/inline.rs:11
#1  0x000055555555a35d in inline::deadbeef () at /home/m4b/tmp/bad_debug/inline.rs:16
#2  0x000055555555a380 in inline::main () at /home/m4b/tmp/bad_debug/inline.rs:20
```

old:
```
(gdb) bt
#0  inline::{{impl}}::from () at /home/m4b/tmp/bad_debug/inline.rs:11
#1  0x000055555555b0ed in inline::deadbeef () at /home/m4b/tmp/bad_debug/inline.rs:16
#2  0x000055555555b120 in inline::main () at /home/m4b/tmp/bad_debug/inline.rs:20
```
2017-12-24 23:35:19 +00:00
bors
c284f8807e Auto merge of #46789 - Diggsey:command-env-capture, r=dtolnay
Capture `Command` environment at spawn

Fixes #28975

This tracks a set of changes to the environment and then replays them at spawn time.
2017-12-24 20:57:20 +00:00
Corey Farwell
17380f2ac6 Minor rewrite of env::current_exe docs; clarify symlinks.
- Update example in ‘security’ section to use hard links, like the
  linked securityvulns.com example.
- Weaken language on symbolic links – indicate behavior is
  platform-specific

Fixes https://github.com/rust-lang/rust/issues/43617.
2017-12-24 11:29:13 -08:00
Nikolai Vazquez
c08a51c826 Add "Basic Usage" to int min_value, max_value docs 2017-12-24 14:01:48 -05:00
bors
b9e4d3417f Auto merge of #46630 - alexcrichton:update-git2, r=nikomatsakis
Update Cargo and its dependencies

Just a routine update!
2017-12-24 18:05:00 +00:00
Alex Crichton
325d739456 Update Cargo and its dependencies
Just a routine update!
2017-12-24 07:46:48 -08:00
bors
000fbbc9b8 Auto merge of #46896 - arielb1:shadow-scope, r=eddyb
fix debuginfo scoping of let-statements

r? @eddyb
2017-12-24 15:26:17 +00:00
Diggory Blake
ccc91d7b48 Capture environment at spawn 2017-12-24 14:24:31 +00:00
Ariel Ben-Yehuda
bd1bd76cd8 fix linking of place projections
projections other than dereferences of `&mut` used to do no linking. Fix
that.

Fixes #46974.
2017-12-24 14:56:52 +02:00
Ariel Ben-Yehuda
17d4e9be2a Make killing of out-of-scope borrows a pre-statement effect
Fixes #46875.
Fixes #46917.
Fixes #46935.
2017-12-24 14:56:52 +02:00
Ariel Ben-Yehuda
063b998950 add pre-statement-effect to dataflow 2017-12-24 14:56:52 +02:00
bors
304717bd86 Auto merge of #46894 - detrumi:fix-const-eval-trait, r=eddyb
Const-eval array lengths in rustdoc.

Fixes #46727
r? @eddyb

Big thanks to @eddyb for helping me figure this out.
2017-12-24 12:48:57 +00:00
bors
4ce6b9a770 Auto merge of #46859 - gereeter:uninhabited-unions, r=eddyb
Only mark unions as uninhabited if all of their fields are uninhabited

Fixes #46845.
2017-12-24 10:07:22 +00:00
Ariel Ben-Yehuda
6aca330149 Handle casts to integer/float variables
These can happen if prior errors disable defaulting.

Fixes #43825.
2017-12-24 11:40:54 +02:00
bors
11a24d9c39 Auto merge of #46888 - cramertj:nested-impl-trait-error, r=nikomatsakis
Add a feature gate for nested uses of `impl Trait`

This allows us to delay stabilization of nested `impl Trait` until we have a plan to solve the problem posed [here](https://github.com/rust-lang/rust/issues/34511#issuecomment-350715858).

r? @nikomatsakis
2017-12-24 07:34:13 +00:00
bors
51b47dc4a1 Auto merge of #46833 - diwic:7c-abort-ffi, r=arielb1
Prevent unwinding past FFI boundaries

Second attempt to write a patch to solve this.

r? @nikomatsakis

~~So, my biggest issue with this patch is the way the patch determines *what* functions should have an abort landing pad (in `construct_fn`). I would ideally have this code match [src/librustc_trans/callee.rs::get_fn](https://github.com/rust-lang/rust/blob/master/src/librustc_trans/callee.rs#L107-L115) but couldn't find an id that returns true for `is_foreign_item`. Also tried `tcx.has_attr("unwind")` with no luck.~~ FIXED

Other issues:

 * llvm.trap is an SIGILL on amd64. Ideally we could use panic-abort's version of aborting which is nicer but we don't want to depend on that library...

 * ~~Mir inlining is a stub currently.~~ FIXED (no-op)

Also, when reviewing please take into account that I'm new to the code and only partially know what I'm doing... and that I've mostly made made matches on `TerminatorKind::Abort` match either `TerminatorKind::Resume` or `TerminatorKind::Unreachable` based on what looked best.
2017-12-24 02:42:15 +00:00
Jonathan S
da9791767b Remove unnecessary assert that unions have only one variant 2017-12-23 20:38:36 -06:00
est31
b03af365fa Fix tests 2017-12-24 03:02:28 +01:00
est31
e5c3aac0b4 Make column macro output 1 based and document it 2017-12-24 02:20:06 +01:00
Alex Crichton
b5361d0d41 rustc: Set release mode cgus to 16 by default
This commit is the next attempt to enable multiple codegen units by default in
release mode, getting some of those sweet, sweet parallelism wins by running
codegen in parallel. Performance should not be lost due to ThinLTO being on by
default as well.

Closes #45320
2017-12-23 16:04:15 -08:00