Commit Graph

67618 Commits

Author SHA1 Message Date
Eduard-Mihai Burtescu
5601ae4b72 Stabilize drop_types_in_const. 2017-09-09 17:39:30 +03:00
bors
18366f4e8a Auto merge of #44212 - eddyb:drop-const, r=nikomatsakis
Allow Drop types in const's too, with #![feature(drop_types_in_const)].

Implements the remaining amendment, see #33156. cc @SergioBenitez

r? @nikomatsakis
2017-09-09 11:48:57 +00:00
bors
929b878262 Auto merge of #44438 - Xaeroxe:clamp, r=Mark-Simulacrum
Revert clamp

Revert clamp per https://github.com/rust-lang/rust/issues/44095#issuecomment-328218316 while we take time to assess the potential backwards compatibility damage done by it.
2017-09-09 09:13:03 +00:00
John Kåre Alsaker
967c4e6347 Fix bitrotted generator panic emission 2017-09-09 11:11:13 +02:00
Sergio Benitez
5d3626d0f2 Add impl From<Vec<Span>> for MultiSpan. 2017-09-09 02:09:10 -07:00
Tommy Ip
3e8fadc2ac Add doc example to String::as_str
Fixes #44428.
2017-09-09 09:05:54 +01:00
bors
a9fa8cc0b6 Auto merge of #44335 - arielb1:node-hashing, r=alexcrichton
Avoid hashing when creating a DepNode from a HirId

Instead, combine the already-present DefPathHash with the 32-bit
ItemLocalIndex.

Should fix #44323.

r? @alexcrichton
2017-09-09 05:58:13 +00:00
gaurikholkar
cfc7cf3961 adding E0623 for LateBound regions 2017-09-09 11:12:27 +05:30
Aaron Hill
07becc5f24
Fix regression in promotion of rvalues referencing a static
This commit makes librustc_passes::consts::CheckCrateVisitor properly
mark expressions as promotable if they reference a static, as it's
perfectly fine for one static to reference another. It fixes a
regression that prevented a temporary rvalue from referencing a static
if it was itself declared within a static.

Prior to commit https://github.com/rust-lang/rust/commit/b8c05fe90bc,
`region::ScopeTree` would only register a 'terminating scope' for function
bodies. Thus, while rvalues in a static that referenced a static would be marked
unpromotable, the lack of enclosing scope would cause
mem_categorization::MemCategorizationContext::cat_rvalue_node
to compute a 'temporary scope' of `ReStatic`. Since this had the same
effect as explicitly selecting a scope of `ReStatic`
due to the rvalue being marked by CheckCrateVisitor as promotable,
no issue occurred.

However, commit https://github.com/rust-lang/rust/commit/b8c05fe90bc
made ScopeTree unconditionally register a 'terminating scope'
Since mem_categorization would now compute a non-static 'temporary scope', the
aforementioned rvalues would be erroneously marked as living for too
short a time.

By fixing the behavior of CheckCrateVisitor, this commit avoids changing
mem_categorization's behavior, while ensuring that temporary values in
statics are still allowed to reference other statics.

Fixes issue #44373
2017-09-08 20:22:50 -04:00
bors
dee6d0f62e Auto merge of #44269 - nikomatsakis:issue-43613-limit-cache-obligations, r=arielb1
limit and clear cache obligations opportunistically

Keeping **all** the obligations for every projection is wasteful of
memory and compilation time. We only really care about those
subobligations that may inform the result of the projection (i.e., may
help to resolve any inference variables that appear within).
Therefore, we can clear the subobligations from the cache that don't
potentially affect the result of the projection. On every cache hit,
we also take the opportunity to check if the type variables have been
resolved *yet* and, if so, clear out the pending obligations.

Fixes #43613.

r? @arielb1

