Commit Graph

74703 Commits

Author SHA1 Message Date
Guillaume Gomez
ba6a6d0f0a Fix condvar example 2018-02-15 19:00:51 +01:00
Robin Kruppe
9d493c897b [improper_ctypes] Point at definition of non-FFI-safe type if possible 2018-02-15 18:10:55 +01:00
Robin Kruppe
22a171609b [improper_ctypes] Suggest repr(transparent) for structs
The suggestion is unconditional, so following it could lead to further errors. This is already the case for the repr(C) suggestion, which makes this acceptable, though not *good*. Checking up-front whether the suggestion can help would be great but applies more broadly (and would require some refactoring to avoid duplicating the checks).
2018-02-15 18:10:54 +01:00
Robin Kruppe
9b5f47ec48 [improper_ctypes] Overhaul primary label
- Always name the non-FFI-safe
- Explain *why* the type is not FFI-safe
- Stop vaguely gesturing at structs/enums/unions if the non-FFI-safe types occured in a field.

The last part is arguably a regression, but it's minor now that the non-FFI-safe type is actually named. Removing it avoids some code duplication.
2018-02-15 18:10:54 +01:00
Robin Kruppe
ae92dfac50 [improper_ctypes] Stop complaining about repr(usize) and repr(isize) enums
This dates back to at least #26583. At the time, usize and isize were considered ffi-unsafe to nudge people away from them, but this changed in the aforementioned PR, making it inconsistent to complain about it in enum discriminants. In fact, repr(usize) is probably the best way to interface with `enum Foo : size_t { ... }`.
2018-02-15 17:47:53 +01:00
Robin Kruppe
7ac5e96f4a [improper_ctypes] Use a 'help:' line for possible fixes 2018-02-15 17:47:53 +01:00
Robin Kruppe
1f0e1a0439 Convert compile-fail/lint-ctypes.rs to ui test 2018-02-15 17:47:53 +01:00
Ross Light
e1e79d3a10 Remove "empty buffer" doc in read_until
This appears copied from fill_buf, but the above paragraph already indicates that a lack of delimiter at the end is EOF.
2018-02-15 07:32:42 -08:00
Gianni Ciccarelli
220bb22e1b add Self: Trait<..> inside the param_env of a default impl 2018-02-15 15:31:05 +00:00
Federico Poli
fe0260fbf8 mir: Gather move at SwitchInt, Assert terminators
Previously, "_1" was not marked as "definitely uninitialized" after a "switchInt(move _1)" terminator.

Related discussion: https://internals.rust-lang.org/t/why-is-2-definitely-initialized-after-switchint-move-2/6760
2018-02-15 15:18:14 +01:00
bors
1670a532dd Auto merge of #48203 - kennytm:rollup, r=kennytm
Rollup of 23 pull requests

- Successful merges: #47784, #47806, #47846, #48005, #48033, #48065, #48087, #48114, #48126, #48130, #48133, #48151, #48154, #48156, #48162, #48163, #48165, #48167, #48181, #48186, #48195, #48035, #48210
- Failed merges:
2018-02-15 13:35:20 +00:00
bors
c83fa5d91c Auto merge of #48105 - Mark-Simulacrum:exclude-paths, r=alexcrichton
Implement excluding a build-step via --exclude

First step to fixing https://github.com/rust-lang/rust/issues/47911. This doesn't change any CI configuration, but implements what I believe necessary to make that feasible in rustbuild.

In theory this should be sufficient to allow someone to open a PR against .travis.yml and appveyor.yml which splits the Windows 32-bit tests and maybe the OS X tests into multiple builders (depending on what our cost-concerns are) to reduce runtimes.

r? @alexcrichton
cc @kennytm
2018-02-15 10:32:33 +00:00
kennytm
03b089d220
Rollup merge of #48210 - jacob-hughes:clarify_sized_trait_in_api_docs, r=QuietMisdreavus
Clarified why `Sized` bound not implicit on trait's implicit `Self` type.

This part of the documentation was a little confusing to me on first read. I've added a couple lines for further explanation. Hopefully this makes things a bit clearer for new readers.
2018-02-15 14:36:48 +08:00
bobtwinkles
7062955ad9 Fix arguments specified by lxl in two-phase-bin-ops test 2018-02-15 01:25:29 -05:00
bors
90759befe0 Auto merge of #48202 - nrc:update, r=kennytm
Update RLS

Should fix the RLS test breakage.

