Commit Graph

76116 Commits

Author SHA1 Message Date
John Kåre Alsaker
70de2e8ad6 Make Mir::predecessors thread-safe 2018-03-28 01:28:00 +02:00
John Kåre Alsaker
8fd7d49c95 Make HirMap thread-safe 2018-03-28 01:27:59 +02:00
John Kåre Alsaker
dc0fb52fcc Require lints to be Send + Sync 2018-03-28 01:27:59 +02:00
John Kåre Alsaker
5d128cdca8 Make Steal thread-safe 2018-03-28 01:27:59 +02:00
John Kåre Alsaker
962a53d474 Add try_write to RwLock 2018-03-28 01:27:59 +02:00
John Kåre Alsaker
c979189867 Make ParseSess thread-safe 2018-03-28 01:27:58 +02:00
John Kåre Alsaker
3f0cb8ccff Make SyntaxExtension thread-safe 2018-03-28 01:27:58 +02:00
John Kåre Alsaker
11ccc4cac6 Make LazyTokenStream thread-safe 2018-03-28 01:27:58 +02:00
bors
ab8b961677 Auto merge of #49379 - TimNN:rollup, r=TimNN
Rollup of 7 pull requests

- Successful merges: #48693, #48932, #49103, #49170, #49187, #49346, #49353
- Failed merges:
2018-03-26 15:48:06 +00:00
Tim Neumann
1233aa29de
Rollup merge of #49353 - chisophugis:patch-1, r=Mark-Simulacrum
Fix confusing doc for `scan`

The comment "the value passed on to the next iteration" confused me since it sounded more like what Haskell's [scanl](http://hackage.haskell.org/package/base-4.11.0.0/docs/Prelude.html#v:scanl) does where the closure's return value serves as both the "yielded value" *and* the new value of the "state".

I tried changing the example to make it clear that the closure's return value is decoupled from the state argument.
2018-03-26 15:15:01 +02:00
Tim Neumann
d601e74675
Rollup merge of #49346 - Diggsey:hashmap-get-pair, r=Mark-Simulacrum
Implement get_key_value for HashMap, BTreeMap

Fixes #43143

Follow up from #46992
2018-03-26 15:14:59 +02:00
Tim Neumann
bd3db2bf2c
Rollup merge of #49187 - alexcrichton:no-cross-docs, r=kennytm
rustbuild: Disable docs on cross-compiled builds

This commit disables building documentation on cross-compiled compilers, for
example ARM/MIPS/PowerPC/etc. Currently I believe we're not getting much use out
of these documentation artifacts and they often take 10-15 minutes total to
build as it requires building rustdoc/rustbook and then also generating all the
documentation, especially for the reference and the book itself.

In an effort to cut down on the amount of work that we're doing on dist CI
builders in light of recent timeouts this was some relatively low hanging fruit
to cut which in theory won't have much impact on the ecosystem in the hopes that
the documentation isn't used too heavily anyway.

While initial analysis in #48827 showed only shaving 5 minutes off local builds
the same 5 minute conclusion was drawn from #48826 which ended up having nearly
a half-hour impact on the bots. In that sense I'm hoping that we can land this
and test out what happens on CI to see how it affects timing.

Note that all tier 1 platforms, Windows, Mac, and Linux, will continue to
generate documentation.
2018-03-26 15:14:58 +02:00
Tim Neumann
9e4d5cf0ce
Rollup merge of #49170 - steveklabnik:gh49127, r=nagisa
Clarify AcqRel's docs

This implied things that are not true.

Fixes #49127
2018-03-26 15:14:57 +02:00
Tim Neumann
fc9dfda6ad
Rollup merge of #49103 - glandium:uninitialized, r=cramertj
Use an uninitialized buffer in GenericRadix::fmt_int, like in Display::fmt for numeric types

