Tobias Bucher [Sun, 26 Aug 2018 19:13:44 +0000 (21:13 +0200)]
Reduce number of syscalls in `rand`
In case that it is statically known that the OS doesn't support
`getrandom` (non-Linux) or becomes clear at runtime that `getrandom`
isn't available (`ENOSYS`), the opened fd ("/dev/urandom") isn't closed
after the function, so that future calls can reuse it. This saves
repeated `open`/`close` system calls at the cost of one permanently open
fd.
Additionally, this skips the initial zero-length `getrandom` call and
directly hands the user buffer to the operating system, saving one
`getrandom` syscall.
bors [Sat, 25 Aug 2018 19:30:10 +0000 (19:30 +0000)]
Auto merge of #53701 - Xanewok:update-rls, r=kennytm
Update RLS
Continuation of https://github.com/rust-lang/rust/pull/53610.
Workspaces are tricky - the `json_internal` problem was only reproducible in Rust CI (not sure why it was only relevant to Windows?) and it seems that this was fixed by updating serde_json workspace-wide.
Tested locally in Rust repo and it seems to be working.
Nightlies are currently shipping without RLS, so it'd be great to include this in the next nightlies if possible.
Igor Matuszewski [Sat, 25 Aug 2018 16:17:55 +0000 (18:17 +0200)]
Bump serde_json 1.0.24 -> 1.0.25
This fixes 'cannot find macro `json_internal!` in this scope' RLS
compilation error in Rust CI, presumably due to a local macro fix in
serde_json 1.0.25
(https://github.com/serde-rs/json/commit/e40cbad70b39a0dd7975be8e5ad9018e2d45f791)
bors [Sat, 25 Aug 2018 13:00:20 +0000 (13:00 +0000)]
Auto merge of #53584 - mcr431:Fix-#53525, r=varkor
Fix #53525 - Unify E0243, E0244, E0087, E0088, E0089, and E0090 into E0107
Fix #53525
This pr merges all errors related to too many or too few generic arguments in types and functions. E0243, E0244, E0087, E0088, E0089, E0090 errors will no longer be emitted and E0107 will be used instead.
bors [Fri, 24 Aug 2018 22:42:00 +0000 (22:42 +0000)]
Auto merge of #53225 - nikomatsakis:nll-type-annot, r=pnkfelix
MIR: support user-given type annotations on fns, structs, and enums
This branch adds tooling to track user-given type annotations on functions, structs, and enum variant expressions. The user-given types are passed onto NLL which then enforces them.
cc #47184 — not a complete fix, as there are more cases to cover
bors [Fri, 24 Aug 2018 19:21:27 +0000 (19:21 +0000)]
Auto merge of #53460 - JoshBrudnak:master, r=estebank
Fix compile panic on non existent type return
Reverted the change https://github.com/rust-lang/rust/commit/28a76a90009d605349babcd2755962ab93913327#diff-4ed25c00aceb84666fca639cf8101c7cL1069 which was panicking when returning a type that cannot be found in the current scope and added testing for the compile error.
For example:
```rust
fn addition() -> Wrapper<impl A> {}
```
Where Wrapper is undefined in the scope.
kennytm [Fri, 24 Aug 2018 15:27:16 +0000 (23:27 +0800)]
Rollup merge of #53545 - FelixMcFelix:fix-50865-beta, r=petrochenkov
Fix #50865: ICE on impl-trait returning functions reaching private items
Adds a test case as suggested in #50865, and implements @petrochenkov's suggestion. Fixes #50865.
Impl-trait-returning functions are marked under a new (low) access level, which they propagate rather than `AccessLevels::Reachable`. `AccessLevels::is_reachable` returns false for such items (leaving stability analysis unaffected), these items may still be visible to the lints phase however.
bors [Fri, 24 Aug 2018 11:22:11 +0000 (11:22 +0000)]
Auto merge of #53653 - petrochenkov:moreregr, r=Mark-Simulacrum
Address two regressions
Remove assert checking that expansion data is immutable until I have time to investigate why it's firing, cc https://github.com/rust-lang/rust/issues/52363
Turn the error for module-relative access to macro-expanded `macro_export` macros into a deprecation lint, closes https://github.com/rust-lang/rust/issues/53495
kennytm [Fri, 24 Aug 2018 08:44:34 +0000 (16:44 +0800)]
Rollup merge of #53562 - varkor:bastion-of-the-turbofish, r=nagisa
Lament the invincibility of the Turbofish
Here a test case is added to ensure that any others attempting to drive the Turbofish to extinction have second thoughts. Previously the [entire test suite would succeed](https://github.com/rust-lang/rust/pull/53511) if generic arguments were accepted without disambiguation, making for [confusing and heartbreaking circumstances](https://github.com/rust-lang/rfcs/pull/2527).
kennytm [Fri, 24 Aug 2018 08:44:31 +0000 (16:44 +0800)]
Rollup merge of #53503 - kornelski:master, r=dtolnay
Discourage overuse of mem::forget
Some uses of `mem::forget` have been replaced by better methods of `Box`, so I've removed obsoleted use-cases from these docs.
I've removed emphasis on leaking, because it's not obvious `mem::forget` does not guarantee leaking of memory: memory of stack-allocated objects and values partially moved out of `Box` will still be freed. That's a potential error when used to pass objects to FFI, so it's better to direct users to `Box::into_raw` instead.
bors [Thu, 23 Aug 2018 11:46:24 +0000 (11:46 +0000)]
Auto merge of #52602 - scottmcm:tryblock-expr, r=nikomatsakis
Implement try block expressions
I noticed that `try` wasn't a keyword yet in Rust 2018, so...
~~Fixes https://github.com/rust-lang/rust/issues/52604~~ That was fixed by PR https://github.com/rust-lang/rust/pull/53135
cc https://github.com/rust-lang/rust/issues/31436 https://github.com/rust-lang/rust/issues/50412
Currently when a row is instantiated in SparseBitMatrix, any missing
rows prior to it are also fully instantiated.
This patch changes things so that those prior rows are minimally
instantiated (with a `None`). This avoids a decent number of allocations
in NLL, speeding up several benchmarks by up to 0.5%.
The patch also removes two unused methods, `len()` and
`iter_enumerated()`.
bors [Thu, 23 Aug 2018 08:38:22 +0000 (08:38 +0000)]
Auto merge of #53459 - petrochenkov:stabmore, r=nrc
Stabilize a few secondary macro features
- `tool_attributes` - closes https://github.com/rust-lang/rust/issues/44690
- `proc_macro_path_invoc` - this feature was created due to issues with tool attributes (https://github.com/rust-lang/rust/issues/51277), those issues are now fixed (https://github.com/rust-lang/rust/pull/52841)
- partially `proc_macro_gen` - this feature was created due to issue https://github.com/rust-lang/rust/issues/50504, the issue is now fixed (https://github.com/rust-lang/rust/pull/51952), so proc macros can generate modules. They still can't generate `macro_rules` items though due to unclear hygiene interactions.
bors [Thu, 23 Aug 2018 06:34:11 +0000 (06:34 +0000)]
Auto merge of #53235 - varkor:gat_impl_where, r=estebank
Feature gate where clauses on associated type impls
Fixes #52913. This doesn't address the core problem, which is tracked by https://github.com/rust-lang/rust/issues/47206. However, it fixes the stable-to-stable regression: you now have to enable `#![feature(generic_associated_types)]` to trigger the weird behaviour.