Tobias Bucher [Mon, 14 May 2018 11:20:39 +0000 (13:20 +0200)]
Don't unconditionally set CLOEXEC twice on every fd we open on Linux
Previously, every `open64` was accompanied by a `ioctl(…, FIOCLEX)`,
because some old Linux version would ignore the `O_CLOEXEC` flag we pass
to the `open64` function.
Now, we check whether the `CLOEXEC` flag is set on the first file we
open – if it is, we won't do extra syscalls for every opened file. If it
is not set, we fall back to the old behavior of unconditionally calling
`ioctl(…, FIOCLEX)` on newly opened files.
On old Linuxes, this amounts to one extra syscall per process, namely
the `fcntl(…, F_GETFD)` call to check the `CLOEXEC` flag.
On new Linuxes, this reduces the number of syscalls per opened file by
one, except for the first file, where it does the same number of
syscalls as before (`fcntl(…, F_GETFD)` to check the flag instead of
`ioctl(…, FIOCLEX)` to set it).
bors [Thu, 10 May 2018 16:27:32 +0000 (16:27 +0000)]
Auto merge of #49823 - Zoxc:term-str, r=alexcrichton
Remove usages of Term::as_str and mark it for removal
Returning references to rustc internal data structures is a bad idea since their lifetimes are unrelated to the lifetimes of proc_macro values.
See https://github.com/rust-lang/rust/pull/46972 and the `Taming thread-local storage` section of https://internals.rust-lang.org/t/parallelizing-rustc-using-rayon/6606
bors [Thu, 10 May 2018 14:14:35 +0000 (14:14 +0000)]
Auto merge of #50395 - Zoxc:small-tys, r=michaelwoerister
Optimize layout of TypeVariants
This makes references to `Slice` use thin pointers by storing the slice length in the slice itself. `GeneratorInterior` is replaced by storing the movability of generators in `TyGenerator` and the interior witness is stored in `GeneratorSubsts` (which is just a wrapper around `&'tcx Substs`, like `ClosureSubsts`). Finally the fields of `TypeAndMut` is stored inline in `TyRef`. These changes combine to reduce `TypeVariants` from 48 bytes to 24 bytes on x86_64.
Alex Crichton [Tue, 24 Apr 2018 15:34:14 +0000 (08:34 -0700)]
ci: Compile LLVM with Clang 6.0.0
Currently on CI we predominately compile LLVM with the default system compiler
which means gcc on Linux, some version of Clang on OSX, MSVC on Windows, and
gcc on MinGW. This commit switches Linux, OSX, and Windows to all use Clang
6.0.0 to build LLVM (aka the C/C++ compiler as part of the bootstrap). This
looks to generate faster code according to #49879 which translates to a faster
rustc (as LLVM internally is faster)
The major changes here were to the containers that build Linux releases,
basically adding a new step that uses the previous gcc 4.8 compiler to compile
the next Clang 6.0.0 compiler. Otherwise the OSX and Windows scripts have been
updated to download precompiled versions of Clang 6 and configure the build to
use them.
Note that `cc` was updated here to fix using `clang-cl` with `cc-rs` on MSVC, as
well as an update to `sccache` on Windows which was needed to correctly work
with `clang-cl`. Finally the MinGW compiler is entirely left out here
intentionally as it's currently thought that Clang can't generate C++ code for
MinGW and we need to use gcc, but this should be verified eventually.
bors [Wed, 9 May 2018 16:56:30 +0000 (16:56 +0000)]
Auto merge of #49711 - ibabushkin:auto_trait_refactor, r=nikomatsakis
Refactor auto trait handling in librustdoc to be accessible from librustc.
These commits transfer some of the functionality introduced in https://github.com/rust-lang/rust/pull/47833 to librustc with the intention of making the tools to work with auto traits accessible to third-party code, for example [rust-semverver](https://github.com/rust-lang-nursery/rust-semverver).
Some rough edges remain, and I'm certain some of the FIXMEs introduced will need some discussion, most notably the fairly ugly overall approach to pull out the core logic into librustc, which was previously fairly tightly coupled with various bits and bobs from librustdoc.
bors [Wed, 9 May 2018 13:28:15 +0000 (13:28 +0000)]
Auto merge of #50546 - kennytm:rollup, r=kennytm
Rollup of 11 pull requests
Successful merges:
- #49988 (Mention Result<!, E> in never docs.)
- #50148 (turn `ManuallyDrop::new` into a constant function)
- #50456 (Update the Cargo submodule)
- #50460 (Make `String::new()` const)
- #50464 (Remove some transmutes)
- #50505 (Added regression function match value test)
- #50511 (Add some explanations for #[must_use])
- #50525 (Optimize string handling in lit_token().)
- #50527 (Cleanup a `use` in a raw_vec test)
- #50539 (Add more logarithm constants)
- #49523 (Update RELEASES.md for 1.26.0)
kennytm [Wed, 9 May 2018 09:23:31 +0000 (17:23 +0800)]
Rollup merge of #50525 - nnethercote:lit_token, r=michaelwoerister
Optimize string handling in lit_token().
In the common case, the string value in a string literal Token is the
same as the string value in a string literal LitKind. (The exception is
when escapes or \r are involved.) This patch takes advantage of that to
avoid calling str_lit() and re-interning the string in that case. This
speeds up incremental builds for a few of the rustc-benchmarks, the best
by 3%.
In the common case, the string value in a string literal Token is the
same as the string value in a string literal LitKind. (The exception is
when escapes or \r are involved.) This patch takes advantage of that to
avoid calling str_lit() and re-interning the string in that case. This
speeds up incremental builds for a few of the rustc-benchmarks, the best
by 3%.
bors [Tue, 8 May 2018 14:45:16 +0000 (14:45 +0000)]
Auto merge of #50497 - RalfJung:pinmut, r=withoutboats
Rename Pin to PinMut, and some more breaking changes
As discussed at [1] §3 and [2] and [3], a formal look at pinning requires considering a distinguished "shared pinned" mode/typestate. Given that, it seems desirable to at least eventually actually expose that typestate as a reference type. This renames Pin to PinMut, freeing the name Pin in case we want to use it for a shared pinned reference later on.
bors [Tue, 8 May 2018 01:37:52 +0000 (01:37 +0000)]
Auto merge of #50260 - Manishearth:no-extern-crate, r=nikomatsakis
idiom lints for removing `extern crate`
Based off of https://github.com/rust-lang/rust/pull/49789
This contains two lints:
- One that suggests replacing pub extern crates with pub use, and removing non-pub extern crates entirely
- One that suggests rewriting `use modulename::...::cratename::foo` as `cratename::foo`
The latter is a bit tricky to emit suggestions for; for one this involves splicing spans (never a good idea), and it also won't be able to correctly
handle `use module::{cratename, foo}` and use-trees. I'm not sure how to proceed here. Currently it doesn't suggest anything at all.
Perhaps we can go the other way and suggest removal of all extern crates _except_ those used through modules (stash node ids somewhere) and suggest replacing those with `<visibility> use`?
bors [Mon, 7 May 2018 12:30:55 +0000 (12:30 +0000)]
Auto merge of #50487 - nikic:heap-manually-drop, r=Gankro
Use ManuallyDrop instead of Option in BinaryHeap Hole implementation
The Option is always Some until drop, where it becomes None. Make this more explicit and avoid unwraps by using ManuallyDrop.
This change should be performance-neutral as LLVM already optimizes the unwraps away in the inlined code. However I've seen this pattern copied from here to other crates where it is not optimized away, so I think it would be good to change it.
Ralf Jung [Mon, 7 May 2018 10:44:26 +0000 (12:44 +0200)]
Rename Pin to PinMut
As discussed at [1] §3 and [2] and [3], a formal look at pinning requires considering a
distinguished "shared pinned" mode/typestate. Given that, it seems desirable to
at least eventually actually expose that typestate as a reference type. This
renames Pin to PinMut, freeing the name Pin in case we want to use it for a
shared pinned reference later on.
bors [Mon, 7 May 2018 08:41:07 +0000 (08:41 +0000)]
Auto merge of #50000 - michaelwoerister:cross-lang-lto, r=alexcrichton
Add some groundwork for cross-language LTO.
Implements part of #49879:
- Adds a `-Z cross-lang-lto` flag to rustc
- Makes sure that bitcode is embedded in object files if the flag is set.
This should already allow for using cross language LTO for staticlibs (where one has to invoke the linker manually anyway). However, `rustc` will not try to enable LTO for its own linker invocations yet.
bors [Sun, 6 May 2018 22:29:01 +0000 (22:29 +0000)]
Auto merge of #50468 - nrc:test-rustfmt, r=alexcrichton
Pass a test directory to rustfmt
Another attempt to fix the rustfmt tests. `RUSTFMT_TEST_DIR` is consumed by Rustfmt in the latext commit (thus the Rustfmt update) because we need a place to create temp files that won't be read-only.
bors [Sun, 6 May 2018 17:47:30 +0000 (17:47 +0000)]
Auto merge of #50309 - samWson:issue-49938, r=eddyb
Issue 49938: Reference tagged unions discr(iminant) as tag
Here the changes reference the Tagged type _discriminant_ as _tag_ instead. This is the correct terminology when referencing how tagged unions are represented in memory.
bors [Sun, 6 May 2018 06:33:53 +0000 (06:33 +0000)]
Auto merge of #50466 - kennytm:rustbuild-stage0-lib-test, r=Mark-Simulacrum
rustbuild: Allow quick testing of libstd and libcore at stage0
This PR implemented two features:
1. Added a `--no-doc` flag to allow testing a crate *without* doc tests. In this mode, we don't need to build rustdoc, and thus we can skip building the stage2 compiler. (Ideally stage0 test should use the bootstrap rustdoc, but I don't want to mess up the core builder logic here)
2. Moved all libcore tests externally and added a tidy test to ensure we don't accidentally add `#[test]` into libcore.
After this PR, one could run `./x.py test --stage 0 --no-doc src/libstd` to test `libstd` without building the compiler, thus enables us to quickly test new library features.
bors [Sun, 6 May 2018 04:15:02 +0000 (04:15 +0000)]
Auto merge of #50453 - alexcrichton:proc-macro-not-send, r=eddyb
proc_macro: Explicitly make everything !Send/Sync
This commit adds explicit imp blocks to ensure that all publicly exported types
(except simple enums) are not `Send` nor `Sync` in the `proc_macro` crate.
Previously tagged unions' tag was refered to as a discr(iminant).
Here the changes use tag instead which is the correct terminology
when refering to the memory representation of tagged unions.
bors [Sat, 5 May 2018 18:58:17 +0000 (18:58 +0000)]
Auto merge of #50276 - Zoxc:build-cleanup, r=alexcrichton
Misc tweaks
This:
- ~~Add explicit dependencies on `getops`~~
- Fixes the libtest-json test when `RUST_BACKTRACE=1` is set
- ~~Sets `opt-level` to `3`~~
- Removes the use of `staged_api` from `rustc_plugin`
- ~~Enables the Windows Error Reporting dialog when running rustc during bootstrapping~~
- Disables Windows Error Reporting dialog when running compiletest tests
- Enables backtraces when running rustc during bootstrapping
- ~~Removes the `librustc` dependency on `libtest`~~
- Triggers JIT debugging on Windows if rustc panics during bootstrapping
Move libcore/time tests from `time.rs` to `tests/time.rs`
All other tests of libcore reside in the tests/ directory,
too. Apparently the tests of `time.rs` weren't run before, at
least not by `x.py test src/libcore`.
Niko Matsakis [Tue, 1 May 2018 14:50:05 +0000 (10:50 -0400)]
add `Locations::All` as a concept
In particular, type annotations given by the user must hold at all
points in the program. This doesn't affect current analysis but
will affect fact generation later.