The code using a slice of that buffer is only ever going to use
bytes that are subsequently initialized.
2018-03-26 15:14:56 +02:00
Tim Neumann
571734fdd7
Rollup merge of #48932 - Phlosioneer:43601-document-opaque-size, r=KodrAus
Document when types have OS-dependent sizes

As per issue #43601, types that can change size depending on the
target operating system should say so in their documentation.

I used this template when adding doc comments:

```
The size of a(n) <name> struct may vary depending on the target
operating system, and may change between Rust releases.
```

For enums, I used "instance" instead of "struct".

I added documentation to these types:
```
- std::time::Instant						(contains sys::time::Instant)
- std::time::SystemTime						(contains sys::time::SystemTime)

- std::io::StdinRaw							(contains sys::stdio::Stdin)
- std::io::StdoutRaw						(contains sys::stdio::Stdout)
- std::io::Stderr							(contains sys::stdio::Stderr)

- std::net::addr::SocketAddrV4				(contains sys::net::netc::sockaddr_in)
- std::net::addr::SocketAddrV6				(contains sys::net::netc::sockaddr_in6)
- std::net::addr::SocketAddr				(contains std::net::addr::SocketAddrV4 and SocketAddrV6)
- std::net::ip::Ipv4Addr					(contains sys::net::netc::in_addr)
- std::net::ip::Ipv6Addr					(contains sys::net::netc::in6_addr)
- std::net::ip::IpAddr						(contains std::net::ip::Ipv4Addr and Ipv6Addr)
```

I also found that these types varied in size; however, I don't think they need documentation, as it's already fairly obvious that they change based on different OS's:

```
- std::fs::DirBuilder						(contains sys::fs::DirBuilder)
- std::fs::FileType							(contains sys::fs::FileType)
- std::fs::Permissions						(contains sys::fs::FilePermissions)
- std::fs::OpenOptions						(contains sys::fs::OpenOptions)
- std::fs::DirEntry							(contains sys::fs::DirEntry)
- std::fs::ReadDir							(contains sys::fs::ReadDir)
- std::fs::Metadata							(contains sys::fs::FileAttr)
- std::fs::File								(contains sys::fs::File)

- std::process::Child						(contains sys::process::Process)
- std::process::ChildStdin					(contains sys::process::AnonPipe)
- std::process::ChildStdout					(contains sys::process::AnonPipe)
- std::process::ChildStderr					(contains sys::process::AnonPipe)
- std::process::Command						(contains sys::process::Command)
- std::process::Stdio						(contains sys::process::Stdio)
- std::process::ExitStatus					(contains sys::process::ExitStatus)
- std::process::Output						(contains std::process::ExitStatus)

- std::sys_common::condvar::Condvar			(contains sys::condvar::Condvar)
- std::sys_common::mutex::Mutex				(contains sys::mutex::Mutex)
- std::sys_common::net::LookupHost			(contains sys::net::netc::addrinfo)
- std::sys_common::net::TcpStream			(contains sys::net::Socket)
- std::sys_common::net::TcpListener			(contains sys::net::Socket)
- std::sys_common::net::UdpSocket			(contains sys::net::Socket)
- std::sys_common::remutex::ReentrantMutex	(contains sys::mutex::ReentrantMutex)
- std::sys_common::rwlock::RWLock			(contains sys::rwlock::RWLock)
- std::sys_common::thread_local::Key		(contains sys::thread_local::Key)
```
Maybe we should just put a comment about the size of structs in the module-level docs for `fs`, `process`, and `sys_common`?

If anyone can think of other types that can change size, comment below. I'm also open to changing the wording.

closes #43601.
2018-03-26 15:14:54 +02:00
Tim Neumann
3d7a04610d
Rollup merge of #48693 - vorner:doc-name-resolution, r=petrochenkov
Some comments and documentation for name resolution crate

Hello

I'm trying to get a grasp of how the name resolution crate works, as part of helping with https://github.com/rust-lang-nursery/rustc-guide/issues/16. Not that I'd be succeeding much, but as I was reading the code, I started to put some notes into it, to help me understand.

