Commit Graph

67373 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Mark Simulacrum
66670584cf Rollup merge of #44377 - mathstuf:config.toml-typos, r=alexcrichton
config.toml.example: fix some typos
2017-09-06 18:28:08 -06:00
Mark Simulacrum
435a5cdc6b Rollup merge of #44362 - oli-obk:patch-7, r=eddyb
Fix a bug in the inliner

r? @eddyb
2017-09-06 18:28:07 -06:00
Mark Simulacrum
f8b7c3e1db Rollup merge of #44361 - oli-obk:lit_sugg, r=nikomatsakis
Suggest changing literals instead of calling methods (fixes #44307)
2017-09-06 18:28:06 -06:00
Mark Simulacrum
48dcebd586 Rollup merge of #44354 - jakllsch:jakllsch-85453197-a0cc-43f6-8c55-7bce6c4a4ebf, r=Mark-Simulacrum
bootstrap: openssl for NetBSD/sparc64 in extended build

r? @Mark-Simulacrum
2017-09-06 18:28:05 -06:00
Mark Simulacrum
eba44f10f9 Rollup merge of #44353 - cuviper:install-rustc, r=Mark-Simulacrum
Include rustc in the default `./x.py install`

The default install used to include rustc, rust-std, and rust-docs, but
the refactoring in commit 6b3413d825 make rustc only default in
extended builds.  This commit makes rustc installed by default again.
2017-09-06 18:28:04 -06:00
Mark Simulacrum
b0929aadad Rollup merge of #44351 - lu-zero:master, r=nikomatsakis
More PowerPC Altivec intrinsics
2017-09-06 18:28:03 -06:00
Mark Simulacrum
ae96d68605 Rollup merge of #44330 - WiSaGaN:patch-1, r=aturon
Fix link typo in 1.20.0 release notes

Should have been included in https://github.com/rust-lang/rust/pull/44230
2017-09-06 18:28:02 -06:00
Mark Simulacrum
e7470c9f18 Rollup merge of #44328 - mcomstock:from-str-doc-fix, r=steveklabnik
Removed the incorrect documentation for from_str

Fixes #44242.
2017-09-06 18:28:00 -06:00
Mark Simulacrum
d2c85a0899 Rollup merge of #44327 - Eh2406:FIXME#12808, r=aturon
#12808 is closed remove the FIXME

let's see if this can be cleaned up.

https://github.com/rust-lang/rust/issues/12808#issuecomment-326852052
2017-09-06 18:27:59 -06:00
Mark Simulacrum
43d20c7abd Rollup merge of #44326 - Eh2406:FIXME#44590, r=arielb1
#33490 is closed remove the FIXME

let's see if this can be cleaned up.

https://github.com/rust-lang/rust/issues/33490#issuecomment-326851930
2017-09-06 18:27:58 -06:00
Mark Simulacrum
a4b54848d4 Rollup merge of #44325 - nielsegberts:master, r=steveklabnik
Make slice::split_at_mut example demonstrate mutability

Moved the examples from split_at_mut to split_at so the example at
split_at_mut can just demonstrate mutability.

See #44314

r? @steveklabnik
2017-09-06 18:27:57 -06:00
Mark Simulacrum
596e97fdce Rollup merge of #44321 - jakllsch:jakllsch-4f2d6c87-2674-43e4-9c5f-2415136e6bdc, r=Mark-Simulacrum
bootstrap: only include docs in extended distribution if enabled

Fixes #44163
2017-09-06 18:27:56 -06:00
Mark Simulacrum
405123391a Rollup merge of #44319 - est31:master, r=eddyb
Improve DefIndex formatting to be more semantic

Fixes #44318

r? @eddyb
2017-09-06 18:27:55 -06:00
Mark Simulacrum
089bbd029e Rollup merge of #44317 - Dushistov:master, r=arielb1
Add test for #22706

Closes #22706
2017-09-06 18:27:54 -06:00
Mark Simulacrum
fdb8d0beb4 Rollup merge of #44315 - kallisti5:epoch-doc-example-squashed, r=GuillaumeGomez
std/time: Give an example to get UNIX_EPOCH in seconds
2017-09-06 18:27:53 -06:00
Mark Simulacrum
50f14e906f Rollup merge of #44313 - RalfJung:book, r=nikomatsakis
rustbook: remove dead test functions

There is no "test" subcommand added to the `clap::App`, so this is all dead code.

Cc @steveklabnik -- your [commit](a076961fd0) introducing this stated the intention of having both commands, but it seems nobody has missed the `test` command since February.
2017-09-06 18:27:52 -06:00
Mark Simulacrum
923c3518bc Rollup merge of #44303 - clarcharr:debugs, r=alexcrichton
impl Debug for SplitWhitespace.

This one got missed because `libstd_unicode` doesn't have a `deny(missing_debug_implementations)` like `libstd` and `libcore`. I think that perhaps this lint should check for items exported from other crates too.
2017-09-06 18:27:51 -06:00
Mark Simulacrum
fee0b67177 Rollup merge of #44296 - zmanian:patch-1, r=steveklabnik
Minor documentation improvements for StmtKind

Documentation for Semi and Marco StmtKinds.

Wasn't obvious to me what these were when writing a lint recently.
2017-09-06 18:27:50 -06:00
Mark Simulacrum
5c79f6d05c Rollup merge of #44277 - mattico:test-33185, r=nikomatsakis
Add test for #33185

Closes #33185
2017-09-06 18:27:49 -06:00
Mark Simulacrum
2dabf35771 Rollup merge of #44276 - mattico:test-35376, r=alexcrichton
Add test for #35676

Closes #35676
2017-09-06 18:27:48 -06:00
Mark Simulacrum
da5e5ef4a2 Rollup merge of #44218 - SimonSapin:commit-hash, r=alexcrichton
Add full git commit hash to release channel manifests

The full hash is necessary to build the download URL for "alternate" compiler builds. This is a first step for https://github.com/rust-lang-nursery/rustup.rs/issues/1099.
2017-09-06 18:27:47 -06:00
Mark Simulacrum
b8812a2179 Rollup merge of #44206 - MarkMcCaskey:master, r=steveklabnik
update unimplemented! docs

For #42628 (updating docs from changes from #42155).

Initial changes made to make `unimplemented!` doc comments look more like `unreachable!` and remove statement about the panic message.

r? @steveklabnik
2017-09-06 18:27:46 -06:00
Mark Simulacrum
44351edb64 Rollup merge of #44097 - Xaeroxe:clamp, r=burntsushi
Add clamp functions

Implementation of clamp feature:

Tracking issue: https://github.com/rust-lang/rust/issues/44095
RFC: https://github.com/rust-lang/rfcs/pull/1961
2017-09-06 18:27:45 -06:00
Ben Boeckel
04cbf6eece config.toml.example: fix some typos 2017-09-06 18:23:50 -04:00
bors
3681220877 Auto merge of #43975 - RalfJung:gcc, r=alexcrichton
use gcc::Build rather than deprecated gcc::Config

I did `cargo update -p gcc` to upgrade only this package. Is there further process that should be follwoed when updating a build dependency from crates.io?

r? @alexcrichton
Fixes #43973
2017-09-06 19:28:36 +00:00
Stuart Pernsteiner
347db068a5 hir::print: fix parenthesization of exprs 2017-09-06 13:01:15 -04:00
Stuart Pernsteiner
5b2151ea21 better explanatory comment for the pprust-expr-roundtrip test 2017-09-06 10:30:00 -04:00
Stuart Pernsteiner
b79dada453 pprust: fix parenthesization of exprs 2017-09-06 10:26:51 -04:00
bors
a209539060 Auto merge of #43849 - QuietMisdreavus:foreign-impls, r=steveklabnik
rustdoc: add new "Implementations on Foreign Types" section to traits

Demo screenshot:

![image](https://user-images.githubusercontent.com/5217170/29281219-c547f758-80e3-11e7-808f-49f592c65c5b.png)

Full demo available at https://tonberry.quietmisdreavus.net/foreign-test/foreign_test/trait.CheckIt.html

This PR splits the "Implementors" section on trait pages into two: First, for impls on types local to the crate, their impls are kept as-is, printing one line for the impl line, and any additional lines for associated types. However, for types external to the crate, they are now pulled up over the others and are printed (almost) like the summary impl on the type page itself. This gives any doc comments on these impls or methods to be exposed in the documentation.

There's just one small problem, though: [libstd docs apparently surface impls for libc and rand, possibly among others](https://tonberry.quietmisdreavus.net/foreign-std/std/marker/trait.Copy.html#foreign-impls). This adds this section to pages in the std docs where we might not want them to show up in the first place. I think this is a bug distinct from this PR, but it does make it drastically apparent.

~~My question, then, is this: Do we want this here? Taking it out involves fixing which impls are visible to rustdoc, possibly specifically when rendering the std facade. I'm convinced this is fine to land as-is, since it adds a feature specifically for non-std crates (i'm thinking of things like `num` or related crates that implement things on primitives or std types as part of their functionality).~~ (EDIT: I have an open PR to fix this: https://github.com/rust-lang/rust/pull/44026)
2017-09-06 11:24:18 +00:00
Oliver Schneider
5bb870faca Reintroduce the early returns 2017-09-06 12:25:46 +02:00
Oliver Schneider
02fb1b0b72 Fix a bug in the inliner 2017-09-06 10:33:53 +02:00
Oliver Schneider
ddd01455e9
Suggest changing literals instead of calling methods (fixes #44307) 2017-09-06 10:09:25 +02:00
Alex Crichton
ed938f08a9 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-05 21:07:02 -07:00
Zaki Manian
af3536dbbc Remove trailing white space 2017-09-05 18:46:21 -07:00
bors
f83d20eff7 Auto merge of #43426 - qnighy:intercrate-ambiguity-hints, r=nikomatsakis
Add hints when intercrate ambiguity causes overlap.

I'm going to tackle #23980.

# Examples

## Trait impl overlap caused by possible downstream impl

```rust
trait Foo<X> {}
trait Bar<X> {}
impl<X, T> Foo<X> for T where T: Bar<X> {}
impl<X> Foo<X> for i32 {}

fn main() {}
```

```
error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`:
 --> test1.rs:4:1
  |
3 | impl<X, T> Foo<X> for T where T: Bar<X> {}
  | ------------------------------------------ first implementation here
4 | impl<X> Foo<X> for i32 {}
  | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32`
  |
  = note: downstream crates may implement Bar

error: aborting due to previous error
```

## Trait impl overlap caused by possible upstream update

```rust
trait Foo {}
impl<T> Foo for T where T: ::std::fmt::Octal {}
impl Foo for () {}

fn main() {}
```

```
error[E0119]: conflicting implementations of trait `Foo` for type `()`:
 --> test2.rs:3:1
  |
2 | impl<T> Foo for T where T: ::std::fmt::Octal {}
  | ----------------------------------------------- first implementation here
3 | impl Foo for () {}
  | ^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
  |
  = note: upstream crates may add new impl for std::fmt::Octal in future versions

error: aborting due to previous error
```

## Inherent impl overlap caused by possible downstream impl

```rust
trait Bar<X> {}

struct A<T, X>(T, X);
impl<X, T> A<T, X> where T: Bar<X> { fn f(&self) {} }
impl<X> A<i32, X> { fn f(&self) {} }

fn main() {}
```

```
error[E0592]: duplicate definitions with name `f`
 --> test3.rs:4:38
  |
4 | impl<X, T> A<T, X> where T: Bar<X> { fn f(&self) {} }
  |                                      ^^^^^^^^^^^^^^ duplicate definitions for `f`
5 | impl<X> A<i32, X> { fn f(&self) {} }
  |                     -------------- other definition for `f`
  |
  = note: downstream crates may implement Bar

error: aborting due to previous error
```

## Inherent impl overlap caused by possible upstream update

```rust
struct A<T>(T);

impl<T> A<T> where T: ::std::fmt::Octal { fn f(&self) {} }
impl A<()> { fn f(&self) {} }

fn main() {}
```

```
error[E0592]: duplicate definitions with name `f`
 --> test4.rs:3:43
  |
3 | impl<T> A<T> where T: ::std::fmt::Octal { fn f(&self) {} }
  |                                           ^^^^^^^^^^^^^^ duplicate definitions for `f`
4 | impl A<()> { fn f(&self) {} }
  |              -------------- other definition for `f`
  |
  = note: upstream crates may add new impl for std::fmt::Octal in future versions

error: aborting due to previous error
```
2017-09-06 00:28:15 +00:00
Jonathan A. Kollasch
847d1ffbe9 bootstrap: avoid m4 -B for NetBSD-built sparc64 OpenSSL 2017-09-05 16:31:14 -05:00
Jonathan A. Kollasch
2047a0d083 bootstrap: add openssl config for sparc64-unknown-netbsd 2017-09-05 16:31:14 -05:00
Josh Stone
110efe25fa Include rustc in the default ./x.py install
The default install used to include rustc, rust-std, and rust-docs, but
the refactoring in commit 6b3413d825 make rustc only default in
extended builds.  This commit makes rustc installed by default again.
2017-09-05 14:19:22 -07:00
Luca Barbato
c3041e8b9e Add support for Vector Sum Saturated on PowerPC 2017-09-05 20:30:47 +00:00