NB -- not sure how to test for this. Probably we should add the #43613 test case to perf.
2017-09-08 23:47:16 +00:00
Josh Stone
c606e97cc6 Add a test for min_global_align 2017-09-08 15:55:28 -07:00
Jacob Kiesel
db5b5f9706 Revert "Add clamp functions"
This reverts commit c589f867f8.
2017-09-08 16:07:21 -06:00
Jacob Kiesel
63f4dab0f5 Revert "Add NAN examples"
This reverts commit f74c5d2e18.
2017-09-08 16:07:19 -06:00
Jacob Kiesel
eafdad511f Revert "Fix f32 examples."
This reverts commit 61f20f8df0.
2017-09-08 16:07:17 -06:00
Jacob Kiesel
15d3eeaf65 Revert "Fix f64 examples"
This reverts commit 576426a05a.
2017-09-08 16:07:15 -06:00
Jacob Kiesel
8b96167004 Revert "Fix documentation and formatting."
This reverts commit 2e34ff7671.
2017-09-08 16:07:13 -06:00
Jacob Kiesel
67283fa8e6 Revert "Add panic unit tests"
This reverts commit b762283e57.
2017-09-08 16:07:09 -06:00
Josh Stone
95a5a0ed16 Add TargetOptions::min_global_align, with s390x at 16-bit
The SystemZ `LALR` instruction provides PC-relative addressing for
globals, but only to *even* addresses, so other compilers make sure that
such globals are always 2-byte aligned.  In Clang, this is modeled with
`TargetInfo::MinGlobalAlign`, and `TargetOptions::min_global_align` now
serves the same purpose for rustc.

In Clang, the only targets that set this are SystemZ, Lanai, and NVPTX,
and the latter two don't have targets in rust master.
2017-09-08 14:49:51 -07:00
Eduard-Mihai Burtescu
da0a47a081 Use NodeId/HirId instead of DefId for local variables. 2017-09-08 22:00:59 +03:00
Douglas Campos
10a5b539c7 simplify 2017-09-08 11:06:28 -04:00
Tobias Schaffner
5d1a9d7ae7 Update liblibc submodule to include latest uclibc changes 2017-09-08 14:36:56 +02:00
Sebastian Humenda
40794bf4b8 Move the stack size value for L4Re to the min_stack_size function 2017-09-08 14:36:56 +02:00
Sebastian Humenda
0b77464d22 Re-enable networking module fo rL4Re
As suggested in the discussion of PR #43972, std should provide a uniform API to
all platforms. Since there's no networking on L4Re, this now is a module in
`sys::net` providing types and functions/methods returning an error for each
action.
2017-09-08 14:36:56 +02:00
Tobias Schaffner
9bbc6dbde3 Add modifications needed for L4re in libstd
This commit adds the needed modifications to compile the std crate
for the L4 Runtime environment (L4Re).

A target for the L4Re was introduced in commit:
c151220a84

In many aspects implementations for linux also apply for the L4Re
microkernel.

Two uncommon characteristics had to be resolved:
* L4Re has no network funktionality
* L4Re has a maximum stacksize of 1Mb for threads

Co-authored-by: Sebastian Humenda <sebastian.humenda@tu-dresden.de>
2017-09-08 14:36:56 +02:00
Sebastian Humenda
2cf0a4ad46 Match c_char definitions and enable signal reset for L4Re
*   Match definition of c_char in os/raw.rs with the libc definition

    Due to historic reasons, os/raw.rs redefines types for c_char from
    libc, but these didn't match. Now they do :).

*   Enable signal reset on exec for L4Re

    L4Re has full signal emulation and hence it needs to reset the
    signal set of the child with sigemptyset. However, gid and uid
    should *not* be set.
2017-09-08 14:36:56 +02:00
est31
d587558269 Move the man directory to a subdirectory
There is no reason it should be in the top directory.
2017-09-08 12:51:19 +02:00
bors
dead08cb33 Auto merge of #44142 - alexcrichton:dllimport-query, r=nikomatsakis
Migrate a slew of metadata methods to queries

This PR intends to make more progress on #41417, knocking off some low-hanging fruit.

Closes #44190
cc #44137
2017-09-08 09:47:58 +00:00
bors
d6ad402a64 Auto merge of #43742 - epdtry:pprust-expr-fix, r=petrochenkov
pprust: fix parenthesization of exprs