I guess I didn't get very far yet, but I'd like to share what I have, in case it might be useful for someone else. I hope these are correct (even if incomplete), but I'll be glad for a fast check in case I put something misleading there.
2018-03-26 15:14:50 +02:00
bors
13a86f4d85 Auto merge of #48346 - emilio:pgo, r=alexcrichton
Add basic PGO support.

This PR adds two mutually exclusive options for profile usage and generation using LLVM's instruction profile generation (the same as clang uses), `-C pgo-use` and `-C pgo-gen`.

See each commit for details.
2018-03-26 13:00:18 +00:00
bors
5e4603f990 Auto merge of #49255 - cramertj:stable-impl-trait, r=nikomatsakis
Stabilize impl Trait

Blocked on:

- [x] https://github.com/rust-lang/rust/pull/49041 and
- [ ] completion of FCP in https://github.com/rust-lang/rust/issues/34511#issuecomment-373207183 (3 days from now).

I have not yet done any docs work for this-- I probably won't get to it until this weekend (might be a project for the flight to the all-hands).
2018-03-26 09:14:23 +00:00
Taylor Cramer
0f5b52e4a8 Stabilize conservative_impl_trait 2018-03-26 10:43:03 +02:00
Alex Crichton
bd28641344 rustbuild: Disable docs on cross-compiled builds
This commit disables building documentation on cross-compiled compilers, for
example ARM/MIPS/PowerPC/etc. Currently I believe we're not getting much use out
of these documentation artifacts and they often take 10-15 minutes total to
build as it requires building rustdoc/rustbook and then also generating all the
documentation, especially for the reference and the book itself.

In an effort to cut down on the amount of work that we're doing on dist CI
builders in light of recent timeouts this was some relatively low hanging fruit
to cut which in theory won't have much impact on the ecosystem in the hopes that
the documentation isn't used too heavily anyway.

While initial analysis in #48827 showed only shaving 5 minutes off local builds
the same 5 minute conclusion was drawn from #48826 which ended up having nearly
a half-hour impact on the bots. In that sense I'm hoping that we can land this
and test out what happens on CI to see how it affects timing.

Note that all tier 1 platforms, Windows, Mac, and Linux, will continue to
generate documentation.
2018-03-25 23:31:41 -07:00
Taylor Cramer
c393db67ba Stabilize universal_impl_trait 2018-03-26 07:39:38 +02:00
bors
184156ed97 Auto merge of #49351 - pthariensflame:patch-1, r=oli-obk
Minor message/label formatting consistency fix.

The unimplemented label for `Termination` was missing some backticks for consistency with the message.
2018-03-26 05:09:44 +00:00
bors
445fafaa4b Auto merge of #49341 - alexcrichton:more-balance, r=kennytm
appveyor: Move run-pass-fulldeps to extra builders

We've made headway towards splitting the test suite across two appveyor builders
and this moves one more tests suite between builders. The last [failed
build][fail] had its longest running test suite and I've moved that to the
secondary builder.

cc #48844

[fail]: https://ci.appveyor.com/project/rust-lang/rust/build/1.0.6782
2018-03-26 02:39:28 +00:00
bors
39ee3aaa13 Auto merge of #49297 - scottmcm:offset-from, r=dtolnay
Introduce unsafe offset_from on pointers

Adds intrinsics::exact_div to take advantage of the unsafe, which reduces the implementation from
```asm
    sub rcx, rdx
    mov rax, rcx
    sar rax, 63
    shr rax, 62
    lea rax, [rax + rcx]
    sar rax, 2
    ret
```
down to
```asm
    sub rcx, rdx
    sar rcx, 2
    mov rax, rcx
    ret
```
(for `*const i32`)

See discussion on the `offset_to` tracking issue https://github.com/rust-lang/rust/issues/41079