r? @alexcrichton
2018-02-15 04:37:19 +00:00
David Wood
98904c2ecc
Normalizing associated types when checking borrows in drops. 2018-02-14 20:12:28 +00:00
Jacob Hughes
38064a9a7c Review change - Expanded on explanation. 2018-02-14 19:14:25 +00:00
Taylor Cramer
9e9c55f8fd Update E0657 stderr to match changed test 2018-02-14 10:22:12 -08:00
Niko Matsakis
552024a52e
check that types "need drop" before we access them
Also, add some comments and remove extra deref.
2018-02-14 18:17:54 +00:00
David Wood
5fd64dde21
Simplified logic and corrected shallow to deep. 2018-02-14 18:17:53 +00:00
David Wood
e7f328ea57
Handle recursive case of dropping structs with field accesses when struct has no dtor. 2018-02-14 18:17:52 +00:00
David Wood
6493ab6f2a
Fixed incorrect reporting of errors when checking borrows in drops. 2018-02-14 18:16:53 +00:00
David Wood
673d97e3ca
Added tests for #47703 2018-02-14 18:16:53 +00:00
Mark Simulacrum
45944f670b Exclude clippy lints from tidy license check 2018-02-14 09:57:21 -07:00
bors
3ec5a99aaa Auto merge of #48209 - kennytm:try-fix-48116, r=alexcrichton
Try to fix 48116 and 48192

The bug #48116 happens because of a misoptimization of the `import_path_to_string` function, where a `names` slice is empty but the `!names.is_empty()` branch is executed.

4d2d3fc5da/src/librustc_resolve/resolve_imports.rs (L1015-L1042)

