bors [Thu, 20 Jun 2019 20:55:02 +0000 (20:55 +0000)]
Auto merge of #62006 - Centril:rollup-4my59er, r=Centril
Rollup of 5 pull requests
Successful merges:
- #61900 (implement Error::source for Box<T: Error>)
- #61979 (Implement Debug for PlaceBase)
- #61981 (Closures implement Copy and Clone, generators don't)
- #61996 (Add unit tests for unescaping raw (byte) strings)
- #62000 (Add test for issue-54189)
bors [Thu, 20 Jun 2019 17:57:04 +0000 (17:57 +0000)]
Auto merge of #61827 - golddranks:lldb_fix, r=nikomatsakis
Fix rust-lldb wrapper scripts.
Currently the `rust-lldb` wrapper provided by Rust project is broken. The error messages it produces on launch are as follows:
```
warning: ignoring unknown option: --one-line-before-file=command script import "/Users/kon/.rustup/toolchains/nightly-2019-05-02-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py"
warning: ignoring unknown option: --one-line-before-file=type summary add --no-value --python-function lldb_rust_formatters.print_val -x ".*" --category Rust
warning: ignoring unknown option: --one-line-before-file=type category enable Rust
(lldb) target create "target/debug/nagare"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/kon/.rustup/toolchains/nightly-2019-05-02-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/python2.7/site-packages/lldb/__init__.py", line 1481, in <module>
class SBAddress(object):
File "/Users/kon/.rustup/toolchains/nightly-2019-05-02-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/python2.7/site-packages/lldb/__init__.py", line 1647, in SBAddress
__swig_getmethods__["module"] = GetModule
NameError: name '__swig_getmethods__' is not defined
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
...etc.
```
The errors stem from two regressions: one caused by an LLVM upgrade and one caused by unintended upgrade to SWIG 4.0 (SWIG is a wrapper generator that is used to generate Python bindings for LLVM and LLDB.)
(Edit: found the exact dates) The SWIG breakage happened because of a Homebrew version upgrade on `nightly-2019-05-01-x86_64-apple-darwin` and the LLVM breakage happened on `nightly-2019-01-27-x86_64-apple-darwin` (likely to have been caused by https://github.com/rust-lang/rust/pull/57675 ).
The fix is to update the LLVM parameter syntax and to "downgrade" to SWIG 3.0.x. SWIG 3.0.x is not going to be supported by Homebrew forever, but should be good for now, until LLDB upgrades to support SWIG 4.0.0. Here's some more info about Homebrew support: https://github.com/Homebrew/homebrew-core/pull/39929 & https://github.com/Homebrew/homebrew-core/pull/40882 I'm going to send a bug & fix to LLDB about SWIG 4.0.0 to get the situation fixed in the future.
It would be good to also backport this to beta, since it's such a small change, and will fix an obvious regression.
Rollup merge of #61968 - eddyb:hir-noclone, r=petrochenkov
rustc: disallow cloning HIR nodes.
Besides being inefficient, cloning also risks creating broken HIR (without properly recreating all the IDs and whatnot, in which case you might as well reconstruct the entire node without ever `Clone`-ing anything).
We detect *some* detrimental situations (based on the occurrence of `HirId`s, I believe?), but it's better to statically disallow it, IMO.
One of the examples that is fixed by this PR is `tcx.hir().fn_decl{,_by_hir_id}`, which was cloning an entire `hir::FnDecl` *every single time it was called*.
Rollup merge of #60772 - timvermeulen:slice_iter_nth_back, r=scottmcm
Implement nth_back for slice::{Iter, IterMut}
Part of #54054.
I implemented `nth_back` as straightforwardly as I could, and then slightly changed `nth` to match `nth_back`. I believe I did so correctly, but please double-check 🙂
I also added the helper methods `zst_shrink`, `next_unchecked`, and `next_back_unchecked` to get rid of some duplicated code. These changes hopefully make this code easier to understand for new contributors like me.
I noticed the `is_empty!` and `len!` macros which sole purpose seems to be inlining, according to the comment right above them, but the `is_empty` and `len` methods are already marked with `#[inline(always)]`. Does that mean we could replace these macros with method calls, without affecting anything? I'd love to get rid of them.
bors [Thu, 20 Jun 2019 02:36:49 +0000 (02:36 +0000)]
Auto merge of #60341 - mtak-:macos-tlv-workaround, r=alexcrichton
macos tlv workaround
fixes: #60141
Includes:
* remove dead code: `requires_move_before_drop`. This hasn't been needed for a while now (oops I should have removed it in #57655)
* redox had a copy of `fast::Key` (not sure why?). That has been removed.
* Perform a `read_volatile` on OSX to reduce `tlv_get_addr` calls per `__getit` from (4-2 depending on context) to 1.
`tlv_get_addr` is relatively expensive (~1.5ns on my machine).
Previously, in contexts where `__getit` was inlined, 4 calls to `tlv_get_addr` were performed per lookup. For some reason when `__getit` is not inlined this is reduced to 2x - and performance improves to match.
After this PR, I have only ever seen 1x call to `tlv_get_addr` per `__getit`, and macos now benefits from situations where `__getit` is inlined.
I'm not sure if the `read_volatile(&&__KEY)` trick is working around an LLVM bug, or a rustc bug, or neither.
bors [Wed, 19 Jun 2019 16:37:58 +0000 (16:37 +0000)]
Auto merge of #61962 - Centril:rollup-y6sg1zw, r=Centril
Rollup of 4 pull requests
Successful merges:
- #60667 ( Add functions for building raw slices to libcore )
- #61547 (Support `cfg` and `cfg_attr` on generic parameters)
- #61861 (Update rustfmt and rls)
- #61940 (Make Place::ty iterate)
Rollup merge of #61547 - petrochenkov:cfgen, r=Centril
Support `cfg` and `cfg_attr` on generic parameters
`cfg` attributes are supported in all other positions where attributes are accepted at all.
They were previously prohibited in https://github.com/rust-lang/rust/pull/51283 because they weren't implemented correctly before that and were simply ignored.
bors [Wed, 19 Jun 2019 12:41:38 +0000 (12:41 +0000)]
Auto merge of #61172 - matthewjasper:cleanup-implied-bounds-lint, r=varkor
Improve the explicit_outlives_requirements lint
* Don't use Strings to compare parameters
* Extend the lint to lifetime bounds
* Extend the lint to enums and unions
* Use the correct span for where clauses in tuple structs
* Try to early-out where possible
* Remove unnecessary bounds in rustc crates
bors [Wed, 19 Jun 2019 09:43:58 +0000 (09:43 +0000)]
Auto merge of #58351 - oli-obk:double_check_const_eval, r=RalfJung
Refactor interning to properly mark memory as mutable or immutable
r? @RalfJung
This implementation is incomplete out of multiple reasons
* [ ] add `-Zunleash_the_miri_inside_of_you` tests
* [ ] report an error if there's an `UnsafeCell` behind a reference in a constant
* [ ] make validity checks actually test whether the mutability of their allocations match what they see in the type
bors [Wed, 19 Jun 2019 06:49:13 +0000 (06:49 +0000)]
Auto merge of #61945 - Centril:rollup-xdqo2mn, r=Centril
Rollup of 11 pull requests
Successful merges:
- #61505 (Only show methods that appear in `impl` blocks in the Implementors sections of trait doc pages)
- #61701 (move stray run-pass const tests into const/ folder)
- #61748 (Tweak transparent enums and unions diagnostic spans)
- #61802 (Make MaybeUninit #[repr(transparent)])
- #61839 (ci: Add a script for generating CPU usage graphs)
- #61842 (Remove unnecessary lift calls)
- #61843 (Turn down the myriad-closures test)
- #61896 (rustc_typeck: correctly compute `Substs` for `Res::SelfCtor`.)
- #61898 (syntax: Factor out common fields from `SyntaxExtension` variants)
- #61938 (create an issue for miri even in status test-fail)
- #61941 (Preserve generator and yield source for error messages)
Rollup merge of #61941 - cramertj:no-more-yield-errors, r=centril
Preserve generator and yield source for error messages
Previously, error messages after HIR lowering all referred
to generators and yield, regardless of whether the original
source was a generator or an async/await body. This change
tracks the kind of each generator and yield source in order
to provide appropriately tailored error messages.
Rollup merge of #61843 - alexcrichton:disable-myriad-closures, r=pietroalbini
Turn down the myriad-closures test
This tests takes nearly 5 minutes to compile on CI where the CPUs we
have aren't exactly the fastest. This test does actually require all
closures to exist to exhibit the original bug, but it seems a little
excessive to test a single bug on CI on all platforms which simply pegs
a single CPU for 5 minutes with no parallelism opportunities, so this
turns down the test to still exercise it somewhat at least.
Rollup merge of #61505 - ebarnard:doc-shrink, r=GuillaumeGomez
Only show methods that appear in `impl` blocks in the Implementors sections of trait doc pages
In the "Implementors" and "Implementations on Foreign Types" sections, only show methods that appear in the `impl` block for that type. This has the benefit of
- Reducing the size of the Iterator page, and other large trait documentation pages.
- Retaining documentation on the `impl` blocks and functions in the `impl` blocks.
- Indicating which provided methods are overridden.
- Making the documentation match the structure of the code being documented.
- Being a small change that can be easily backed out if issues arise.
A set of Rust stdlib docs build with this change are [available here](https://ebarnard.github.io/2019-06-03-rust-smaller-trait-implementers-docs/).
The size of the [`Iterator` doc page](https://ebarnard.github.io/2019-06-03-rust-smaller-trait-implementers-docs/std/iter/trait.Iterator.html) is reduced from 14.4MB (latest nightly) to 724kB.
Before:
<img width="1411" alt="Screenshot 2019-06-03 at 23 12 17" src="https://user-images.githubusercontent.com/1059683/58837971-1722a780-8655-11e9-8d81-51e48130951d.png">
After:
<img width="1428" alt="Screenshot 2019-06-03 at 16 41 27" src="https://user-images.githubusercontent.com/1059683/58814907-84ffac80-861e-11e9-8692-79be473a5299.png">
Taylor Cramer [Tue, 18 Jun 2019 21:34:51 +0000 (14:34 -0700)]
Preserve generator and yield source for error messages
Previously, error messages after HIR lowering all referred
to generators and yield, regardless of whether the original
source was a generator or an async/await body. This change
tracks the kind of each generator and yield source in order
to provide appropriately tailored error messages.
Matthew Jasper [Sat, 25 May 2019 09:28:17 +0000 (10:28 +0100)]
Improve the explicit_outlives_requirements lint
* Don't use Strings to compare parameters
* Extend the lint to lifetime bounds
* Extend the lint to enums and unions
* Use the correct span for where clauses in tuple structs
* Try to early-out where possible
bors [Tue, 18 Jun 2019 21:50:46 +0000 (21:50 +0000)]
Auto merge of #59625 - immunant:copy_variadics_typealias, r=eddyb
Refactor C FFI variadics to more closely match their C counterparts, and add Clone implementation
We had to make some changes to expose `va_copy` and `va_end` directly to users (mainly for C2Rust, but not exclusively):
- redefine the Rust variadic structures to more closely correspond to C: `VaList` now matches `va_list`, and `VaListImpl` matches `__va_list_tag`
- add `Clone` for `VaListImpl`
- add explicit `as_va_list()` conversion function from `VaListImpl` to `VaList`
- add deref coercion from `VaList` to `VaListImpl`
- add support for the `asmjs` target
All these changes were needed for use cases like:
```Rust
let mut ap2 = va_copy(ap);
vprintf(fmt, ap2);
va_end(&mut ap2);
```
bors [Tue, 18 Jun 2019 19:04:15 +0000 (19:04 +0000)]
Auto merge of #61891 - eddyb:lifetime-cleanups, r=oli-obk
rustc: remove 'x: 'y bounds (except where necessary or from comments/strings).
This PR removes all lifetime-lifetime "outlives" bounds (e.g. `'tcx: 'a`) bounds except a few necessary ones (see the `reintroduce lifetime bounds where necessary` commit).
Some of these bounds kept around otherwise-unused lifetimes (e.g. `<'a, 'tcx: 'a>` followed by uses of `'tcx` but not `'a`) - these lifetimes (i.e. `'a`) were then removed.
(maybe they should be considered unused by the lint? cc @matthewjasper @zackmdavis)