Some open questions
- Would you rather I split the intrinsic PR from the library PR?
- Do we even want the safe version of the API?  https://github.com/rust-lang/rust/issues/41079#issuecomment-374426786  I've added some text to its documentation that even if it's not UB, it's useless to use it between pointers into different objects.

and todos
- [x] ~~I need to make a codegen test~~ Done
- [x] ~~Can the subtraction use nsw/nuw?~~ No, it can't https://github.com/rust-lang/rust/pull/49297#discussion_r176697574
- [x] ~~Should there be `usize` variants of this, like there are now `add` and `sub` that you almost always want over `offset`?  For example, I imagine `sub_ptr` that returns `usize` and where it's UB if the distance is negative.~~ Can wait for later; C gives a signed result https://github.com/rust-lang/rust/issues/41079#issuecomment-375842235, so we might as well, and this existing to go with `offset` makes sense.
2018-03-26 00:15:34 +00:00
Diggory Blake
fbec3ec5a7 Implement get_key_value for HashMap, BTreeMap 2018-03-25 23:50:47 +01:00
bors
d3518058e2 Auto merge of #49212 - kyrias:strip-debug-no-debuginfo, r=michaelwoerister
Pass --strip-debug to GccLinker when building without debuginfo

C.f. #46034

---

This brings a hello-world built by passing rustc no command line options from 2.9M to 592K on Linux.

(This might need to special case MacOS or Windows, not sure if the linkers there support `--strip-debug`, and there is an annoying lack of dependable docs for the linkers there.)
2018-03-25 21:46:15 +00:00
Emilio Cobos Álvarez
1e1d907e6a
pgo: Blindly try to fix Windows build. 2018-03-25 23:17:47 +02:00
Steve Klabnik
23013c791c
update wording as per feedback 2018-03-25 14:19:27 +02:00
Alexander Ronald Altman
9e6991ce49 Modify tests 2018-03-25 01:29:57 -05:00
Alexander Ronald Altman
f9661126ca Minor formatting consistency fix. 2018-03-25 01:27:45 -05:00
Sean Silva
f198b0acf5
Fix confusing doc for scan
The comment "the value passed on to the next iteration" confused me since it sounded more like what Haskell's [scanl](http://hackage.haskell.org/package/base-4.11.0.0/docs/Prelude.html#v:scanl) does where the closure's return value serves as both the "yielded value" *and* the new value of the "state".

I tried changing the example to make it clear that the closure's return value is decoupled from the state argument.
2018-03-24 22:31:17 -07:00
bors
482a913fb3 Auto merge of #49315 - TheDan64:smaller_unsafe_block, r=joshtriplett
Reduce scope of unsafe block in sun_path_offset

I reduced the scope of the unsafe block to the `uninitialized` call which is the only actual unsafe bit.
2018-03-25 05:26:58 +00:00
Phlosioneer
efd04423c3 Add backticks 2018-03-24 23:41:34 -04:00
Scott McMurray
62649524b9 Fix doctest mutability copy-pasta 2018-03-24 20:41:20 -07:00
Scott McMurray
4a097ea532 Documentation and naming improvements 2018-03-24 20:37:31 -07:00
bors
e5bf0428d1 Auto merge of #49284 - alexcrichton:use-our-own-cache, r=kennytm
ci: Don't use Travis caches for docker images

This commit moves away from caching on Travis to our own caching on S3 for
caching docker layers between builds. Unfortunately the Travis caches have over
time had a few critical pain points:

* Caches are only updated for successful builds, meaning that if a build times
  out or fails in a different location the sucessfully-created docker images
  isn't always cached. While this makes sense as a general rule of caches it
  hurts our use cases.

* Caches are per-branch and builder which means that we don't have a separate
  cache on each release channel. All our merges go through the `auto` branch
  which means that they're all sharing the same cache, even those for merging to
  master/beta. This means that PRs which switch between master/beta will keep
  rebuilting and having cache misses.

