Commit Graph

73246 Commits

Author SHA1 Message Date
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
Matthew Jasper
1a308ba90a Give MIR borrowck a better understanding of inline asm 2017-12-23 23:45:07 +00:00
bors
8d4da4f4c4 Auto merge of #46881 - michaelwoerister:ensure-coherence, r=nikomatsakis
incr.comp.: Cache check_match and use ensure() for coherence-related queries.

Some minor optimizations.

r? @nikomatsakis
2017-12-23 23:06:13 +00:00
Ariel Ben-Yehuda
6163df4e2c Try to find a better pass manager order
Fixes #45466
2017-12-24 00:15:12 +02:00
Ariel Ben-Yehuda
ce58d965ef 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.
2017-12-23 23:38:09 +02:00
Sam Green
26a9f21acd Update compiler_builtins 2017-12-23 19:03:54 +00:00
Michael Hewson
60e6629045 fix doctests in libcore 2017-12-23 12:36:04 -05:00
Wilco Kusee
d10d389225 Testcase for const-eval array lengths 2017-12-23 11:16:03 +01:00
kennytm
8d76e281bf
Enable IPv6 support in Dockers to workaround travis-ci/travis-ci#8891. 2017-12-23 18:12:01 +08:00
kennytm
2352a888a1
Revert "Temporarily use the old Travis image."
This reverts commit c0c26a649e.
2017-12-23 18:10:36 +08:00
Christopher Durham
056370167a Annotate raw pointer target types
cc https://github.com/rust-lang/rust/issues/46906
cc https://github.com/rust-lang/rust/pull/46914
2017-12-23 03:47:13 -05:00
bors
1699293083 Auto merge of #46864 - estebank:closure-type-err-sp, r=nikomatsakis
Closure type error ui tweak

Do not point at the same span on all notes/help messages, and instead
show them without a span.
2017-12-23 04:40:39 +00:00
bors
565907fefb Auto merge of #46857 - estebank:use-loop-sp, r=nikomatsakis
Point at `while true` span instead of entire block
2017-12-23 02:08:27 +00:00
bors
f0cf23e115 Auto merge of #46842 - michaelwoerister:fingerprint-vec, r=nikomatsakis
incr.comp.: Use an array instead of a hashmap for storing result hashes.

Doing so should result in some of the core tracking components being faster.

r? @nikomatsakis
2017-12-22 23:34:29 +00:00
Michael Hewson
1e2bd7021a fix errors in rustc_data_structures 2017-12-22 18:16:19 -05:00
Michael Hewson
e94b29065f fix some errors in libstd 2017-12-22 12:40:39 -05:00
bors
5165ee9e20 Auto merge of #46838 - pnkfelix:issue-46112-followup, r=estebank
Followup for #46112.

Sorting by crate-num should ensure that we favor `std::foo::bar` over
`any_other_crate::foo::bar`.

Interestingly, *this* change had a much larger impact on our internal
test suite than PR #46708 (which was my original fix to #46112).
2017-12-22 16:02:31 +00:00
David Wood
6710bd8614
Updated existing tests. 2017-12-22 15:48:56 +00:00
David Wood
3dfe256b5f
Added 'move occurs because X is not Copy' note. 2017-12-22 15:01:47 +00:00
David Wood
c428b7d9c1
Converted moves-based-on-type-tuple test and added MIR borrowck comparison. 2017-12-22 15:01:47 +00:00
Trevor Spiteri
f2c5472ed5 doc: improve None condition doc for checked_div and checked_rem 2017-12-22 15:09:51 +01:00
bors
2c037d5589 Auto merge of #46779 - Zoxc:par-merge-without-sync, r=arielb1
Work towards thread safety in rustc

This PR is split out from https://github.com/rust-lang/rust/pull/45912. It contains changes which do not require the `sync` module.
2017-12-22 12:34:45 +00:00
Michael Hewson
0783db9e0f Convert warning about *const _ to a future-compat lint 2017-12-22 07:05:09 -05:00
Marco A L Barbosa
dc71cab4df Fix process test when using busybox mkdir
busybox mkdir . returns 0
busybox mkdir ./ returns 1
2017-12-22 08:21:05 -02:00
bors
264af16757 Auto merge of #46752 - Yoric:nll, r=arielb1
Issue #46589 - Kill borrows on a local variable whenever we assign ov…

…er this variable

This is a first patch for the issue, handling the simple case while I figure out the data structures involved in the more complex cases.
2017-12-22 09:54:21 +00:00
Ed Schouten
41567525fe Add CloudABI to the list of supported targets.
Backend definitions for these targets are present, meaning we can start
announcing this target. While there, sort the list alphabetically.
2017-12-22 09:39:40 +01:00