Auto merge of #63561 - HeroicKatora:alloc-private-bytes, r=oli-obk
Make Allocation::bytes private
Fixes #62931.
Direct immutable access to the bytes is still possible but redirected through the new method `raw_bytes_with_undef_and_ptr`, similar to `get_bytes_with_undef_and_ptr` but without requiring an interpretation context and not doing *any* relocation or bounds checks. The `size` of the allocation is stored separately which makes access as `Size` and `usize` more ergonomic.
Auto merge of #63870 - estebank:async-fn-call, r=oli-obk
Suggest call fn ctor passed as arg to fn with type param bounds
_Reviewer note: the relevant changes are in the second commit, the first is simple and mechanical, but verbose._
When forgetting to call a fn in an argument position to an fn that has a generic bound:
```rust
async fn foo() {}
fn bar(f: impl Future<Output=()>) {}
fn main() {
bar(foo); // <- should be `bar(foo());`
}
```
suggest calling it:
```
error[E0277]: the trait bound `fn() -> impl std::future::Future {foo}: std::future::Future` is not satisfied
--> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:9:5
|
LL | fn bar(f: impl Future<Output=()>) {}
| --------------------------------- required by `bar`
...
LL | bar(foo);
| ^^^ the trait `std::future::Future` is not implemented for `fn() -> impl std::future::Future {foo}`
|
= help: it looks like you forgot to use parentheses to call the function: `foo()`
```
Auto merge of #64057 - Centril:rollup-nwtk2fb, r=Centril
Rollup of 5 pull requests
Successful merges:
- #63410 (Update BufWriter example to include call to flush())
- #64029 (Account for rounding errors when deciding the diagnostic boundaries)
- #64032 (rustdoc use -Ccodegen-units=1 by default for test compile)
- #64039 (Update sync condvar doc style)
- #64042 (Fix word repetition in str documentation)
Rollup merge of #64032 - andjo403:codegen-units, r=Mark-Simulacrum
rustdoc use -Ccodegen-units=1 by default for test compile
as the test is small we do not want split up in multiple codegen units
and also as there is multiple test running at the same time this
will reduce the number of concurrent threads
tested the test time with `./x.py test src/libcore --doc`
for my 16 core 32 thread cpu i get about 6% faster execution
and my 2 core 4 thread cpu I get about 10% faster execution
Rollup merge of #63410 - johnterickson:master, r=joshtriplett
Update BufWriter example to include call to flush()
I was playing with a writing a Huffman encoder/decoder and was getting weird corruptions and truncations. I finally realized it was was because `BufWriter` was swallowing write errors 😬. I've found Rust to generally be explicit and err on the safe side, so I definitely found this unintuitive and not "rustic".
Esteban Küber [Sat, 31 Aug 2019 02:47:21 +0000 (19:47 -0700)]
Tweak terminal width trimming
Properly account for left margin when setting terminal width through
CLI flag and don't trim code by default if we can't get the terminal's
dimensions.
Andreas Jonson [Fri, 30 Aug 2019 19:26:04 +0000 (21:26 +0200)]
rustdoc use -Ccodegen-units=1 by default for test compile
as the test is small we do not want split up in multiple codegen units
and also as there is multiple test running at the same time this
will reduce the number of concurrent threads
Oliver Scherer [Sun, 19 May 2019 18:16:04 +0000 (20:16 +0200)]
Add a "diagnostic item" scheme
This allows lints and other diagnostics to refer to items
by a unique ID instead of relying on whacky path
resolution schemes that may break when items are
relocated.
Rollup merge of #63979 - alexcrichton:remove-wasm-syscall, r=dtolnay
std: Remove the `wasm_syscall` feature
This commit removes the `wasm_syscall` feature from the
wasm32-unknown-unknown build of the standard library. This feature was
originally intended to allow an opt-in way to interact with the
operating system in a posix-like way but it was never stabilized.
Nowadays with the advent of the `wasm32-wasi` target that should
entirely replace the intentions of the `wasm_syscall` feature.
Rollup merge of #63956 - alexcrichton:fix-lto-all-cached, r=michaelwoerister
rustc: Handle modules in "fat" LTO more robustly
When performing a "fat" LTO the compiler has a whole mess of codegen
units that it links together. To do this it needs to select one module
as a "base" module and then link everything else into this module.
Previously LTO passes assume that there's at least one module in-memory
to link into, but nowadays that's not always true! With incremental
compilation modules may actually largely be cached and it may be
possible that there's no in-memory modules to work with.
This commit updates the logic of the LTO backend to handle modules a bit
more uniformly during a fat LTO. This commit immediately splits them
into two lists, one serialized and one in-memory. The in-memory list is
then searched for the largest module and failing that we simply
deserialize the first serialized module and link into that. This
refactoring avoids juggling three lists, two of which are serialized
modules and one of which is half serialized and half in-memory.
bors [Thu, 29 Aug 2019 11:20:45 +0000 (11:20 +0000)]
Auto merge of #63998 - Centril:rollup-pfuwxz3, r=Centril
Rollup of 7 pull requests
Successful merges:
- #63867 (resolve: Block expansion of a derive container until all its derives are resolved)
- #63880 (Validation: check raw wide pointer metadata)
- #63914 (ty: use Align for ReprOptions pack and align.)
- #63941 (rustbuild: allow disabling deny(warnings) for bootstrap)
- #63949 (Fix build src/libtest)
- #63984 (Update rust-installer to limit memory use)
- #63992 (Small improvement for Ord implementation of integers)
Rollup merge of #63984 - cuviper:rust-installer-mem, r=Mark-Simulacrum
Update rust-installer to limit memory use
See https://github.com/rust-lang/rust-installer/pull/98 -- on a many-core machine, the xz memory for so many threads is more than a 32-bit process can handle. The xz stream is now limited to 8 threads.
Rollup merge of #63867 - petrochenkov:dhelpers, r=matthewjasper
resolve: Block expansion of a derive container until all its derives are resolved
So, it turns out there's one more reason to block expansion of a `#[derive]` container until all the derives inside it are resolved, beside `Copy` (https://github.com/rust-lang/rust/pull/63248).
The set of derive helper attributes registered by derives in the container also has to be known before the derives themselves are expanded, otherwise it may be too late (see https://github.com/rust-lang/rust/pull/63468#issuecomment-524550872 and the `#[stable_hasher]`-related test failures in https://github.com/rust-lang/rust/pull/63468).
So, we stop our attempts to unblock the container earlier, as soon as the `Copy` status is known, and just block until all its derives are resolved.
After all the derives are resolved we immediately go and process their helper attributes in the item, without delaying it until expansion of the individual derives.
Unblocks https://github.com/rust-lang/rust/pull/63468
r? @matthewjasper (as a reviewer of https://github.com/rust-lang/rust/pull/63248)
cc @c410-f3r
bors [Thu, 29 Aug 2019 05:05:17 +0000 (05:05 +0000)]
Auto merge of #63990 - Centril:rollup-q1nt0b0, r=Centril
Rollup of 11 pull requests
Successful merges:
- #63811 (Correctly suggest adding bounds to `impl Trait` argument)
- #63933 (Resolve some small issues related to #63580)
- #63938 (or-pattern: fix typo in error message)
- #63945 (Recover `mut $pat` and other improvements)
- #63958 (const_prop: only call error_to_const_error if we are actually showing something)
- #63961 (Add Option<Span> to `require_lang_item`)
- #63963 (remove the reference to __cxa_thread_atexit_impl)
- #63965 (Prevent syntax error in LD linker version script)
- #63968 (rustc_apfloat: make the crate #![no_std] explicitly.)
- #63970 (Notify me (flip1995) when Clippy toolstate changes)
- #63980 (add missing `#[repr(C)]` on the Slices union)
Failed merges:
- #63989 (Add Yaah to clippy toolstain notification list)
Rollup merge of #63980 - DutchGhost:master, r=cramertj
add missing `#[repr(C)]` on the Slices union
Adds the `#[repr(C)]` attribute to the `Slices` union used to convert an `&str` into a `&[u8]`.
Without the attribute, the union has an unspecified layout: https://doc.rust-lang.org/reference/types/union.html, so performing the 'transmute' is unsound without the attribute (as far as I understand).
The `Repr` union, used for converting a raw ptr + len to a slice has this attribute as well:
https://github.com/rust-lang/rust/blob/master/src/libcore/ptr/mod.rs#L211-#L216
Rollup merge of #63970 - flip1995:notify_clippy, r=oli-obk
Notify me (flip1995) when Clippy toolstate changes
I want in on the fun :tada:
Also friendly ping @llogiq @mcarton: Since you two aren't _that_ active on the Clippy repo anymore, do you still want to get pinged on Clippy toolstate changes?
Rollup merge of #63965 - loganwendholt:linker-script-fix, r=michaelwoerister
Prevent syntax error in LD linker version script
As discussed in #63925, there is an edge case in which an invalid LD version script is generated when building a `cdylib` with no exported symbols. This PR makes a slight modification to the LD version script generation by first checking to see if any symbols need to be exported. If not, the `global` section of the linker script is simply omitted, and the syntax error is averted.
Rollup merge of #63945 - Centril:recover-mut-pat, r=estebank
Recover `mut $pat` and other improvements
- Recover on e.g. `mut Foo(x, y)` and suggest `Foo(mut x, mut y)`. Fixes https://github.com/rust-lang/rust/issues/63764.
- Recover on e.g. `let mut mut x;`
- Recover on e.g. `let keyword` and `let keyword(...)`.
- Cleanups in `token.rs` with `fn is_non_raw_ident_where` and friends.
This commit removes the special rustdoc handling for proc macros, as we can now
retrieve their span and attributes just like any other item.
A new command-line option is added to rustdoc: `--crate-type`. This takes the same options as rustc's `--crate-type` option. However, all values other than `proc-macro` are treated the same. This allows Rustdoc to enable 'proc macro mode' when handling a proc macro crate.
In compiletest, a new 'rustdoc-flags' option is added. This allows us to
pass in the '--proc-macro-crate' flag in the absence of Cargo.
I've opened [an additional PR to Cargo](https://github.com/rust-lang/cargo/pull/7159) to support passing in this flag.
These two PRS can be merged in any order - the Cargo changes will not
take effect until the 'cargo' submodule is updated in this repository.