* Caches have historically been invaliated somewhat regularly a little more
  aggressively than we'd want (I think).

* We don't always need to update the contents of the cache if the Docker image
  didn't change at all, and saving off the docker layers can sometimes be quite
  expensive.

For all these reasons this commit drops the usage of Travis's built-in caching
support. Instead our own caching is used by storing blobs to S3. Normally this
would be a very risky endeavour but we're basically priming a cache for a cache
(docker) so if we get this wrong the failure mode is longer builds, not stale
caches. We'll notice that pretty quickly and hopefully fix it!

The logic here is inserted directly into the `src/ci/docker/run.sh` script to
download an image based on a shasum of the `Dockerfile` and other assorted files.
This blob, if found, is loaded into docker and we record what layers were
inserted. After docker finishes the build (hopefully quickly with lots of cache
hits) we then see the sha of the final image. If it's one of the layers we
loaded then there's no need to update the cache. Otherwise we upload our layers
to the global cache, possibly overwriting what we previously just downloaded.

This is hopefully a step towards mitigating #49278 although it doesn't
completely fix it as it means we'll still probably have to retry builds that
bust the cache.
2018-03-25 02:42:58 +00:00
Scott McMurray
02b5851258 Polyfill LLVMBuildExactUDiv
It was added 32 days after LLVM 3.9 shipped.
2018-03-24 19:15:12 -07:00
Emilio Cobos Álvarez
5af2f80fdd
pgo: Move the tests to run-make-fulldeps, and make the profile file be in the tmp directory properly. 2018-03-25 03:58:26 +02:00
Emilio Cobos Álvarez
96b87296ce
Move linker code to the Linker trait instead. 2018-03-25 03:30:07 +02:00
Emilio Cobos Álvarez
e155ecdc97
try to fix the build on older LLVM versions. 2018-03-25 03:30:06 +02:00
Emilio Cobos Álvarez
4053e25bfb
librustc_trans: Mark some profiler symbols as exported to avoid LTO removing them. 2018-03-25 03:30:06 +02:00
Emilio Cobos Álvarez
8a4cebd16f
librustc_trans: Turn PGO diagnostics into warnings.
They should at least be that, they usually warn about control flow mismatches,
and or the profile being useless, which looks like at least a warning to me.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2018-03-25 03:30:06 +02:00
Emilio Cobos Álvarez
e31addf7c3
librustc_trans: Gate the preinliner with another -Z flag.
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2018-03-25 03:30:06 +02:00
Emilio Cobos Álvarez
688275a400
librustc: Convert -C pgo-gen and -C pgo-use into -Z flags.
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2018-03-25 03:30:06 +02:00
Emilio Cobos Álvarez
036e0d7943
librustc_trans: disable profiling pre-inlining.
It destroys performance actually.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2018-03-25 03:30:05 +02:00
Emilio Cobos Álvarez
a95c8c66a7
librustc_llvm: Show PGO diagnostics properly.
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2018-03-25 03:30:05 +02:00
Emilio Cobos Álvarez
aaeb40ab3b
profiler_builtins: Add missing ProfilingNameVar file to the profiler build.
Otherwise opt builds with pgo-gen fail, d'oh.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2018-03-25 03:30:05 +02:00
Emilio Cobos Álvarez
e2183d3c70
Test that pgo-gen works properly.
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2018-03-25 03:30:05 +02:00
Emilio Cobos Álvarez
9c61c7284a
rustc_trans: Fix PGO generation linking on Linux by adding the relevant linker commands.
See the linked LLVM reviews for the clang counter-parts.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2018-03-25 03:30:05 +02:00
Emilio Cobos Álvarez
99127abca8
rustc_trans: disable probestack when using pgo-gen.
Executables crash in the probestack function otherwise... I haven't debugged
much further than that.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2018-03-25 03:30:05 +02:00