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.
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>
* 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.
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.
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
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.)
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
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
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.
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
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.
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.
Minor documentation improvements for StmtKind
Documentation for Semi and Marco StmtKinds.
Wasn't obvious to me what these were when writing a lint recently.
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
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
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)
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
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.