The pretty printer in `syntax::print::pprust` currently relies on the presence of `ExprKind::Paren` hints in order to correctly parenthesize expressions in its output.  If `Paren` nodes are missing, it sometimes produces wrong output, such as printing `1 - (2 - 3)` as `1 - 2 - 3`.  This PR fixes `pprust` to correctly print expressions regardless of the presence or absence of `Paren` nodes.  This should make `pprust` easier to use with programmatically constructed ASTs.

A few notes:

 * I added a function for assigning precedence values to exprs in `syntax::util::parser`, since there is already code there for assigning precedence values to binops.  Let me know if I should move this somewhere more `pprust`-specific.

 * I also moved the `contains_exterior_struct_lit` function from `rustc_lint::unused::UnusedParens` into `syntax::util::parser`, since it's needed for determining the correct parenthesization of `if`/`while` conditional expressions.

 * I couldn't find a good way to compare two exprs for equivalence while ignoring semantically-irrelevant details like spans.  So the test for the new behavior relies on a slight hack: it adds `Paren` nodes everywhere, so that the pretty-printed version exactly reflects the structure of the AST, and then compares the printed strings.  This works, but let me know if there's a better way.
2017-09-08 06:56:09 +00:00
Alex Crichton
43efccee89 Fix sanitizer tests on buggy kernels
Travis recently pushed an update to the Linux environments, namely the kernels
that we're running on. This in turn caused some of the sanitizer tests we run to
fail. We also apparently weren't the first to hit these failures! Detailed in
google/sanitizers#837 these tests were failing due to a specific commit in the
kernel which has since been backed out, but for now work around the buggy kernel
that's deployed on Travis and eventually we should be able to remove these
flags.
2017-09-07 20:44:38 -07:00
bors
e1ef1882a0 Auto merge of #44399 - alexcrichton:tmp-travis-downgrade, r=alexcrichton
travis: Downgrade to previous images temporarily

Travis is in the process of [rolling out an update][update] but looks like our
tests are breaking, let's temporarily roll back to get the queue moving again.

[update]: https://blog.travis-ci.com/2017-08-29-trusty-image-updates
2017-09-07 22:45:48 +00:00
Alex Crichton
7ed298609c travis: Downgrade to previous images temporarily
Travis is in the process of [rolling out an update][update] but looks like our
tests are breaking, let's temporarily roll back to get the queue moving again.

[update]: https://blog.travis-ci.com/2017-08-29-trusty-image-updates
2017-09-07 13:48:35 -07:00
Joshua Liebow-Feeser
ddb072b8d7 std:🧵:LocalKey: Document limitation with initializers 2017-09-07 12:57:08 -07:00
Niko Matsakis
c1dddcec06 update comment 2017-09-07 12:38:33 -04:00
Alex Crichton
fd0aa647f3 rustc: Remove CrateStore::crates as a method
This commit moves the `crates` method to a query and then migrates all callers
to use a query instead of the now-renamed `crates_untracked` method where
possible.

Closes #41417
2017-09-07 08:13:41 -07:00
Alex Crichton
2ee7493b2a Add some more with_ignore to get tests passing 2017-09-07 08:13:17 -07:00
Stuart Pernsteiner
3454d99cb6 pprust: increase precedence of block-like exprs 2017-09-07 10:28:31 -04:00
bors
d93036a043 Auto merge of #44249 - pnkfelix:debugflag-emit-end-regions, r=arielb1
Debugflag: -Z emit-end-regions

 Skip EndRegion emission by default. Use `-Z emit-end-regions` to reenable it.

The main intent is to fix cases where `EndRegion` emission is believed to be causing excess peak memory pressure.

It may also be a welcome change to people inspecting the MIR output who find the EndRegions to be a distraction.

