Commit graph

63259 commits

Author SHA1 Message Date
bors
b67f4283b3 Auto merge of #45065 - arielb1:not-correct, r=nikomatsakis
fix logic error in #44269's `prune_cache_value_obligations`

We want to retain obligations that *contain* inference variables, not
obligations that *don't contain* them, in order to fix #43132. Because
of surrounding changes to inference, the ICE doesn't occur in its
original case, but I believe it could still be made to occur on master.

Maybe I should try to write a new test case? Certainly not right now
(I'm mainly trying to get us a beta that we can ship) but maybe before
we land this PR on nightly?

This seems to cause a 10% performance regression in my imprecise
attempt to benchmark item-body checking for #43613, but it's better to
be slow and right than fast and wrong. If we want to recover that, I
think we can change the constrained-type-parameter code to actually
give a list of projections that are important for resolving inference
variables and filter everything else out.
2017-10-06 15:30:32 +00:00
Ariel Ben-Yehuda
91fdadba61 fix logic error in #44269's prune_cache_value_obligations
We want to retain obligations that *contain* inference variables, not
obligations that *don't contain* them, in order to fix #43132. Because
of surrounding changes to inference, the ICE doesn't occur in its
original case, but I believe it could still be made to occur on master.

Maybe I should try to write a new test case? Certainly not right now
(I'm mainly trying to get us a beta that we can ship) but maybe before
we land this PR on nightly?

This seems to cause a 10% performance regression in my imprecise
attempt to benchmark item-body checking for #43613, but it's better to
be slow and right than fast and wrong. If we want to recover that, I
think we can change the constrained-type-parameter code to actually
give a list of projections that are important for resolving inference
variables and filter everything else out.
2017-10-06 17:12:24 +03:00
Alex Crichton
1988447007 rustc: Reduce default CGUs to 16
Rationale explained in the included comment as well as #44941
2017-10-06 07:06:30 -07:00
Michael Woerister
b81c8580ca incr.comp.: Bring back output of -Zincremental-info. 2017-10-06 16:04:38 +02:00
bors
a8feaee5b6 Auto merge of #44734 - mchlrhw:wip/hashmap-entry-and-then, r=BurntSushi
Implement `and_modify` on `Entry`

## Motivation

`Entry`s are useful for allowing access to existing values in a map while also allowing default values to be inserted for absent keys. The existing API is similar to that of `Option`, where `or` and `or_with` can be used if the option variant is `None`.

The `Entry` API is, however, missing an equivalent of `Option`'s `and_then` method. If it were present it would be possible to modify an existing entry before calling `or_insert` without resorting to matching on the entry variant.

Tracking issue: https://github.com/rust-lang/rust/issues/44733.
2017-10-06 12:51:11 +00:00
bors
3ed8b69842 Auto merge of #44965 - oconnor663:res_init_glibc, r=dtolnay
replace libc::res_init with res_init_if_glibc_before_2_26

The previous workaround for gibc's res_init bug is not thread-safe on
other implementations of libc, and it can cause crashes. Use a runtime
check to make sure we only call res_init when we need to, which is also
when it's safe. See https://github.com/rust-lang/rust/issues/43592.

~This PR is returning an InvalidData IO error if the glibc version string fails to parse. We could also have treated that case as "not glibc", and gotten rid of the idea that these functions could return an error. (Though I'm not a huge fan of ignoring error returns from `res_init` in any case.) Do other folks agree with these design choices?~

I'm pretty new to hacking on libstd. Is there an easy way to build a toy rust program against my changes to test this, other than doing an entire `sudo make install` on my system? What's the usual workflow?
2017-10-06 10:20:14 +00:00
Seiichi Uchida
14c6c11904 Add a semicolon to span for ast::Local 2017-10-06 19:17:40 +09:00
mchlrhw
9e36111fc6 Implement entry_and_modify 2017-10-06 09:10:31 +01:00
bors
ed1cffdb21 Auto merge of #44818 - petrochenkov:astymac2, r=jseyfried
Improve resolution of associated types in declarative macros 2.0

Make various identifier comparisons for associated types (and sometimes other associated items) hygienic.
Now declarative macros 2.0 can use `Self::AssocTy`, `TyParam::AssocTy`, `Trait<AssocTy = u8>` where `AssocTy` is an associated type of a trait `Trait` visible from the macro. Also, `Trait` can now be implemented inside the macro and specialization should work properly (fixes https://github.com/rust-lang/rust/pull/40847#issuecomment-310867299).

r? @jseyfried or @eddyb
2017-10-06 05:37:43 +00:00
bors
b915820878 Auto merge of #44951 - vitiral:incr_struct_defs, r=michaelwoerister
incr compilation struct_defs.rs

I am prematurely openeing this as I need mentoring help from @michaelwoerister (also pinged @nikomatsakis)

First, is this the right approach for these changes?

Second, I'm a bit confused by the results so far.

- Changing `TupleStructFieldType(i32)` -> `...(u32)` changes only Hir and HirBody, not TypeOfItem
- Chaning `TupleStructAddField(i32)` -> `...(i32, u32)` *does* change TypeOfItem

This seems wrong. I feel like it should change TypeOfItem in both cases. Is this a bug in incr compilation or is it expected?
2017-10-06 03:16:13 +00:00
Kevin Hunter Kesling
73ca15cc29 Fix typo, per #45057. 2017-10-05 21:31:59 -04:00
Austin Bonander
7be36d2a6d proc_macro::Span API improvements 2017-10-05 17:00:55 -07:00
bors
f5e036a290 Auto merge of #45054 - andjo403:master, r=alexcrichton
Faster compile times for release builds with llvm fix

Run global optimizations after the inliner to avoid spending time on optimizing dead code.

fixes #44655
2017-10-05 22:20:23 +00:00
Jack O'Connor
9602fe1509 replace libc::res_init with res_init_if_glibc_before_2_26
The previous workaround for gibc's res_init bug is not thread-safe on
other implementations of libc, and it can cause crashes. Use a runtime
check to make sure we only call res_init when we need to, which is also
when it's safe. See https://github.com/rust-lang/rust/issues/43592.
2017-10-05 17:53:10 -04:00
Vadim Petrochenkov
2d9161d188 Improve resolution of associated types in macros 2.0 2017-10-06 00:35:21 +03:00
Guillaume Gomez
98045fdaca Add missing links for AtomicBool 2017-10-05 23:20:58 +02:00
steveklabnik
5e251b74eb Modify Rc/Arc language around mutability
There are a few exceptions to the rule that Arc/Rc are immutable. Rather
than dig into the details, add "generally" to hint at this difference,
as it's kind of a distraction at this point in the docs.

Additionally, Arc's docs were slightly different here generally, so add
in both the existing language and the exception.

Fixes #44105
2017-10-05 16:54:56 -04:00
bors
417c73891f Auto merge of #44943 - nivkner:fixme_fixup, r=dtolnay
address some FIXME whose associated issues were marked as closed

part of #44366
2017-10-05 19:52:00 +00:00
Alex Crichton
47fc913e56 Update the jobserver crate
Brings in a bugfix to be compatible with the master branch of `make` where
jobserver fds are set in nonblocking mode
2017-10-05 12:34:52 -07:00
Andreas Jonson
8fd3c8f769 Faster compile times for release builds with llvm fix 2017-10-05 18:56:23 +00:00
bors
4531131bf3 Auto merge of #44878 - Nashenas88:master, r=nikomatsakis
Store a new Region value every time we create a new region variable

Paired with @spastorino to walk through this and implement #44870.
2017-10-05 17:14:12 +00:00
bgermann
724dd46536 Add libsocket and libresolv to Solaris builder 2017-10-05 19:05:19 +02:00
bors
1db1144277 Auto merge of #45046 - kennytm:rollup, r=kennytm
Rollup of 9 pull requests

- Successful merges: #44664, #44935, #44972, #44980, #44987, #44997, #45006, #45017, #45024
- Failed merges:
2017-10-05 13:25:55 +00:00
kennytm
5440733971 Rollup merge of #45024 - QuietMisdreavus:doc-masked-issue-num, r=pnkfelix
add the issue number to doc_masked's feature gate

Whoops, missed this in the original `#[doc(masked)]` PR.
2017-10-05 20:22:37 +08:00
kennytm
8249004f03 Rollup merge of #45017 - GuillaumeGomez:mutex-links, r=estebank
Add missing urls for Mutex

r? @rust-lang/docs
2017-10-05 20:22:36 +08:00
kennytm
71fba531dc Rollup merge of #45006 - MaikKlein:patch-2, r=nikomatsakis
Typo in `librustc/README.md`
2017-10-05 20:22:36 +08:00
kennytm
9a43c28e6b Rollup merge of #44987 - pnkfelix:mir-borrowck-fix-borrowindexes-ice, r=arielb1
`EndRegion` do not always correspond to borrow-data entries

Remove assertion that the argument to every `EndRegion` correspond to some dataflow-tracked borrow-data entry.

Fix #44828

(The comment thread on the aforementioned issue discusses why its best to just remove this assertion.)
2017-10-05 20:22:34 +08:00
kennytm
14d8055476 Rollup merge of #44980 - steveklabnik:update-books, r=estebank
update books for next release

Also fixes some stdlib links to the reference which have changed.

First step in https://forge.rust-lang.org/release-process.html, doing it a few days early 😄
2017-10-05 20:22:33 +08:00
kennytm
b380254858 Rollup merge of #44972 - durka:patch-44, r=arielb1
fix ItemKind::DefaultImpl doc comment

Upgrade comment to doc comment.

...Is this actually used? If so, why does the `Impl` variant right below have a `Defaultness`?
2017-10-05 20:22:31 +08:00
bgermann
a78ce07381 Fix CC for solaris environments 2017-10-05 13:48:34 +02:00
bors
abef7e1fd2 Auto merge of #45019 - aidanhs:aphs-no-trans-worker-panic, r=alexcrichton
Don't unwrap work item results as the panic trace is useless

Fixes #43402 now there's no multithreaded panic printouts

Also update a comment

--------

Likely regressed in #43506, where the code was changed to panic in worker threads on error.

Unwrapping gives zero extra information since the stack trace is so short, so we may as well just surface that there was an error and exit the thread properly. Because there are then no multithreaded printouts, I think it should mean the output of the test for #26199 is deterministic and not interleaved (thanks to @philipc https://github.com/rust-lang/rust/issues/43402#issuecomment-333835271 for a hint).

Sadly the output is now:
```
thread '<unnamed>' panicked at 'aborting due to worker thread panic', src/librustc_trans/back/write.rs:1643:20
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: could not write output to : No such file or directory

error: aborting due to previous error
```
but it's an improvement over the multi-panic situation before.

r? @alexcrichton
2017-10-05 10:50:11 +00:00
Michael Woerister
b50e8ebbba Fix infinite recursion in <DepNode as Debug>. 2017-10-05 10:20:13 +02:00
bors
a0db04b62b Auto merge of #44940 - philipc:remap-path, r=michaelwoerister
Don't use remapped path when loading modules and include files

Fixes bug reported in https://github.com/rust-lang/rust/issues/41555#issuecomment-327866056.

cc @michaelwoerister
2017-10-05 05:16:41 +00:00
Barret Rennie
276bebebb0 Update trait summaries for std::fmt
This patch is part of #29355.
2017-10-04 22:16:09 -06:00
Christopher Vittal
54d63a0d33 Expand mir dump in order to handle NLL pass
Extend `dump_mir` and functions it calls in order to allow callers to
add custom information. We do this by adding an enum `PassWhere` and
an extra argument of type `FnMut(PassWhere, &mut Write) ->
io::Result<()>`.  This callback is responsible for printing the extra
information when MIR is dumped at various stages.

For the "nll" pass, use the new mechanism to dump the `Region`
information after the header, but before the control flow graph for
every function.

In the interest of keeping the output somewhat concise, implement
a custom Debug impl for `Region`

Open Questions:

    * What should we call what has been called `PassWhere` so far?
2017-10-04 23:45:09 -04:00
est31
327116a423 Remove nacl from librustdoc 2017-10-05 05:04:50 +02:00
est31
329b901b50 Remove nacl from libtest 2017-10-05 05:04:40 +02:00
est31
aad1c998c7 Remove nacl from libstd 2017-10-05 05:01:41 +02:00
est31
b8fad2d219 Remove nacl from librustc_back 2017-10-05 05:01:19 +02:00
est31
6f7dd654cd Remove nacl from librustc_llvm 2017-10-05 05:01:02 +02:00
Santiago Pastorino
271a492cb2 Generate ScopeId using newtype_index macro 2017-10-04 23:51:43 -03:00
Santiago Pastorino
8ee16f4352 Generate SerializedDepNodeIndex using newtype_index macro 2017-10-04 23:51:43 -03:00
Santiago Pastorino
b5a5556dd4 Generate DepNodeIndexNew using newtype_index macro 2017-10-04 23:51:43 -03:00
Santiago Pastorino
3502bec032 Make newtype_index get debug_name using reflection 2017-10-04 23:50:53 -03:00
Santiago Pastorino
9af7426b47 Make newtype_index macro use full path to resolve constants 2017-10-04 23:50:53 -03:00
Santiago Pastorino
c8549a1586 Generate Idx in nll using newtype_index! 2017-10-04 23:50:53 -03:00
Santiago Pastorino
3d230af80b Move newtype_index to rustc_data_structures 2017-10-04 23:50:53 -03:00
Santiago Pastorino
f5cef21569 Convert regions to IndexVec 2017-10-04 23:50:53 -03:00
Paul Faria
0c5de8633c Store a new Region value every time we create a new region variable 2017-10-04 23:50:53 -03:00
bgermann
4e69d2e3eb Merge dist-solaris with cross2 builder 2017-10-05 01:22:30 +02:00
Alex Crichton
a70c5cb68f rustc: Don't create empty codegen units
This'll end up just creating a bunch of object files that otherwise wouldn't
exist, so skip that extra work if possible.
2017-10-04 16:21:38 -07:00
James Tucker
fb03bb72b9 zircon: update some more zx and lp constants
* Use size_t where size_t is used, while it's not critical on our
 specifically supported architectures, this is more accurate.
 * Update HND_SPECIAL_COUNT to the correct value, and give it the size
 that enum is likely to be.
2017-10-04 16:06:53 -07:00
bgermann
a82891ab5c Rename dist-fuchsia builder to cross2 2017-10-05 00:40:36 +02:00
James Tucker
17a2a766ac zircon: the type of zx_handle_t is now unsigned
This is a kernel ABI change that landed today. I noticed some other ABI
issues and have left a note to cleanup once they are better defined.
2017-10-04 15:12:44 -07:00
Eduard-Mihai Burtescu
ac25a4ac32 rustc_trans: do not set NoCapture for anonymous lifetime &T arguments. 2017-10-05 01:06:14 +03:00
Alexis Beingessner
a6dea41d64 Make -Cpanic=abort imply -Zmutable-noalias 2017-10-04 17:29:37 -04:00
bors
d7e73e4b1a Auto merge of #44901 - michaelwoerister:on-demand-eval, r=nikomatsakis
incr.comp.: Switch to red/green change tracking, remove legacy system.

This PR finally switches incremental compilation to [red/green tracking](https://github.com/rust-lang/rust/issues/42293) and completely removes the legacy dependency graph implementation -- which includes a few quite costly passes that are simply not needed with the new system anymore.

There's still some documentation to be done and there's certainly still lots of optimizing and tuning ahead -- but the foundation for red/green is in place with this PR. This has been in the making for a long time `:)`

r? @nikomatsakis
cc @alexcrichton, @rust-lang/compiler
2017-10-04 19:14:41 +00:00
Niv Kaminer
559adb7e06 avoid using match keyword as module name 2017-10-04 16:17:25 +00:00
QuietMisdreavus
2af12b7e45 add the issue number to doc_masked's feature gate 2017-10-04 10:47:45 -05:00
bors
417ffc98df Auto merge of #44890 - nvzqz:str-box-transmute, r=alexcrichton
Remove mem::transmute used in Box<str> conversions

Given that https://github.com/rust-lang/rust/pull/44877 is failing, I decided to make a separate PR. This is done with the same motivation: to avoid `mem::transmute`-ing non `#[repr(C)]` types.
2017-10-04 15:14:15 +00:00
Garrett Berg
ad9b1ed9c2 groundwork for #45009: rustc_dirty/clean enhancements 2017-10-04 07:20:59 -06:00
Malo Jaffré
7428806bf9 Fix some E-needstest issues.
Also ignore `attr-on-trait` test on stage-1 to keep `./x.py test --stage 1` successful.

Fixes #30355.
Fixes #33241.
Fixes #36400.
Fixes #37887.
Fixes #44578.
2017-10-04 15:12:01 +02:00
Niv Kaminer
51542a9192 seperate and move miscellaneous benchmarks to librustc 2017-10-04 12:21:15 +00:00
Guillaume Gomez
e1df72fdab Add missing urls for Mutex 2017-10-04 14:03:23 +02:00
Aidan Hobson Sayers
4a6ede78ee Don't unwrap work item results as the panic trace is useless
Fixes #43402 now there's no multithreaded panic printouts

Also update a comment
2017-10-04 12:46:43 +01:00
Felix S. Klock II
86ca5cf942 Unit tests for gathering and reporting move-errors from mir-borrowck.
This commit tests *just* the subset of the tests that were previously
ICE'ing and where now AST- and MIR-borrowck both match in terms of the
errors they report.

In other words: there remain *other* tests that previously ICE'd, and
now no longer ICE, but their remains a divergence between the errors
reported by AST-borrowck and by MIR-borrowck.
2017-10-04 13:29:55 +02:00
bors
fd8099f0ec Auto merge of #44882 - mikhail-m1:master, r=pnkfelix
add notes to report_conflicting_borrow MIR borrowck

part of #44596
2017-10-04 11:26:12 +00:00
Felix S. Klock II
5a16ef4936 Made move_paths::MoveError take span param in cannot_move_out_of ctor.
Implicitly threaded `Location` through MoveData construction via a
`Gatherer` struct (so that we could look up the span corresponding to
the location when we need to signal an error).
2017-10-04 12:48:36 +02:00
Felix S. Klock II
117586e6e9 Add method to Mir that maps a Location to its SourceInfo. 2017-10-04 12:48:28 +02:00
Felix S. Klock II
43fb82d2fa mir-borrowck: Gather move errors during MoveData construction and report them.
Currently is using DUMMY_SP as the associated span; a follow-up commit
will pass in appropriate spans when constructing the errors.
2017-10-04 12:48:20 +02:00
Felix S. Klock II
fdd7d13c24 Move E0509 diagnostic into mod borrowck_errors shared between ast- and mir-borrowck. 2017-10-04 12:47:53 +02:00
Felix S. Klock II
a995b56a5e Move E0508 diagnostic into mod borrowck_errors shared between ast- and mir-borrowck. 2017-10-04 12:47:46 +02:00
Felix S. Klock II
a12cefb497 Move E0507 diagnostic into mod borrowck_errors shared between ast- and mir-borrowck.
(Had to modify signature of `report_cannot_move_out_of` slightly to
satisfy requirements of newly added `fn cannot_move_out_of` method.)
2017-10-04 12:47:40 +02:00
Michael Woerister
0454a41bec incr.comp.: Address review comments. 2017-10-04 12:35:56 +02:00
Mikhail Modin
c68b10f5ee add notes to report_conflicting_borrow MIR borrowck 2017-10-04 10:35:42 +03:00
bors
eabef0608b Auto merge of #44905 - Pirh:process_abort_docs, r=steveklabnik
Update docs for process::abort

Remove a typo and explain the relationship to `panic!`.

Part of #29370

r? @steveklabnik
2017-10-04 05:43:00 +00:00
bors
f1938cf13b Auto merge of #44999 - pnkfelix:mir-borrowck-fix-assert-left-right, r=nikomatsakis
Overlapping borrows can point to different lvalues.

Overlapping borrows can point to different lvalues.

There's always a basis for the overlap, so instead of removing the assert entirely, I instead pass in the prefix that we found and check that it actually is a prefix of both lvalues.

Fix #44829
2017-10-04 03:28:24 +00:00
bors
2db48d7fcb Auto merge of #44979 - hinaria:master, r=dtolnay
make `backtrace = false` compile for windows targets.

when building for windows with `backtrace = false`, `libstd` fails to compile because some modules that use items from `sys_common::backtrace::*` are still included, even though those modules aren't used or referenced by anything.

`sys_common::backtrace` doesn't exist when the backtrace feature is turned off.

--

i've also added `#[cfg(feature = "backtrace")]` to various items that exist exclusively to support `mod backtrace` since the compilation would fail since they would be unused in a configuration with backtraces turned off.
2017-10-04 00:57:30 +00:00
Alexis Beingessner
36471293e6 Add -Zmutable-noalias flag 2017-10-03 19:49:45 -04:00
bors
bd90aa6daa Auto merge of #44895 - stephaneyfx:master, r=dtolnay
Made `fs::copy` return the length of the main stream

On Windows with the NTFS filesystem, `fs::copy` would return the sum of the
lengths of all streams, which can be different from the length reported by
`metadata` and thus confusing for users unaware of this NTFS peculiarity.

This makes `fs::copy` return the same length `metadata` reports which is the
value it used to return before PR #26751. Note that alternate streams are still
copied; their length is just not included in the returned value.

This change relies on the assumption that the stream with index 1 is always the
main stream in the `CopyFileEx` callback. I could not find any official
document confirming this but empirical testing has shown this to be true,
regardless of whether the alternate stream is created before or after the main
stream.

Resolves #44532
2017-10-03 22:19:40 +00:00
bors
4502e2aa9c Auto merge of #44949 - QuietMisdreavus:rustdoctest-dirs, r=nikomatsakis
let htmldocck.py check for directories

Since i messed this up during https://github.com/rust-lang/rust/pull/44613, i wanted to codify this into the rustdoc tests to make sure that doesn't happen again.
2017-10-03 19:38:33 +00:00
Matt
3264c836bb Optimize comparison functions of Iterator
Replaced matching on tuples which led to less performant code generation.
2017-10-04 01:04:15 +08:00
Garrett Berg
c5c3614c18 related to #44924: update incr compilation for struct_defs.rs 2017-10-03 11:03:57 -06:00
Maik Klein
b3d85fc2dd Typo in librustc/README.md 2017-10-03 18:57:52 +02:00
bors
835e3e5078 Auto merge of #44922 - zilbuz:issue-44596/E0594, r=pnkfelix
MIR borrowck: move span_label to `borrowck_errors.rs`

The calls to `span_label` are moved and factorized for:
* E0503 (`cannot_use_when_mutably_borrowed()`)
* E0506 (`cannot_assign_to_borrowed()`)

Additionnally, the error E0594 (`cannot_assign_static()`) has been factorized between `check_loan.rs` and `borrowc_check.rs`.

Part of #44596
2017-10-03 16:42:26 +00:00
bgermann
80fe86f8c7 Add build environment for Solaris
This can be used to build rust-std.

The dilos illumos distribution was chosen, because illumos is free software
as opposed to Oracle Solaris and dilos is the only illumos distribution that
supports x86_64 and sparcv9 at the same level.
2017-10-03 14:48:39 +02:00
bors
8891044e89 Auto merge of #44896 - qmx:move-resolve-to-librustc, r=arielb1
Move monomorphize::resolve() to librustc

this moves `monomorphize::resolve(..)` to librustc, and re-enables inlining for some trait methods, fixing #44389

@nikomatsakis I've kept the calls to the new `ty::Instance::resolve(....)` always `.unwrap()`-ing for the moment, how/do you want to add more debugging info via `.unwrap_or()` or something like this?

we still have some related `resolve_*` functions on monomorphize, but I wasn't sure moving them was into the scope for this PR too.

@eddyb mind to take a look too?
2017-10-03 12:18:13 +00:00
Felix S. Klock II
aac64c4756 Overlapping borrows can point to different lvalues.
There's always a basis for the overlap, so instead of removing the
assert entirely, I instead pass in the prefix that we found and check
that it actually is a prefix of both lvalues.

Fix #44829
2017-10-03 14:02:25 +02:00
Michael Woerister
c96d0bff94 incr.comp.: Fix some merge fallout. 2017-10-03 13:50:55 +02:00
Philip Craig
9bbd7a3b3f Add fixme regarding remapping paths for doctests 2017-10-03 20:36:53 +10:00
Philip Craig
3a225c77bb Rename FileMap::path and change to an Option 2017-10-03 19:47:33 +10:00
bors
61bad301f1 Auto merge of #44920 - vi:rustdoc_implementors_src_link, r=GuillaumeGomez
rustdoc: Render [src] links for trait implementors

Should close #43893.

<s>No tests [yet].</s>

r? @QuietMisdreavus
2017-10-03 08:04:33 +00:00
bors
67ed4891db Auto merge of #44966 - zackmdavis:no_mangle_no_snake, r=aturon
make non_snake_case lint allow extern no-mangle functions

Resolves #31924.

r? @sfackler
2017-10-03 02:26:27 +00:00
leonardo.yvens
bb74c20a5d Inline eq_slice into str::eq
It's the only use of the function.
2017-10-02 22:04:23 -03:00
bors
bdcb7fbbca Auto merge of #44977 - steveklabnik:update-mdbook, r=alexcrichton
update mdbook

Fixes #44704
2017-10-02 22:39:51 +00:00
Federico Mena Quintero
d989cd02b5 Fix broken links in documentation 2017-10-02 15:46:10 -05:00
Felix S. Klock II
17f6b6810b Remove assertion that the argument to every EndRegion correspond to
some dataflow-tracked borrow-data entry.

Fix #44828

(The comment thread on the aforementioned issue discusses why its best
to just remove this assertion.)
2017-10-02 22:40:51 +02:00
Federico Mena Quintero
50505aadbd Clarify the ffi module's toplevel docs, per @clarcharr's comments 2017-10-02 14:16:37 -05:00
Pirh
28ef0d1085 Document that process::abort will not call the panic hook 2017-10-02 19:59:50 +01:00
Federico Mena Quintero
9854e836a3 Remove the implication that CString contains UTF-8 data. 2017-10-02 13:53:50 -05:00
bors
185cc5f26d Auto merge of #44885 - lu-zero:master, r=alexcrichton
More Altivec Intrinsics

Float-specific intrinsics
2017-10-02 17:18:20 +00:00
steveklabnik
851b6d4762 update books for next release
Also fixes some stdlib links to the reference which have changed.
2017-10-02 12:07:28 -04:00
hinaria
a5296a5fb2 windows: make backtrace = false compile 2017-10-03 02:48:17 +11:00
James Munns
1e26094bdd Allow atomic operations up to 32 bits
The ARMv5te platform does not have instruction-level support for atomics, however the kernel provides [user space helpers](https://www.kernel.org/doc/Documentation/arm/kernel_user_helpers.txt) which can be used to perform atomic operations. When linked with `libc`, the atomic symbols needed by Rust will be provided, rather than CPU level intrinsics.

As this target is specifically `linux` and `gnueabi`, it is reasonable to assume the Linux Kernel and libc will be available for the target. There is a large performance penalty, as we are not using CPU level intrinsics, however this penalty is likely preferable to not having the target at all.

I have used this change in a custom target (along with `xargo`) to build `std`, as well as a number of higher level crates.
2017-10-02 16:53:43 +02:00
steveklabnik
1bbf41da6f update mdbook
Fixes #44704
2017-10-02 10:16:32 -04:00
Michael Woerister
dbab705f04 incr.comp.: Do some cleanup. 2017-10-02 16:09:23 +02:00
Michael Woerister
df06a7e532 incr.comp.: Remove legacy dep-graph runtime. 2017-10-02 16:09:19 +02:00
Vitaly _Vi Shukela
acef039de8
rustdoc: Remove cruft from the test
per @GuillaumeGomez's sample, but with one change.
2017-10-02 16:54:35 +03:00
Michael Woerister
171c020857 incr.comp.: Remove saving and loading of legacy dep-graph. 2017-10-02 15:47:11 +02:00
Michael Woerister
272c324b25 incr.comp.: Build DepGraphQuery from new dep-graph impl. 2017-10-02 15:45:46 +02:00
Michael Woerister
e6badfd449 incr.comp.: Use red/green tracking for CGU re-use. 2017-10-02 15:45:46 +02:00
Michael Woerister
c9a17ef174 incr.comp.: Add some logging to DepGraph::try_mark_green(). 2017-10-02 15:38:57 +02:00
Michael Woerister
e1994bd27b incr.comp.: Make some DepNodes non-anonymous. 2017-10-02 15:38:57 +02:00
Michael Woerister
f0bbf4e1f2 incr.comp.: Re-execute queries during red/green marking in order to find out their color. 2017-10-02 15:38:57 +02:00
Michael Woerister
6db27d9f90 incr.comp.: Add minimal version of try_mark_green procedure. 2017-10-02 15:36:47 +02:00
Michael Woerister
a948be81cd incr.comp.: Determine red/green state of every new node. 2017-10-02 15:36:47 +02:00
Alex Burka
fc5e8dc1b5 fix comment on DefaultImpl 2017-10-02 07:30:09 -04:00
bors
0f0f5db465 Auto merge of #44959 - arielb1:generic-errors, r=eddyb
handle nested generics in Generics::type_param/region_param

Fixes #44952.

r? @eddyb
2017-10-02 10:06:32 +00:00
Alex Burka
5517a1ce79 fix ItemKind::DefaultImpl doc comment
Upgrade comment to doc comment.
2017-10-02 05:59:56 -04:00
Ariel Ben-Yehuda
706e52e2cc fix handling of Self 2017-10-02 10:43:36 +02:00
bors
9ae6ed78ac Auto merge of #44942 - zackmdavis:lint_suggestions, r=estebank
code suggestions for unused-mut, while-true, deprecated-attribute, and unused-parens lints

![lint_suggestions](https://user-images.githubusercontent.com/1076988/31044068-b2074de8-a57c-11e7-9319-6668508b6d1f.png)

r? @estebank
2017-10-02 07:03:26 +00:00
Zack M. Davis
8a14022c5d correct unused-parens lint suggestion to strip exact pair 2017-10-01 20:15:24 -07:00
QuietMisdreavus
23f5fbee45 document trait impls when the type appears in the trait's generics 2017-10-01 21:25:48 -05:00
bors
2146c613d1 Auto merge of #44960 - SeanPrashad:master, r=steveklabnik
Resolves #36284 - vec.rs documentation

Removed comments associated with `[into_vec]` being equivalent to `[shrink_to_fit]` as requested.
2017-10-02 02:17:14 +00:00
Zack M. Davis
b989101a55 make non_snake_case lint allow extern no-mangle functions
Resolves #31924.
2017-10-01 17:20:06 -07:00
bors
a4af9309d0 Auto merge of #44955 - laumann:small-typo-fix, r=steveklabnik
Fix typo: geneartor -> generator
2017-10-01 22:16:04 +00:00
Ariel Ben-Yehuda
ad9986605f fix handling of Self 2017-10-01 23:03:48 +02:00
bors
f1b5225e8b Auto merge of #44919 - diwic:79-pretty-mir, r=arielb1
Mir pretty print: Add cleanup comment

I found it useful to add a comment indicating whether or not a
BasicBlock is a cleanup block or not. Hopefully you'll find it
useful too.
2017-10-01 19:57:01 +00:00
bors
cef4a3ebfa Auto merge of #44897 - Havvy:doc-size_of, r=steveklabnik
Docs for size_of::<#[repr(C)]> items.

Most of this info comes from camlorn's blog post on optimizing struct layout and the Rustonomicon.

I don't really like my wording in the first paragraph.

I also cannot find a definition of what `#[repr(C)]` does for enums that have variants with fields. They're allowed, unlike `#[repr(C)] enum`s with no variants.
2017-10-01 17:32:34 +00:00
Joshua Lockerman
68341a91ee Improve performance of spsc_queue and stream.
This commit makes two main changes.
1. It switches the spsc_queue node caching strategy from keeping a shared
counter of the number of nodes in the cache to keeping a consumer only counter
of the number of node eligible to be cached.
2. It separate the consumer and producers fields of spsc_queue and stream into
a producer cache line and consumer cache line.
2017-10-01 12:15:35 -04:00
Sean Prashad
1ebc7bba79 Resolves #36284 - vec.rs documentation 2017-10-01 12:15:05 -04:00
Ariel Ben-Yehuda
622a78cd54 handle nested generics in Generics::type_param/region_param
Fixes #44952.
2017-10-01 17:15:15 +02:00
Douglas Campos
11e141eba3 stray comma 2017-10-01 11:14:47 -04:00
Thomas Jespersen
30b19c9e8b Fix typo: geneartor -> generator 2017-10-01 15:40:00 +02:00
bors
3651cddc44 Auto merge of #44945 - petrochenkov:fixtyrec, r=arielb1
Do not require semantic types for all syntactic types when there are errors

Fixes https://github.com/rust-lang/rust/issues/44814
Fixes https://github.com/rust-lang/rust/issues/44858
Fixes https://github.com/rust-lang/rust/issues/44946
r? @nikomatsakis
2017-10-01 13:26:15 +00:00
Vitaly _Vi Shukela
67c9af590d
rustdoc: Style of [src] link for trait implementors
A change suggested by @GuillaumeGomez and @QuietMisdreavus.

Also slight reindenting of the appropriate CSS section.
2017-10-01 16:20:56 +03:00
bors
0defa208dc Auto merge of #44906 - dkl:main-signature, r=nagisa
Fix native main() signature on 64bit

Hello,

in LLVM-IR produced by rustc on x86_64-linux-gnu, the native main() function had incorrect types for the function result and argc parameter: i64, while it should be i32 (really c_int). See also #20064, #29633.

So I've attempted a fix here. I tested it by checking the LLVM IR produced with --target x86_64-unknown-linux-gnu and i686-unknown-linux-gnu. Also I tried running the tests (`./x.py test`), however I'm getting two failures with and without the patch, which I'm guessing is unrelated.
2017-10-01 09:14:53 +00:00
bors
1c09315f6d Auto merge of #44921 - est31:master, r=alexcrichton
Update the libcompiler_builtins submodule

Pulls in the latest changes from libcompiler_builtins.

It should work, but it would be best if this wouldn't get put into a rollup so that bisecting is possible if there is a regression.

r? @alexcrichton
2017-10-01 01:41:42 +00:00
Daniel Klauer
a4e83731e9 test: Update target specs test for new target-c-int-width field 2017-09-30 23:45:36 +02:00
bors
afe9320785 Auto merge of #44944 - dbrgn:trace-macros-docs, r=QuietMisdreavus
Docs: Add trace_macros! to unstable book

As TIL'd at Rustfest :)

Note: This is unfortunately untested, since I'm on my laptop battery, and compiling LLVM would probably eat at least 50% of it on my dual core CPU. (Is there a way to build docs without compiling LLVM?)
2017-09-30 20:46:57 +00:00
Zack M. Davis
e3b498971d code suggestions for unused-mut, while-true lints; UI test 2017-09-30 11:31:12 -07:00
Zack M. Davis
5c9f806d78 code suggestion for unused-parentheses lint
Resolves #42892.
2017-09-30 11:31:12 -07:00
Zack M. Davis
f2c5acd611 code suggestion for deprecated-attribute lint
Also, fix the deprecation message for the late no-debug feature.
2017-09-30 11:31:12 -07:00
QuietMisdreavus
5b59c4db67 let htmldocck.py check for directories 2017-09-30 13:28:09 -05:00
Douglas Campos
b24a672613 weird formatting 2017-09-30 11:08:08 -04:00
bors
c6884b12d9 Auto merge of #44783 - alexcrichton:lto-codegen-units, r=michaelwoerister
rustc: Enable LTO and multiple codegen units

This commit is a refactoring of the LTO backend in Rust to support compilations
with multiple codegen units. The immediate result of this PR is to remove the
artificial error emitted by rustc about `-C lto -C codegen-units-8`, but longer
term this is intended to lay the groundwork for LTO with incremental compilation
and ultimately be the underpinning of ThinLTO support.

The problem here that needed solving is that when rustc is producing multiple
codegen units in one compilation LTO needs to merge them all together.
Previously only upstream dependencies were merged and it was inherently relied
on that there was only one local codegen unit. Supporting this involved
refactoring the optimization backend architecture for rustc, namely splitting
the `optimize_and_codegen` function into `optimize` and `codegen`. After an LLVM
module has been optimized it may be blocked and queued up for LTO, and only
after LTO are modules code generated.

Non-LTO compilations should look the same as they do today backend-wise, we'll
spin up a thread for each codegen unit and optimize/codegen in that thread. LTO
compilations will, however, send the LLVM module back to the coordinator thread
once optimizations have finished. When all LLVM modules have finished optimizing
the coordinator will invoke the LTO backend, producing a further list of LLVM
modules. Currently this is always a list of one LLVM module. The coordinator
then spawns further work to run LTO and code generation passes over each module.

In the course of this refactoring a number of other pieces were refactored:

* Management of the bytecode encoding in rlibs was centralized into one module
  instead of being scattered across LTO and linking.
* Some internal refactorings on the link stage of the compiler was done to work
  directly from `CompiledModule` structures instead of lists of paths.
* The trans time-graph output was tweaked a little to include a name on each
  bar and inflate the size of the bars a little
2017-09-30 15:01:35 +00:00
petrochenkov
8037c28a4a Do not require semantic types for all syntactic types when there are type errors 2017-09-30 17:41:00 +03:00
Daniel Klauer
12a8bc6eb9 rustc: Use 16bit c_int for msp430
Fix regression from c2fe69b9, where main() signature was changed from
using 16bit isize to 32bit c_int for argc parameter/result.
2017-09-30 16:30:12 +02:00
Nikolai Vazquez
f1798d3c9a Cast inner type in OsStr::bytes
The innermost type is not [u8] on all platforms but is assumed to have
the same memory layout as [u8] since this conversion was done via
mem::transmute before.
2017-09-30 10:01:41 -04:00
Daniel Klauer
a204c193ca rustc: Specify c_int width for each target
(all i32 for now, as in liblibc)
2017-09-30 15:54:08 +02:00
Danilo Bargen
eb59952fbd Docs: Add trace_macros! to unstable book 2017-09-30 15:27:42 +02:00
Niv Kaminer
5eebab28dd remove "refinement on pat" FIXME 2017-09-30 13:46:57 +03:00
bors
c4cca3a72d Auto merge of #44936 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 15 pull requests

- Successful merges: #44124, #44287, #44320, #44694, #44708, #44794, #44797, #44824, #44836, #44840, #44845, #44854, #44889, #44900, #44903
- Failed merges:
2017-09-30 10:03:00 +00:00
Niv Kaminer
ff99111f48 address some FIXMEs whose associated issues were marked as closed
remove FIXME(#13101) since `assert_receiver_is_total_eq` stays.
remove FIXME(#19649) now that stability markers render.
remove FIXME(#13642) now the benchmarks were moved.
remove FIXME(#6220) now that floating points can be formatted.
remove FIXME(#18248) and write tests for `Rc<str>` and `Rc<[u8]>`
remove reference to irelevent issues in FIXME(#1697, #2178...)
update FIXME(#5516) to point to getopts issue 7
update FIXME(#7771) to point to RFC 628
update FIXME(#19839) to point to issue 26925
2017-09-30 11:33:47 +03:00
Alex Crichton
ded38dbfc2 rustc: Enable LTO and multiple codegen units
This commit is a refactoring of the LTO backend in Rust to support compilations
with multiple codegen units. The immediate result of this PR is to remove the
artificial error emitted by rustc about `-C lto -C codegen-units-8`, but longer
term this is intended to lay the groundwork for LTO with incremental compilation
and ultimately be the underpinning of ThinLTO support.

The problem here that needed solving is that when rustc is producing multiple
codegen units in one compilation LTO needs to merge them all together.
Previously only upstream dependencies were merged and it was inherently relied
on that there was only one local codegen unit. Supporting this involved
refactoring the optimization backend architecture for rustc, namely splitting
the `optimize_and_codegen` function into `optimize` and `codegen`. After an LLVM
module has been optimized it may be blocked and queued up for LTO, and only
after LTO are modules code generated.

Non-LTO compilations should look the same as they do today backend-wise, we'll
spin up a thread for each codegen unit and optimize/codegen in that thread. LTO
compilations will, however, send the LLVM module back to the coordinator thread
once optimizations have finished. When all LLVM modules have finished optimizing
the coordinator will invoke the LTO backend, producing a further list of LLVM
modules. Currently this is always a list of one LLVM module. The coordinator
then spawns further work to run LTO and code generation passes over each module.

In the course of this refactoring a number of other pieces were refactored:

* Management of the bytecode encoding in rlibs was centralized into one module
  instead of being scattered across LTO and linking.
* Some internal refactorings on the link stage of the compiler was done to work
  directly from `CompiledModule` structures instead of lists of paths.
* The trans time-graph output was tweaked a little to include a name on each
  bar and inflate the size of the bars a little
2017-09-30 00:22:15 -07:00
bors
4491ea5a3f Auto merge of #44893 - spastorino:remove_new_and_index, r=nikomatsakis
Remove new and index methods already implement for Idx

These are the rest of the repeated implementations for new and index methods. Follow up of https://github.com/rust-lang/rust/pull/44889
2017-09-30 06:56:49 +00:00
Zack M. Davis
d663003e03 fix comment typo, CodeSuggestion path in doc comment
`CodeSuggestion` doesn't live in the `diagnostic` module.
2017-09-29 23:42:24 -07:00
Philip Craig
c27a82f193 Don't use remapped path when loading modules and include files 2017-09-30 16:32:45 +10:00
Douglas Campos
a29c770c68 make match exaustive 2017-09-29 22:34:51 -04:00
Douglas Campos
59e778e5e1 improve documentation for resolve() 2017-09-29 22:34:49 -04:00
Douglas Campos
08e1f0b9d7 fix formatting 2017-09-29 22:34:48 -04:00
Douglas Campos
29220663c1 style fixes as requested by @eddyb 2017-09-29 22:34:48 -04:00
Douglas Campos
081b29c1f6 stop using monomorphize::resolve() 2017-09-29 22:34:48 -04:00
Douglas Campos
8a5800e1d4 take ParamEnv into account when resolving 2017-09-29 22:34:47 -04:00
Douglas Campos
24fc50fffa make it not to be a method 2017-09-29 22:34:46 -04:00
Douglas Campos
5eb302fba8 always use resolve 2017-09-29 22:34:46 -04:00
Douglas Campos
3bd09dee45 re-enable mir inlining across trait methods
this fixes #44389
2017-09-29 22:34:46 -04:00
Douglas Campos
baa010561e copy resolve() over to librustc 2017-09-29 22:34:45 -04:00
Vitaly _Vi Shukela
d892e985b0
rustdoc: A test for local and foreign [src] trait impl links 2017-09-30 03:17:51 +03:00
Mark Simulacrum
d6451f0b33 Rollup merge of #44903 - kallisti5:ci-build-disabled, r=aidanhs
ci: Fix building disabled containers

* Change the context into the disabled directory. Now you can test
  containers which are disabled.
2017-09-29 17:59:05 -06:00
Mark Simulacrum
4489a7a0bb Rollup merge of #44900 - Havvy:normalize-lang-attribute-spacing, r=sfackler
Normalize spaces in lang attributes.

So, like, I grepped for all `lang` attributes for *reasons* and I noticed that they all share the same spacing of `#[lang = "item_name"]` except these five instances. So I decided to fix that. So enjoy this PR of exactly ten spaces.
2017-09-29 17:59:04 -06:00
Mark Simulacrum
37c74e1979 Rollup merge of #44889 - spastorino:remove_new, r=arielb1
Remove DepNodeIndex::new is already impl for Idx
2017-09-29 17:59:03 -06:00
Mark Simulacrum
7756d39dca Rollup merge of #44854 - lucasem:atomic-docs, r=steveklabnik
docs improvement sync::atomic::Atomic*

Addresses the `Atomic*` part of #29377.
r? @steveklabnik
2017-09-29 17:59:02 -06:00
Mark Simulacrum
7c3d376086 Rollup merge of #44845 - SimonSapin:nll_mod_rs, r=nikomatsakis
Move src/librustc_mir/transform/nll.rs to a subdirectory

CC https://github.com/rust-lang/rust/issues/43234
2017-09-29 17:59:01 -06:00
Mark Simulacrum
3d7a390552 Rollup merge of #44840 - steveklabnik:fix-wording, r=BurntSushi
Improve wording for StepBy

No other iterator makes the distinction between an iterator and an iterator adapter
in its summary line, so change it to be consistent with all other adapters.
2017-09-29 17:59:00 -06:00
Mark Simulacrum
327cd0d557 Rollup merge of #44836 - GuillaumeGomez:fmt-missing-links, r=QuietMisdreavus
Add missing links in fmt module

r? @rust-lang/docs
2017-09-29 17:58:59 -06:00
Mark Simulacrum
570f1ce36a Rollup merge of #44824 - dtolnay:22really21, r=alexcrichton
Backport libs stabilizations to 1.21 beta

Includes the following stabilizations:

- tcpstream_connect_timeout https://github.com/rust-lang/rust/pull/44563
- iterator_for_each https://github.com/rust-lang/rust/pull/44567
- ord_max_min https://github.com/rust-lang/rust/pull/44593
- compiler_fences https://github.com/rust-lang/rust/pull/44595
- needs_drop https://github.com/rust-lang/rust/pull/44639
- vec_splice https://github.com/rust-lang/rust/pull/44640

These have been backported in https://github.com/rust-lang/rust/pull/44823.
2017-09-29 17:58:58 -06:00
Mark Simulacrum
b1437bc0f7 Rollup merge of #44797 - lucasem:master, r=frewsxcv
docs improvement std::sync::{PoisonError, TryLockError}

Addresses the `PoisonError` and `TryLockError` parts of #29377.
Adds examples and links.

r? @steveklabnik
2017-09-29 17:58:57 -06:00
Mark Simulacrum
f2feb83b73 Rollup merge of #44794 - napen123:master, r=frewsxcv
Add doc example to HashMap::hasher

None
2017-09-29 17:58:56 -06:00
Mark Simulacrum
8083877987 Rollup merge of #44708 - toidiu:ak-44493, r=nikomatsakis
Infer `T: 'x` outlives requirements on structs #44493

https://github.com/rust-lang/rust/issues/44493
2017-09-29 17:58:55 -06:00
Mark Simulacrum
6bc8ca06c1 Rollup merge of #44694 - tommyip:make_clean, r=Mark-Simulacrum
Add --all flag to ./x.py clean

This make `clean` removes the LLVM and download cache directory as well.

Fixes #44214.

r? @Mark-Simulacrum
2017-09-29 17:58:54 -06:00
Mark Simulacrum
20f892f549 Rollup merge of #44320 - jakllsch:jakllsch-caf2c3d2-c939-4c4d-8c68-1aecbd570fab, r=Mark-Simulacrum
Fix extended bootstrap issues with OpenSSL on NetBSD build hosts
2017-09-29 17:58:53 -06:00
Mark Simulacrum
f91c55e995 Rollup merge of #44287 - Eh2406:master, r=aturon
Allow T op= &T for built-in numeric types T v2

Manually rebase of @Migi https://github.com/rust-lang/rust/pull/41336
2017-09-29 17:58:52 -06:00
Mark Simulacrum
f407b2bf4a Rollup merge of #44124 - gaurikholkar:return_self, r=arielb1
adding E0623 for return types - both parameters are anonymous

This is a fix for #44018
```
error[E0621]: explicit lifetime required in the type of `self`
  --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:17:5
   |
16 |   fn foo<'a>(&self, x: &i32) -> &i32 {
   |                        ----     ----
   |                        |
   |                        this parameter and the return type are
                            declared with different lifetimes...
17 |     x
   |     ^ ...but data from `x` is returned here

error: aborting due to previous error
```
It also works for the below case where we have self as anonymous

```
error[E0623]: lifetime mismatch
  --> src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs:17:19
   |
16 |     fn foo<'a>(&self, x: &Foo) -> &Foo {
   |                          ----     ----
   |                          |
   |                          this parameter and the return type are
                            declared with different lifetimes...
17 |         if true { x } else { self }
   |                   ^ ...but data from `x` is returned here

error: aborting due to previous error
```
r? @nikomatsakis

Currently, I have enabled E0621 where return type and self are anonymous, hence WIP.
2017-09-29 17:58:51 -06:00
est31
4114d68f18 Update the libcompiler_builtins submodule 2017-09-30 01:45:21 +02:00
bors
b7041bfab3 Auto merge of #44174 - jimmycuadra:try-from-infallible, r=sfackler
Add blanket TryFrom impl when From is implemented.

Adds `impl<T, U> TryFrom<T> for U where U: From<T>`.

Removes `impl<'a, T> TryFrom<&'a str> for T where T: FromStr` (originally added in #40281) due to overlapping impls caused by the new blanket impl. This removal is to be discussed further on the tracking issue for TryFrom.

Refs #33417.

/cc @sfackler, @scottmcm (thank you for the help!), and @aturon
2017-09-29 22:35:23 +00:00
Jimmy Cuadra
27d95d3645 Fix more TryFrom impls for integers. 2017-09-29 14:10:26 -07:00
Jimmy Cuadra
966cf339cb Simplify implementation of From<Infallible> for TryFromIntError. 2017-09-29 14:04:28 -07:00
bors
6f87d20a7c Auto merge of #42526 - huntiep:try_opt, r=nikomatsakis
Impl Try for Option

This is part of #31436.
2017-09-29 20:09:35 +00:00
bors
51cd06170e Auto merge of #44866 - mdevlamynck:impl-trait, r=eddyb
First step toward implementing impl Trait in argument position

First step implementing #44721.

Add a flag to hir and ty TypeParameterDef and raise an error when using
explicit type parameters when calling a function using impl Trait in
argument position.

I don't know if there is a procedure to add an error code so I just took an available code. Is that ok ?

r? @nikomatsakis
2017-09-29 15:54:44 +00:00
Basile Desloges
d328d264aa mir-borrowck: Factorize error message for cannot_assign_static() between AST and MIR borrowck 2017-09-29 15:41:26 +02:00
Basile Desloges
5c8066b4a7 mir-borrowck: Move span_label calls for cannot_use_when_mutably_borrowed() inside borrowck_errors.rs 2017-09-29 15:41:26 +02:00
Basile Desloges
bcda695720 mir-borrowck: Move span_label calls for cannot_assign_to_borrowed() inside borrowck_errors.rs 2017-09-29 15:41:26 +02:00
bors
09ee9b723a Auto merge of #44856 - cuviper:more-fold, r=dtolnay
Add more custom folding to `core::iter` adaptors

Many of the iterator adaptors will perform faster folds if they forward
to their inner iterator's folds, especially for inner types like `Chain`
which are optimized too.  The following types are newly specialized:

| Type        | `fold` | `rfold` |
| ----------- | ------ | ------- |
| `Enumerate` | ✓      | ✓       |
| `Filter`    | ✓      | ✓       |
| `FilterMap` | ✓      | ✓       |
| `FlatMap`   | exists | ✓       |
| `Fuse`      | ✓      | ✓       |
| `Inspect`   | ✓      | ✓       |
| `Peekable`  | ✓      | N/A¹    |
| `Skip`      | ✓      | N/A²    |
| `SkipWhile` | ✓      | N/A¹    |

¹ not a `DoubleEndedIterator`

² `Skip::next_back` doesn't pull skipped items at all, but this couldn't
be avoided if `Skip::rfold` were to call its inner iterator's `rfold`.

Benchmarks
----------

In the following results, plain `_sum` computes the sum of a million
integers -- note that `sum()` is implemented with `fold()`.  The
`_ref_sum` variants do the same on a `by_ref()` iterator, which is
limited to calling `next()` one by one, without specialized `fold`.

The `chain` variants perform the same tests on two iterators chained
together, to show a greater benefit of forwarding `fold` internally.

    test iter::bench_enumerate_chain_ref_sum  ... bench:   2,216,264 ns/iter (+/- 29,228)
    test iter::bench_enumerate_chain_sum      ... bench:     922,380 ns/iter (+/- 2,676)
    test iter::bench_enumerate_ref_sum        ... bench:     476,094 ns/iter (+/- 7,110)
    test iter::bench_enumerate_sum            ... bench:     476,438 ns/iter (+/- 3,334)

    test iter::bench_filter_chain_ref_sum     ... bench:   2,266,095 ns/iter (+/- 6,051)
    test iter::bench_filter_chain_sum         ... bench:     745,594 ns/iter (+/- 2,013)
    test iter::bench_filter_ref_sum           ... bench:     889,696 ns/iter (+/- 1,188)
    test iter::bench_filter_sum               ... bench:     667,325 ns/iter (+/- 1,894)

    test iter::bench_filter_map_chain_ref_sum ... bench:   2,259,195 ns/iter (+/- 353,440)
    test iter::bench_filter_map_chain_sum     ... bench:   1,223,280 ns/iter (+/- 1,972)
    test iter::bench_filter_map_ref_sum       ... bench:     611,607 ns/iter (+/- 2,507)
    test iter::bench_filter_map_sum           ... bench:     611,610 ns/iter (+/- 472)

    test iter::bench_fuse_chain_ref_sum       ... bench:   2,246,106 ns/iter (+/- 22,395)
    test iter::bench_fuse_chain_sum           ... bench:     634,887 ns/iter (+/- 1,341)
    test iter::bench_fuse_ref_sum             ... bench:     444,816 ns/iter (+/- 1,748)
    test iter::bench_fuse_sum                 ... bench:     316,954 ns/iter (+/- 2,616)

    test iter::bench_inspect_chain_ref_sum    ... bench:   2,245,431 ns/iter (+/- 21,371)
    test iter::bench_inspect_chain_sum        ... bench:     631,645 ns/iter (+/- 4,928)
    test iter::bench_inspect_ref_sum          ... bench:     317,437 ns/iter (+/- 702)
    test iter::bench_inspect_sum              ... bench:     315,942 ns/iter (+/- 4,320)

    test iter::bench_peekable_chain_ref_sum   ... bench:   2,243,585 ns/iter (+/- 12,186)
    test iter::bench_peekable_chain_sum       ... bench:     634,848 ns/iter (+/- 1,712)
    test iter::bench_peekable_ref_sum         ... bench:     444,808 ns/iter (+/- 480)
    test iter::bench_peekable_sum             ... bench:     317,133 ns/iter (+/- 3,309)

    test iter::bench_skip_chain_ref_sum       ... bench:   1,778,734 ns/iter (+/- 2,198)
    test iter::bench_skip_chain_sum           ... bench:     761,850 ns/iter (+/- 1,645)
    test iter::bench_skip_ref_sum             ... bench:     478,207 ns/iter (+/- 119,252)
    test iter::bench_skip_sum                 ... bench:     315,614 ns/iter (+/- 3,054)

    test iter::bench_skip_while_chain_ref_sum ... bench:   2,486,370 ns/iter (+/- 4,845)
    test iter::bench_skip_while_chain_sum     ... bench:     633,915 ns/iter (+/- 5,892)
    test iter::bench_skip_while_ref_sum       ... bench:     666,926 ns/iter (+/- 804)
    test iter::bench_skip_while_sum           ... bench:     444,405 ns/iter (+/- 571)
2017-09-29 12:56:24 +00:00
Vitaly _Vi Shukela
9f02e1a938
rustdoc: Render [src] links for trait implementors (#43893) 2017-09-29 14:33:02 +03:00
Vitaly _Vi Shukela
87d7520d0f
rustdoc: Extract converter from Impementor to Item to a fn 2017-09-29 14:32:57 +03:00
bors
d514263ce3 Auto merge of #44853 - alexcrichton:debug-codegen-units, r=michaelwoerister
rustc: Default 32 codegen units at O0

This commit changes the default of rustc to use 32 codegen units when compiling
in debug mode, typically an opt-level=0 compilation. Since their inception
codegen units have matured quite a bit, gaining features such as:

* Parallel translation and codegen enabling codegen units to get worked on even
  more quickly.
* Deterministic and reliable partitioning through the same infrastructure as
  incremental compilation.
* Global rate limiting through the `jobserver` crate to avoid overloading the
  system.

The largest benefit of codegen units has forever been faster compilation through
parallel processing of modules on the LLVM side of things, using all the cores
available on build machines that typically have many available. Some downsides
have been fixed through the features above, but the major downside remaining is
that using codegen units reduces opportunities for inlining and optimization.
This, however, doesn't matter much during debug builds!

In this commit the default number of codegen units for debug builds has been
raised from 1 to 32. This should enable most `cargo build` compiles that are
bottlenecked on translation and/or code generation to immediately see speedups
through parallelization on available cores.

Work is being done to *always* enable multiple codegen units (and therefore
parallel codegen) but it requires #44841 at least to be landed and stabilized,
but stay tuned if you're interested in that aspect!
2017-09-29 10:10:15 +00:00
David Henningsson
6f8b69fcd1 Mir pretty print: Add cleanup comment
I found it useful to add a comment indicating whether or not a
BasicBlock is a cleanup block or not. Hopefully you'll find it
useful too.
2017-09-29 11:02:36 +02:00
bors
0253d98382 Auto merge of #44847 - estebank:unused-signature, r=nikomatsakis
Point at signature on unused lint

```
warning: struct is never used: `Struct`
  --> $DIR/unused-warning-point-at-signature.rs:22:1
   |
22 | struct Struct {
   | ^^^^^^^^^^^^^
```

Fix #33961.
2017-09-29 07:05:10 +00:00
Jimmy Cuadra
1a29e82227 Remove conflicting TryFrom impls on 32-bit targets. 2017-09-28 23:46:19 -07:00
bors
a379780fb6 Auto merge of #44811 - zilbuz:issue-44596/E0506, r=arielb1
MIR-borrowck: Adding notes to E0506

This PR adds notes to the MIR borrowck error E0506.

Part of #44596
2017-09-29 03:54:12 +00:00
leavehouse
6482ee7cde Fix imports in TcpStream::local_addr docs example
Add a missing import and remove unused imports
2017-09-28 21:49:00 -05:00
leavehouse
7f9e653a29 Fix TcpStream::local_addr example code
The local address's port is not 8080 in this example, that's the remote peer address port. On my machine, the local address is different every time, so I've changed `assert_eq` to only test the IP address
2017-09-28 20:09:31 -05:00
bors
46ef6208f8 Auto merge of #44528 - tmnilsson:attr_proc_macro_cfg_process, r=jseyfried
Apply attr proc macros before cfg processing

Fixes #39336.
r? @jseyfried
2017-09-28 23:38:52 +00:00
Daniel Klauer
6c3f19002d test: Check native main() signature 2017-09-28 23:36:08 +02:00
Daniel Klauer
c2fe69b9bd rustc: Fix main() entry point signature on 64bit
To match the C signature, main() should be generated with C int type
for the argc parameter and result, i.e. i32 instead of i64 on 64bit.

That way it no longer relies on the upper 32 bits being zero, which I'm
not sure is guaranteed by ABIs or startup code.
2017-09-28 22:06:54 +02:00
Daniel Klauer
6c9a4ba8eb rustc: Add Type::c_int()
Add c_int for use in the compiler,
assuming i32 for all targets as in libc.
2017-09-28 22:06:54 +02:00
bors
3c96d40d32 Auto merge of #44278 - Binero:master, r=BurntSushi
Allow replacing HashMap entries

This is an obvious API hole. At the moment the only way to retrieve an entry from a `HashMap` is to get an entry to it, remove it, and then insert a new entry. This PR allows entries to be replaced.
2017-09-28 18:52:49 +00:00
Havvy
0ece48e211 Remove link duplication. 2017-09-28 10:47:54 -07:00
bors
688a858391 Auto merge of #44785 - alexcrichton:update-cargo, r=nikomatsakis
Update some minor dependencies

* run `cargo update`
* Update cargo submodule
* Update to the `cc` crate from `gcc`
2017-09-28 16:19:58 +00:00
Corey Farwell
8ef5447815 Migrate to eprint/eprintln macros where appropriate. 2017-09-28 11:38:35 -04:00
Alexander von Gluck IV
3457a22d91 ci: Fix building disabled containers
* Change the context into the disabled directory. Now you can test
  containers which are disabled.
2017-09-28 10:27:15 -05:00
Nikolai Vazquez
cb2a656cdf Fix errors in Box<Path> conversions 2017-09-28 10:59:12 -04:00
Alex Crichton
7694ca419b Update to the cc crate
This is the name the `gcc` crate has moved to
2017-09-28 07:45:50 -07:00
Nikolai Vazquez
c7b4a96909 Remove unused 'mem' import in 'path' module 2017-09-28 10:30:41 -04:00
Nikolai Vazquez
48c20b6a50 Remove mem::transmute used in Path conversions 2017-09-28 10:29:58 -04:00
Nikolai Vazquez
627998e86f Remove unused 'mem' import in 'os_str' module 2017-09-28 08:43:06 -04:00
bors
d88736905e Auto merge of #44806 - KiChjang:mir-err-notes-2, r=pnkfelix
Add span label to E0384 for MIR borrowck

Corresponds to `report_illegal_reassignment`.

Part of #44596.
2017-09-28 12:40:12 +00:00
Nikolai Vazquez
33eaa94f90 Remove mem::transmute used in OsStr conversions 2017-09-28 08:07:49 -04:00
Nikolai Vazquez
755fd29b60 Fix mutability error in CString::from_raw 2017-09-28 07:56:35 -04:00
bors
f22b9da1c3 Auto merge of #44790 - clarcharr:zip_bytes, r=sfackler
TrustedRandomAccess specialisation for Iterator::cloned when Item: Copy.

This should fix #44424. It also provides a potential fix for more iterators using `Iterator::cloned`.
2017-09-28 09:10:12 +00:00
Havvy
20fc215323 Normalize spaces in lang attributes. 2017-09-28 01:30:25 -07:00
Havvy
72b3139c3f Backticks. 2017-09-27 23:31:29 -07:00
Havvy
0118398291 Docs for size_of::<#[repr(C)]> items.
Most of this info comes from camlorn's blog post on optimizing
struct layout and the Rustonomicon.
2017-09-27 23:01:48 -07:00
Nikolai Vazquez
6d14512fd9 Remove mem::transmute used in CStr conversions 2017-09-28 00:51:38 -04:00
bors
9cb90f4e23 Auto merge of #44779 - tjkirch:master, r=alexcrichton
Add aarch64-unknown-linux-musl target

This adds support for the aarch64-unknown-linux-musl target in the build and CI systems.

This addresses half of issue #42520.

The new file `aarch64_unknown_linux_musl.rs` is a copy of `aarch64_unknown_linux_gnu.rs` with "gnu" replaced by "musl", and the added logic in `build-arm-musl.sh` is similarly a near-copy of the arches around it, so overall the changes were straightforward.

Testing:

```
$ sudo ./src/ci/docker/run.sh cross
...
Dist std stage2 (x86_64-unknown-linux-gnu -> aarch64-unknown-linux-musl)
Building stage2 test artifacts (x86_64-unknown-linux-gnu -> aarch64-unknown-linux-musl)
   Compiling getopts v0.2.14
   Compiling term v0.0.0 (file:///checkout/src/libterm)
   Compiling test v0.0.0 (file:///checkout/src/libtest)
    Finished release [optimized] target(s) in 16.91 secs
Copying stage2 test from stage2 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / aarch64-unknown-linux-musl)
...
Build completed successfully in 0:55:22
```

```
$ rustup toolchain link local obj/build/x86_64-unknown-linux-gnu/stage2
$ rustup default local
```

After setting the local toolchain as default, and adding this in ~/.cargo/config:

```
[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-musl-gcc"
```

...then the toolchain was able to build a working ripgrep as a test:

```
$ readelf -a target/aarch64-unknown-linux-musl/debug/rg | grep -i interpreter
$ readelf -a target/aarch64-unknown-linux-musl/debug/rg | grep NEEDED
$ file target/aarch64-unknown-linux-musl/debug/rg
target/aarch64-unknown-linux-musl/debug/rg: ELF 64-bit LSB executable, ARM aarch64, version 1 (GNU/Linux), statically linked, BuildID[sha1]=be11036b0988fac5dccc9f6487eb780b05186582, not stripped
```
2017-09-28 03:28:20 +00:00
Stephane Raux
61c0c9e5f2 Made fs::copy return the length of the main stream
On Windows with the NTFS filesystem, `fs::copy` would return the sum of the
lengths of all streams, which can be different from the length reported by
`metadata` and thus confusing for users unaware of this NTFS peculiarity.

This makes `fs::copy` return the same length `metadata` reports which is the
value it used to return before PR #26751. Note that alternate streams are still
copied; their length is just not included in the returned value.

This change relies on the assumption that the stream with index 1 is always the
main stream in the `CopyFileEx` callback. I could not find any official
document confirming this but empirical testing has shown this to be true,
regardless of whether the alternate stream is created before or after the main
stream.

Resolves #44532
2017-09-27 19:43:05 -07:00
Alex Crichton
041d3550f6 Update some minor dependencies 2017-09-27 15:40:57 -07:00
Alex Crichton
9b91b877ad Update the Cargo submodule 2017-09-27 15:40:57 -07:00
Nick Cameron
71a0be0792 Update the RLS again 2017-09-27 15:40:57 -07:00
Nick Cameron
bfcb290937 Add RLS and Rustfmt to the toolstate mechanism 2017-09-27 15:40:57 -07:00
Nick Cameron
c0ea270f70 Rename rls component to rls-preview on nightly 2017-09-27 15:40:57 -07:00
Nick Cameron
c5cad5a78d Update RLS and Rustfmt 2017-09-27 15:40:57 -07:00
bors
44d5090a6d Auto merge of #44782 - estebank:issue-36700, r=GuillaumeGomez
Point at parameter type on E0301

On "the parameter type `T` may not live long enough" error, point to the
parameter type suggesting lifetime bindings:

```
error[E0310]: the parameter type `T` may not live long enough
  --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5
   |
27 | struct Foo<T> {
   |            - help: consider adding an explicit lifetime bound `T: 'static`...
28 |     foo: &'static T
   |     ^^^^^^^^^^^^^^^
   |
note: ...so that the reference type `&'static T` does not outlive the data it points at
  --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5
   |
28 |     foo: &'static T
   |     ^^^^^^^^^^^^^^^
```

Fix #36700.
2017-09-27 22:00:11 +00:00
Hunter Praska
e30d92bb2d Add UI tests 2017-09-27 17:57:18 -04:00
Hunter Praska
28996db803 Rename option::Missing to NoneError 2017-09-27 17:57:07 -04:00
Hunter Praska
8f63e8de46 Add docs for Missing, correct Option's Try test 2017-09-27 17:56:54 -04:00
Hunter Praska
f098d7be29 Add tests for Option and Result Try impl 2017-09-27 17:56:40 -04:00
Hunter Praska
2bd104fd4f Impl Try for Option 2017-09-27 17:56:15 -04:00
Pirh
7ab20c850e Explain difference between panic! and abort in abort docs
As per #29370
2017-09-27 22:47:21 +01:00
Pirh
6dfa45d2ed Remove extraneous brackets from abort documentation
As per #29370
2017-09-27 21:13:07 +01:00
Tomas Nilsson
0f97b6b73c Apply attr proc macros before cfg processing
Now items are not fully configured until right before expanding derives.
2017-09-27 22:08:45 +02:00
Santiago Pastorino
e0e14c9a5b Remove SerializedDepNodeIndex::new it is already impl for Idx 2017-09-27 16:41:35 -03:00
Santiago Pastorino
70c3a3da6d Remove DepNodeIndexNew::new and ::index, they are already impl for Idx 2017-09-27 16:32:27 -03:00
Nikolai Vazquez
36d663fcfc Remove mem::transmute used in Box<str> conversions 2017-09-27 14:56:20 -04:00
Santiago Pastorino
cde47cef0f Remove DepNodeIndex::new is already impl for Idx 2017-09-27 15:11:22 -03:00
Jonathan A. Kollasch
90aa66bfc2 bootstrap: use tar -z on extract
Some tar(1) programs—such as NetBSD's—do not automatically decompress.
2017-09-27 11:17:42 -05:00
Jonathan A. Kollasch
b53b853129 bootstrap: use shasum(1) on NetBSD build hosts
NetBSD doesn't ship with sha256sum.  The openssl build will probably
try to use perl anyway, so using perl's shasum is reasonable.
2017-09-27 11:17:42 -05:00
bors
0e6f4cf51c Auto merge of #44709 - Badel2:inclusive-range-dotdoteq, r=petrochenkov
Initial support for `..=` syntax

#28237

This PR adds `..=` as a synonym for `...` in patterns and expressions.
Since `...` in expressions was never stable, we now issue a warning.

cc @durka
r? @aturon
2017-09-27 16:04:31 +00:00
Luca Barbato
7bdf013a0e Add support for Vector Negative Multiply Subtract Float on PowerPC 2017-09-27 13:35:18 +00:00