Commit Graph

66553 Commits

Author SHA1 Message Date
bors
f3cf206201 Auto merge of #43836 - taleks:issue-39827, r=arielb1
Fix for issue #39827

*Cause of the issue*

While preparing for `trans_intrinsic_call()` invoke arguments are processed with `trans_argument()` method which excludes zero-sized types from argument list (to be more correct - all arguments for which `ArgKind` is `Ignore` are filtered out). As result `volatile_store()` intrinsic gets one argument instead of expected address and value.

*How it is fixed*

Modification of the `trans_argument()` method may cause side effects, therefore change was implemented in `volatile_store()` intrinsic building code itself. Now it checks function signature and if it was specialised with zero-sized type, then emits `C_nil()` instead of accessing non-existing second argument.
2017-08-13 23:33:18 +00:00
bors
ab40a7cb0e Auto merge of #43815 - alexcrichton:optimize-alloc, r=sfackler
Optimize allocation paths in RawVec

Since the `Alloc` trait was introduced (https://github.com/rust-lang/rust/pull/42313) and it was integrated everywhere (https://github.com/rust-lang/rust/pull/42727) there's been some slowdowns and regressions that have slipped through. The intention of this PR is to try to tackle at least some of them, but they've been very difficult to quantify up to this point so it probably doesn't solve everything.

This PR primarily targets the `RawVec` type, specifically the `double` function. The codegen for this function is now much closer to what it was before #42313 landed as many runtime checks have been elided.
2017-08-13 19:28:57 +00:00
bors
a80a873209 Auto merge of #43839 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 8 pull requests

- Successful merges: #43782, #43803, #43814, #43819, #43821, #43822, #43824, #43833
- Failed merges:
2017-08-13 10:22:45 +00:00
Alexey Tarasov
faf6b84304 Addresses comments in PR #43836
- removes warnings introduced in changeset 0cd3587
- makes documentation more neat and grammatically correct
2017-08-13 19:28:04 +10:00
Guillaume Gomez
a7ead41aec Rollup merge of #43833 - dtolnay:connect-timeout, r=sfackler
Fix TcpStream::connect_timeout tracking issue number

Before: https://github.com/rust-lang/rust/pull/43709
After: https://github.com/rust-lang/rust/issues/43079

r? @sfackler
2017-08-13 11:03:15 +02:00
Guillaume Gomez
09ac9fd272 Rollup merge of #43824 - kennytm:fix-43232-hir-stats, r=petrochenkov
Fix `-Z hir-stats` always panics.

Fix #43232.
2017-08-13 11:03:14 +02:00
Guillaume Gomez
31916ac398 Rollup merge of #43822 - topecongiro:missing-span-let, r=petrochenkov
Include 'let' keyword to the span for ast::Local

Currently the span for `ast::Local` does not the include the `let` keyword. This PR fixes it.
2017-08-13 11:03:13 +02:00
Guillaume Gomez
b1a742794e Rollup merge of #43821 - NilSet:redox-dns, r=alexcrichton
Handle DNS label compression in more places in Redox name resolution
2017-08-13 11:03:12 +02:00
Guillaume Gomez
a91e8a2053 Rollup merge of #43819 - frewsxcv:frewsxcv-include, r=QuietMisdreavus
Improve doc examples for `include*` macros.
2017-08-13 11:03:11 +02:00
Guillaume Gomez
bc6659a8fe Rollup merge of #43814 - Eijebong:fix_typos2, r=petrochenkov
Fix some typos

Follow up of #43794

If refined my script a little bit and found some more.
2017-08-13 11:03:11 +02:00
Guillaume Gomez
9191fe1ef4 Rollup merge of #43803 - GuillaumeGomez:missing-links-doc, r=frewsxcv
Missing links doc

r? @rust-lang/docs
2017-08-13 11:03:10 +02:00
Guillaume Gomez
7ebd81377d Rollup merge of #43782 - nrc:include, r=GuillaumeGomez
Fix include! in doc tests

By making the path relative to the current file.

Fixes #43153

[breaking-change] - if you use `include!` inside a doc test, you'll need to change the path to be relative to the current file rather than relative to the working directory.
2017-08-13 11:03:09 +02:00
bors
d4fbc7a4e7 Auto merge of #43813 - pengowen123:unused_result, r=estebank
Fix unused_result lint triggering when a function returns `()`, `!` or an empty enum

Also added a test to prevent this from happening again.

Fixes #43806
2017-08-13 07:50:36 +00:00
bors
adbce60d6f Auto merge of #43630 - Mark-Simulacrum:rustbuild-cleanups, r=alexcrichton
Rustbuild cleanups/fixes and improvements

Each commit is a standalone change, and can/should be reviewed separately.

This adds two new functionalities:

 - `--target` and `--host` can be passed without changing config.toml, and we'll respect the users' wishes, instead of requiring that all possible targets are passed.
   - Note that this means that `./x.py clean` won't be quite as wide-spread as before, since it limits itself to the configured hosts, not all hosts. This could be considered a feature as well.
 - `ignore-git` field in `config.toml` which tells Rustbuild to not attempt to load git hashes from `.git`.

This is a precursor to eventual further simplification of the configuration system, but I want to get this merged first so that later work can be made in individual PRs.

r? @alexcrichton
2017-08-13 05:24:49 +00:00
Mark Simulacrum
01641c7033 Build rustdoc with the native build triple 2017-08-13 08:58:49 +05:00
bors
0ed03e5490 Auto merge of #43348 - kennytm:fix-24658-doc-every-platform, r=alexcrichton
Expose all OS-specific modules in libstd doc.

1. Uses the special `--cfg dox` configuration passed by rustbuild when running `rustdoc`. Changes the `#[cfg(platform)]` into `#[cfg(any(dox, platform))]` so that platform-specific API are visible to rustdoc.

2. Since platform-specific implementations often won't compile correctly on other platforms, `rustdoc` is changed to apply `everybody_loops` to the functions during documentation and doc-test harness.

3. Since platform-specific code are documented on all platforms now, it could confuse users who found a useful API but is non-portable. Also, their examples will be doc-tested, so must be excluded when not testing on the native platform. An undocumented attribute `#[doc(cfg(...))]` is introduced to serve the above purposed.

Fixes #24658 (Does _not_ fully implement #1998).
2017-08-13 03:00:20 +00:00
David Tolnay
aea61e6005
Fix TcpStream::connect_timeout tracking issue number 2017-08-12 19:22:03 -07:00
Mark Simulacrum
82cdf1006e Cargotest needs only one rustdoc.exe to exist on Windows 2017-08-13 05:15:44 +05:00
Mark Simulacrum
657196830f Correct code to not run host-only tests. 2017-08-13 05:15:43 +05:00
Mark Simulacrum
cec68167fd Clean tools after building libstd/libtest/librustc.
This fixes the bug we previously had where we'd build a libtest tool
after building a libstd tool and clear out the libstd tool. Since we
clear out all tools for a given stage on invocations of CleanTools after
lib{std, test, rustc} change, we need to make sure that all tools built
with that stage will be built after the clearing is done.

The fix contained here technically isn't perfect; there is still an edge
case of compiling a libstd tool, then compiling libtest, which will
clear out the libstd tool and it won't ever get rebuilt within that
session of rustbuild. This is where the caching system used today shows
it's problems -- in effect, all tools depend on a global counter of the
stage being cleared out. We can implement such a counter in a future
patch to ensure that tools are rebuilt as needed, but it is deemed
unlikely that it will be required in practice, since most if not all
tools are built after the relevant stage's std/test/rustc are built,
though this is only an opinion and hasn't been verified.
2017-08-13 05:15:43 +05:00
Mark Simulacrum
facf5a91c4 Build rustdoc only at the top stage 2017-08-13 05:15:43 +05:00
Mark Simulacrum
ad4acbaadf Build rustdoc with the stageN compiler in N >= 2.
This permits proc macro crates to correctly work with rustdoc.
2017-08-13 05:15:43 +05:00
Mark Simulacrum
83b68125e7 Make the message for building rustdoc slightly nicer 2017-08-13 05:15:43 +05:00
Mark Simulacrum
40dea65ec2 Add ability to ignore git when building rust.
Some users of the build system change the git sha on every build due to
utilizing git to push changes to a remote server. This allows them to
simply configure that away instead of depending on custom patches to
rustbuild.
2017-08-13 05:15:43 +05:00
Mark Simulacrum
5290c6c8f1 Allow overriding build triple via flag.
We first check the configuration, then passed parameters (--build), then
fall back to the auto-detection that bootstrap.py does.

Fixes #39673.
2017-08-13 05:15:43 +05:00
Mark Simulacrum
84d9a6ee8c Allow specifiying targets and hosts not in the config file.
We no longer care about the source of this information, so there is no
reason to restrict users.
2017-08-13 05:15:43 +05:00
Mark Simulacrum
44ffb61623 Unify flags into config.
This introduces a slight change in behavior, where we unilaterally
respect the --host and --target parameters passed for all sanity
checking and runtime configuration.
2017-08-13 05:15:43 +05:00
bors
14fb329e0a Auto merge of #43736 - ollie27:rustdoc_impls_js, r=QuietMisdreavus
rustdoc: Don't add external impls to implementors js

Otherwise impls from not documented crates appear.

Fixes #43701
2017-08-12 22:09:34 +00:00
bors
f774bced50 Auto merge of #43724 - lukaramu:std-ops-docs, r=QuietMisdreavus
Improve std::ops docs

Fixes #29365. (This fixes all but one point from @steveklabnik's list, but that point was referring to examples of implementing range traits, but there are no range traits in std::ops.)

The main changes are quite a bit of copyediting, adding more "real" examples for some of the traits, incorporating some guidance from the API docs, more linking (cross-docs and to the book & reference), cleaning up examples, moving things around, and so on. Refer to the commit messages for more details.

Note: I decided to link to the second edition of the book since I think it's more appropriate now for the sections I linked, if this is not okay, please say so!
2017-08-12 19:40:49 +00:00
Alex Crichton
3a831653d0 std: Unsafe-away runtime checks in Vec
The `RawVec` type has a number of invariants that it upholds throughout its
execution, and as a result many of the runtime checks imposed by using `Layout`
in a "raw" fashion aren't actually necessary. For example a `RawVec`'s capacity
is intended to always match the layout which "fits" the allocation, so we don't
need any runtime checks when retrieving the current `Layout` for a vector.
Consequently, this adds a safe `current_layout` function which internally uses
the `from_size_align_unchecked` function.

Along the same lines we know that most construction of new layouts will not
overflow. All allocations in `RawVec` are kept below `isize::MAX` and valid
alignments are also kept low enough that we're guaranteed that `Layout` for a
doubled vector will never overflow and will always succeed construction.
Consequently a few locations can use `from_size_align_unchecked` in addition
when constructing the *new* layout to allocate (or reallocate), which allows for
eliding some more runtime checks.

Overall this should significant improve performance for an important function,
`RawVec::double`. This commit removes four runtime jumps before `__rust_realloc`
is called, as well as one after it's called.
2017-08-12 11:06:45 -07:00
lukaramu
6bdba82ba1 std::ops docs: incorporated changes suggested in review
* fixed link typos and copy-paster errors
* rewrote Fn* explanations
* `RHS = Self` -> `RHS` is `Self` (added that to all applicable places as
  well)
* fixed up some links
* s/MutDeref/DerefMut
* removed remaining superfluous `fn main()`s
* fixed some minor phrasings and factual errors and inaccuracies

std::ops docs: Fix phrasing and factual errors/inaccuracies
2017-08-12 19:53:04 +02:00
bors
0269acbb10 Auto merge of #43820 - sfackler:move-config-template, r=alexcrichton
Move config.toml.example to the root dir

It's way more discoverable here.

r? @alexcrichton
2017-08-12 16:48:31 +00:00
Guillaume Gomez
f0fb7ab0e7 Add missing link in fmt::format function 2017-08-12 16:54:12 +02:00
bors
045ca8b43b Auto merge of #43823 - tchajed:fix-pr-link, r=frewsxcv
Update GitHub pull request documentation link

It looks like the GitHub documentation has been re-organized so that the "fork and pull" model isn't explained alongside the PR process in one convenient link any more.
2017-08-12 14:24:40 +00:00
Bastien Orivel
3ab86fbab2 Fix some typos 2017-08-12 14:01:11 +02:00
bors
4564933538 Auto merge of #43746 - eddyb:sound-thread-local, r=alexcrichton
Check #[thread_local] statics correctly in the compiler.

Fixes #43733 by introducing `#[allow_internal_unsafe]` analogous to `#[allow_internal_unstable]`, for letting a macro expand to `unsafe` blocks and functions even in `#![forbid(unsafe_code)]` crates.

Fixes #17954 by not letting references to `#[thread_local]` statics escape the function they're taken in - we can't just use a magical lifetime because Rust has *lifetime parametrism*, so if we added the often-proposed `'thread` lifetime, we'd have no way to check it in generic code.
To avoid potential edge cases in the compiler, the lifetime is actually that of a temporary at the same position, i.e. `&TLS_STATIC` has the same lifetime `&non_const_fn()` would.

Referring to `#[thread_local]` `static`s at compile-time is banned now (as per PR discussion).

Additionally, to remove `unsafe impl Sync` from `std:🧵:local::fast::Key`, `#[thread_local]` statics are now not required to implement `Sync`, as they are not shared between threads.
2017-08-12 11:57:10 +00:00
kennytm
36ba8ee444
Fix -Z hir-stats always panics (fix #43232). 2017-08-12 19:53:15 +08:00
Tej Chajed
a746129bdb
Update GitHub pull request documentation link 2017-08-12 12:34:49 +01:00
Eduard-Mihai Burtescu
92892d3beb Check #[thread_local] statics correctly in the compiler. 2017-08-12 12:58:07 +03:00
bors
59f6b8338e Auto merge of #43812 - steveklabnik:rustdoc-doc-tests, r=QuietMisdreavus
rustdoc doc tests

This is mostly adapted from the book v1's chapter.

cc https://github.com/rust-lang/rust/issues/42322

r? @rust-lang/docs
2017-08-12 09:34:13 +00:00
topecongiro
64503b6ee7 Include 'let' keyword to the span for ast::Local 2017-08-12 18:00:57 +09:00
Alexey Tarasov
6a607faba4 Follow up commit for the issue 39827
- updates documentation on volatile memory intrinsics, now the case of
   zero-sized types is mentioned explicitly.

Volatile memory operations which doesn't affect memory at all are omitted
in LLVM backend, e.g. if number of elements is zero or type used in
generic specialisation is zero-sized, then LLVM intrinsic or related code
is not generated. This was not explicitly documented before in Rust
documentation and potentially could cause issues.
2017-08-12 18:51:10 +10:00
Alexey Tarasov
0cd358742d Fixes issue 39827: ICE in volatile_store intrinsic
- adds handling of zero-sized types for volatile_store.
- adds type size checks and warnigns for other volatile intrinsics.
- adds a test to check warnings emitting.

Cause of the issue

While preparing for trans_intrinsic_call() invoke arguments are
processed with trans_argument() method which excludes zero-sized types
from argument list (to be more correct - all arguments for which
ArgKind is Ignore are filtered out). As result volatile_store() intrinsic
gets one argument instead of expected address and value.

How it is fixed

Modification of the trans_argument() method may cause side effects,
therefore change was implemented in volatile_store() intrinsic building
code itself. Now it checks function signature and if it was specialised
with zero-sized type, then emits C_nil() instead of accessing
non-existing second argument.

Additionally warnings are added for all volatile operations which are
specialised with zero-sized arguments. In fact, those operations are omitted
in LLVM backend if no memory affected at all, e.g. number of elements
is zero or type is zero-sized. This was not explicitly documented before
and could lead to potential issues if developer expects volatile behaviour,
but type has degraded to zero-sized.
2017-08-12 18:42:44 +10:00
Eduard-Mihai Burtescu
8a4facc3c3 syntax: #[allow_internal_unsafe] bypasses the unsafe_code lint in macros. 2017-08-12 09:14:50 +03:00
bors
bffc973da8 Auto merge of #43794 - Eijebong:fix_typos, r=lukaramu,steveklanik,imperio
Fix some typos

I wrote a really naive script and found those typos in the documentation.
2017-08-12 05:52:19 +00:00
Steven Fackler
1126a85e87 Move config.toml.example to the root dir
It's way more discoverable here.
2017-08-11 22:24:25 -07:00
Thomas Levy
fb45233ed1 Handle DNS label compression in more places 2017-08-11 22:13:57 -07:00
Owen Sanchez
eeb748aa12 Don't trigger unused_result on functions returning empty enums 2017-08-11 22:07:28 -07:00
Corey Farwell
8d0d2a5729 Add complete doc example for include_str!. 2017-08-12 00:31:56 -04:00
Corey Farwell
446ff0d529 Add complete doc example for include_bytes!. 2017-08-12 00:31:55 -04:00