(In later follow-up PR's I will put in safe-guards against using the current mir-borrowck without enabling `EndRegion` emission. But I wanted this PR to be minimal, in part because we may wish to backport it to the beta channel if we find that it reduces peak memory usage significantly.)
2017-09-07 13:06:12 +00:00
Tobias Bucher
b4d0f61771 Clarify the behavior of UDP sockets wrt. multiple addresses in connect 2017-09-07 11:26:23 +02:00
kennytm
83d14bda7f
Disable the 80-year-difference test on 32-bit-time_t platforms. 2017-09-07 17:14:27 +08:00
kennytm
756026563d
Fix incorrect test in time::tests::system_time_math. 2017-09-07 17:14:27 +08:00
kennytm
8410ca6632
Properly detect overflow in Instance +/- Duration.
Avoid unchecked cast from `u64` to `i64`. Use `try_into()` for checked
cast. (On Unix, cast to `time_t` instead of `i64`.)
2017-09-07 17:14:27 +08:00
est31
d58281097a Fix mispositioned error indicators
Fixes #38384

Most of the Rust community uses 4 spaces for indentation,
but there are also tab users of Rust (including myself!).

This patch fixes a bug in error printing which mispositions
error indicators when near code with tabs.

The code attempted to fix the issue by replacing spaces
with tabs, but it sadly wasn't enough, as sometimes
you may not print spaces but _ or ^ instead.

This patch employs the reverse strategy: it replaces each
tab with a space, so that the number of _ and ^ and spaces
in error indicators below the code snippet line up
perfectly.

In a study [1] preceeding this patch, we could see that
this strategy is also chosen by gcc version 6.3.0.

Its not perfect, as the output is not beautiful, but its
the easiest to implement. If anyone wants to improve on
this, be my guest! This patch is meant as improvement of
the status quo, not as perfect end status. It fixes the
actual issue of mispositioning error indicators.

[1]: https://github.com/rust-lang/rust/issues/38384#issuecomment-326813710
2017-09-07 10:26:27 +02:00
est31
fc44447bb9 Update the libcompiler_builins submodule
Pulls in https://github.com/rust-lang-nursery/compiler-builtins/pull/187 for nicer build output :)
2017-09-07 09:08:09 +02:00
bors
d7d75eff30 Auto merge of #43931 - eddyb:const-local-key, r=alexcrichton
Make the LocalKey facade of thread_local! inlineable cross-crate.

Fixes (almost*) #25088 by changing the `LocalKey` `static` `thread_local!` generates to a `const`.
This can be done because a `LocalKey` value holds no actual TLS data, only function pointers to get at said data, and it could even be made `Copy` without any negative consequences.
The recent stabilization of rvalue promotion to `'static` allows doing this without changing the API.
r? @alexcrichton

*almost because we can't yet inline `__getit` because it breaks on MSVC, see https://github.com/rust-lang/rust/pull/43931#issuecomment-323534214
2017-09-07 06:52:05 +00:00
Alex Crichton
f633284b3d std: Fix a segfault on OSX with backtraces
Apparently `dladdr` can succeed but still give you NULL pointers!

Closes #44379
2017-09-06 22:14:34 -07:00
bors
a6a9d4c5fd Auto merge of #44094 - alexcrichton:long-linkers, r=michaelwoerister
rustc: Attempt to handle super long linker invocations

This commit adds logic to the compiler to attempt to handle super long linker
invocations by falling back to the `@`-file syntax if the invoked command is too
large. Each OS has a limit on how many arguments and how large the arguments can
be when spawning a new process, and linkers tend to be one of those programs
that can hit the limit!

The logic implemented here is to unconditionally attempt to spawn a linker and
then if it fails to spawn with an error from the OS that indicates the command
line is too big we attempt a fallback. The fallback is roughly the same for all
linkers where an argument pointing to a file, prepended with `@`, is passed.
This file then contains all the various arguments that we want to pass to the
linker.

Closes #41190
2017-09-07 04:07:09 +00:00
Douglas Campos
72c92b3233 better test documentation 2017-09-06 23:10:08 -04:00
Douglas Campos
784e4316eb ugly, but works! 2017-09-06 23:06:14 -04:00
Douglas Campos
b413596da6 add broken test 2017-09-06 23:06:13 -04:00
bors
05e3c96d36 Auto merge of #44380 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 23 pull requests

- Successful merges: #44097, #44206, #44218, #44276, #44277, #44296, #44303, #44313, #44315, #44317, #44319, #44321, #44325, #44326, #44327, #44328, #44330, #44351, #44353, #44354, #44361, #44362, #44377
- Failed merges:
2017-09-07 01:04:34 +00:00