Yesterday, @eddyb had locally reproduced the bug, and [came across the `position` function](https://mozilla.logbot.info/rust-infra/20180214#c14296834) where the `assume()` call is found to be suspicious. We have *not* concluded that this `assume()` causes #48116, but given [the reputation of `assume()`](https://github.com/rust-lang/rust/pull/45501#issuecomment-340159627), this seems higher relevant. Here we try to see if commenting it out can fix the errors.

Later @alexcrichton has bisected and found a potential bug [in the LLVM side](https://github.com/rust-lang/rust/issues/48116#issuecomment-365624777). We are currently testing if reverting that LLVM commit is enough to stop the bug. If true, this PR can be reverted (keep the `assume()`) and we could backport the LLVM patch instead.

(This PR also includes an earlier commit from #48127 for help debugging ICE happening in compile-fail/parse-fail tests.)

The PR also reverts #48059, which seems to cause #48192.

r? @alexcrichton
cc @eddyb, @arthurprs (#47333)
2018-02-14 16:05:19 +00:00
Alex Crichton
e0da9902a1
Revert "rustbuild: Pass ccache to build scripts"
This reverts commit 64a8730e17.
2018-02-15 00:04:18 +08:00
kennytm
ec36e7e972
Partially revert #47333.
Removed the `assume()` which we assumed is the cause of misoptimization in
issue #48116.
2018-02-15 00:04:18 +08:00
Jacob Hughes
288c0c3081 Clarified why Sized bound not implicit on trait's implicit Self type. 2018-02-14 15:50:26 +00:00
kennytm
ce89c3de76
Rollup merge of #48035 - technicalguy:Early-exit-empty-hashmap-38880, r=arthurprs
Early exit for empty HashMap (issue #38880)

Addresses issue #38880 by checking if the HashMap is empty before computing the value of the hash.

Before (integer keys)
```
running 4 tests
test empty_once ... bench:          13 ns/iter (+/- 0)
test empty_100  ... bench:       1,367 ns/iter (+/- 35)
test exist_once ... bench:          14 ns/iter (+/- 0)
test exist_100  ... bench:       1,518 ns/iter (+/- 40)
```

After
```
running 4 tests
test empty_once ... bench:           2 ns/iter (+/- 0)
test empty_100  ... bench:         221 ns/iter (+/- 0)
test exist_once ... bench:          15 ns/iter (+/- 0)
test exist_100  ... bench:       1,515 ns/iter (+/- 92)
```

When the HashMap is not empty, the performance remains the same, and when it is empty the performance is significantly improved.
2018-02-14 19:54:00 +08:00
Michael Woerister
d4b847504c incr.comp.: Store DepNode colors in a dense array instead of a hashmap. 2018-02-14 12:47:38 +01:00
kennytm
6436c44201
Rollup merge of #48195 - paoloteti:compiler-builtins-update, r=alexcrichton
Update compiler-builtins to latest master.

- Rebase compiler-rt submodule to LLVM 6
- New VFP intrinsics on ARM
- Add generic conversion from a narrower to a wider FP type (f32 to f64)
- Fixes minor issues on _subsf3, __subdf3 and __aeabi_fcmple
- Split test suite to a separate crate
2018-02-14 18:25:30 +08:00
kennytm
72ef62a816
Rollup merge of #48186 - Mark-Simulacrum:release-notes-cargo, r=alexcrichton
Add note about Cargo cwd change to release notes

r? @alexcrichton
2018-02-14 18:25:29 +08:00
kennytm
accadb2ce5
Rollup merge of #48181 - michaelwoerister:fix-incr-dir-finalization, r=nikomatsakis
incr.comp.: Run cache directory garbage collection before loading dep-graph.

Prior to this PR, the incr. comp. cache directory would only be garbage collected after the final output artifacts were generated. However, compilation often aborts earlier and in the case of the RLS, which starts lots of compilation sessions, we might fill up the cache directory with chunk sessions.

This PR makes the compiler do a garbage collection run before loading the dep-graph.

cc @nrc https://github.com/rust-lang/rust/issues/48172

r? @nikomatsakis
2018-02-14 18:25:28 +08:00
kennytm
dc9d93f220
Rollup merge of #48167 - Mark-Simulacrum:remove-allocation-codemap, r=estebank
Remove allocation from width of character function.

Locally this seems to eliminate the problem or at least resolve most of the
issue.

Fixes #48153.

r? @estebank
2018-02-14 18:25:27 +08:00
kennytm
526e9548dc
Rollup merge of #48165 - alexcrichton:update-read2, r=Mark-Simulacrum
Update compiletest's `read2` function

This was originally copied over from Cargo and Cargo has since [been
updated][update] so let's pull in the fixes here too!

[update]: https://github.com/rust-lang/cargo/pull/5030
2018-02-14 18:25:26 +08:00
kennytm
92c66b78c8
Rollup merge of #48163 - alexcrichton:persistent-linker, r=rkruppe
rustc: Persist LLVM's `Linker` in Fat LTO

This commit updates our Fat LTO logic to tweak our custom wrapper around LLVM's
"link modules" functionality. Previously whenever the
`LLVMRustLinkInExternalBitcode` function was called it would call LLVM's
`Linker::linkModules` wrapper. Internally this would crate an instance of a
`Linker` which internally creates an instance of an `IRMover`. Unfortunately for
us the creation of `IRMover` is somewhat O(n) with the input module. This means
that every time we linked a module it was O(n) with respect to the entire module
we had built up!

Now the modules we build up during LTO are quite large, so this quickly started
creating an O(n^2) problem for us! Discovered in #48025 it turns out this has
always been a problem and we just haven't noticed it. It became particularly
worse recently though due to most libraries having 16x more object files than
they previously did (1 -> 16).

This commit fixes this performance issue by preserving the `Linker` instance
across all links into the main LLVM module. This means we only create one
`IRMover` and allows LTO to progress much speedier.

From the `cargo-cache` project in #48025 a **full build** locally went from
5m15s to 2m24s. Looking at the timing logs each object file was linked in in
single-digit millisecond rather than hundreds, clearly being a nice improvement!

Closes #48025
2018-02-14 18:25:24 +08:00
kennytm
d38e11ee10
Rollup merge of #48162 - michaelwoerister:stabler-svh, r=nikomatsakis
Handle path prefix mapping in a more stable way when computing the crate hash

This hopefully fixes issue https://github.com/rust-lang/rust/issues/48019.

cc @luser @infinity0
2018-02-14 18:25:23 +08:00
kennytm
bebd2fbfc8
Rollup merge of #48156 - Centril:feature/iterator_repeat_with, r=alexcrichton
Add std/core::iter::repeat_with

Adds an iterator primitive `repeat_with` which is the "lazy" version of `repeat` but also more flexible since you can build up state with the `FnMut`. The design is mostly taken from `repeat`.

r? @rust-lang/libs
cc @withoutboats, @scottmcm
2018-02-14 18:25:22 +08:00
kennytm
dcb15269f6
Rollup merge of #48154 - estebank:issue-31481, r=nikomatsakis
Continue parsing function after finding `...` arg

When encountering a variadic argument in a function definition that
doesn't accept it, if immediately after there's a closing paren,
continue parsing as normal. Otherwise keep current behavior of emitting
error and stopping.

Fix #31481.
2018-02-14 18:25:21 +08:00
kennytm
c4b211bdba
Rollup merge of #48151 - echochamber:update_range_example, r=estebank
Update ops range example to avoid confusion between indexes and values.

Makes clearer the numbers in the range refer to indexes, not the values at those indexes.
2018-02-14 18:25:19 +08:00
kennytm
5a193668db
Rollup merge of #48133 - matthiaskrgr:endianess_to_endianness, r=oli-obk
typo: correct endianess to endianness (this also changes function names!)
2018-02-14 18:25:18 +08:00
kennytm
3bcaaf47a1
Rollup merge of #48130 - ollie27:stab, r=Mark-Simulacrum
Correct a few stability attributes

* `core_float_bits`, `duration_core`, `path_component_asref`, and `repr_align` were stabalized in 1.25.0 not 1.24.0.
* Impls for `NonNull` involving unstable things should remain unstable.
* `Duration` should remain stable since 1.3.0 so it appears correctly in the `std` docs.
* `cursor_mut_vec` is an impl on only stable things so should be marked stable.
2018-02-14 18:25:16 +08:00
kennytm
83bed7d3a7
Rollup merge of #48126 - newpavlov:patch-1, r=alexcrichton
Whitelist pclmulqdq x86 feature flag

Relevant `stdsimd` [issue](https://github.com/rust-lang-nursery/stdsimd/issues/318).
2018-02-14 18:25:14 +08:00
kennytm
c02c5f4b60
Rollup merge of #48114 - kennytm:xcode9, r=alexcrichton
Upgrade the Travis CI macOS images for testing from Xcode 8.3 to 9.2.

Retry of #47749, since LLVM 6 has been merged.
2018-02-14 18:25:12 +08:00
kennytm
bd3674e4de
Rollup merge of #48087 - scottmcm:range_is_empty, r=kennytm,alexcrichton
Add Range[Inclusive]::is_empty

During https://github.com/rust-lang/rfcs/pull/1980, it was discussed that figuring out whether a range is empty was subtle, and thus there should be a clear and obvious way to do it.  It can't just be ExactSizeIterator::is_empty (also unstable) because not all ranges are ExactSize -- such as `Range<i64>` and `RangeInclusive<usize>`.

Things to ponder:
- Unless this is stabilized first, this makes stabilizing ExactSizeIterator::is_empty more icky, since this hides that.
- This is only on `Range` and `RangeInclusive`, as those are the only ones where it's interesting.  But one could argue that it should be on more for consistency, or on RangeArgument instead.
- The bound on this is PartialOrd, since that works ok (see tests for float examples) and is consistent with `contains`.  But ranges like `NAN..=NAN`_are_ kinda weird.
- [x] ~~There's not a real issue number on this yet~~
2018-02-14 16:14:33 +08:00
kennytm
3715f1e490
Rollup merge of #48065 - Xaeroxe:patch-1, r=alexcrichton
Apply optimization from #44355 to retain

As discussed in #44355 this PR applies a similar optimization to `Vec::retain`.  For `drain_filter`, a very similar function, this improved performance by up to 20%.
2018-02-14 16:14:32 +08:00
kennytm
a5c3209374
Rollup merge of #48033 - GuillaumeGomez:better-char-cast-message, r=estebank
Show better warning for trying to cast non-u8 scalar to char

Fixes #44201.
2018-02-14 16:14:31 +08:00
kennytm
c88a6fe569
Rollup merge of #48005 - panicbit:env_unimpl_send_sync, r=alexcrichton
Unimplement Send/Sync for ::env::{Args,ArgsOs,Vars,VarsOs}

Fixes #48004
2018-02-14 16:14:30 +08:00
kennytm
2be44ceaa2
Rollup merge of #47846 - roblabla:bugfix-ocaml, r=kennytm
Work around LLVM OCAML binding installation failure

Hello,

I have OCaml installed on my machine, and compiling rust systematically fails when LLVM attempts installing the OCaml bindings in `/usr/lib/ocaml`, which is write-protected. Here are the logs: https://gist.github.com/roblabla/3f147914c5df627c9d97ab311ba133ad

Some digging around the issue reveals:

- The code that finds if OCaml is installed, and sets the bindings to be compiled/installed: b24a45d2e9/cmake/config-ix.cmake (L612)
- b24a45d2e9/bindings/ocaml/llvm/CMakeLists.txt Some code that does the installation.

The problem seems to be that `LLVM_OCAML_INSTALL_PATH` is set to `OCAML_STDLIB_PATH` by default, which is in `/usr/lib/ocaml`, instead of the prefix.

This PR "fixes" the issue by setting `LLVM_OCAML_INSTALL_PATH` to `usr/lib/ocaml`. I haven't found a way to make LLVM not build OCaml, which would probably be a superior fix.
2018-02-14 16:14:29 +08:00
kennytm
c89976e556
Rollup merge of #47806 - PramodBisht:feature/47801, r=steveklabnik
Changed color of struct link from #ff794d to #2dbfb8 for Rust docs

This is in reference to https://github.com/rust-lang/rust/issues/47801

here I have changed the default color of struct link for `#ff794d` to `#2dbfb8`

cc: @nagisa  @timClicks
2018-02-14 16:14:28 +08:00