kennytm [Fri, 7 Dec 2018 04:42:36 +0000 (12:42 +0800)]
Rollup merge of #56574 - cbarrick:master, r=varkor
Fix a stutter in the docs for slice::exact_chunks
Before this change, the docs for `slice::exact_chunks` reads like this:
> See `chunks` for a variant of this iterator that also returns the remainder as a smaller chunk, and `rchunks_exact` for the same iterator but starting at the end of the slice of the slice.
Notice that stutter at the end? This commit fixes it.
kennytm [Fri, 7 Dec 2018 04:42:34 +0000 (12:42 +0800)]
Rollup merge of #56555 - Mark-Simulacrum:stderr-profile, r=wesleywiser
Send textual profile data to stderr, not stdout
This makes it possible to run with RUSTFLAGS="-Zself-profile" without
having to redirect compiler output; otherwise Cargo will error out due
to non-empty compiler stdout.
kennytm [Fri, 7 Dec 2018 04:42:29 +0000 (12:42 +0800)]
Rollup merge of #56000 - hug-dev:armv8m.main, r=alexcrichton
Add Armv8-M Mainline targets
This commit enables the Armv8-M Mainline architecture profile.
It adds two targets:
- `thumbv8m.main-none-eabi`
- `thumbv8m.main-none-eabihf`
The second one uses the Floating Point Unit for floating point
operations. It mainly targets the Cortex-M33 processor, which
can have the optional Floating Point Unit extension.
It follows #55041 which does it for Baseline. I will rebase this branch on top of it when it is merged to not create conflicts as we have some files in common. To make it work, it still relies on the Cargo change to be merged (accepting "." in target names, rust-lang/cargo#6255).
The goal would also be to add this target in the CI so that the `core` library is available for everybody. To do this, some changes will be needed to compile successfully the needed libraries:
* `cc-rs` needs to be updated to allow compiling C code for Armv8-M architectures profiles. It is only a few lines to add [here](https://github.com/alexcrichton/cc-rs/blob/a76611ad9836fa8c44fa8220a1d2a96dd3b7d4b6/src/lib.rs#L1299).
* Some assembly files in `builtins` in `compiler-rt` were not assembling for Armv8-M Mainline. I sent changes [upstream](https://reviews.llvm.org/D51854) to that project to fix that. The Rust version of `compiler-rt` will have to be updated to contain [that commit](https://github.com/llvm-mirror/compiler-rt/commit/a34cdf8bb498dc2f5dd415542f8e83261d2eeb88).
I tested it using the [Musca-A Test Chip board](https://developer.arm.com/products/system-design/development-boards/iot-test-chips-and-boards/musca-a-test-chip-board) but more intensively on the [Armv8-M FVP](https://developer.arm.com/products/system-design/fixed-virtual-platforms) (emulation platform). I am going to try to release my test code soon, once I tidy it up :+1:
bors [Fri, 7 Dec 2018 00:48:00 +0000 (00:48 +0000)]
Auto merge of #54271 - petrochenkov:nolegder, r=eddyb,alexcrichton
Unsupport `#[derive(Trait)]` sugar for `#[derive_Trait]` legacy plugin attributes
This is a long deprecated unstable feature that doesn't mesh well with regular resolution/expansion.
How to fix broken code:
- The recommended way is to migrate to stable procedural macros - derives or attributes (https://doc.rust-lang.org/nightly/book/first-edition/procedural-macros.html).
- If that's not possible right now for some reason, you can keep code working with a simple mechanical replacement `#[derive(Legacy)]` -> `#[derive_Legacy]`.
bors [Thu, 6 Dec 2018 22:23:24 +0000 (22:23 +0000)]
Auto merge of #55318 - Aaron1011:fix/final-auto-trait-resolve, r=nikomatsakis
Ensure that Rustdoc discovers all necessary auto trait bounds
Fixes #50159
This commit makes several improvements to AutoTraitFinder:
* Call infcx.resolve_type_vars_if_possible before processing new
predicates. This ensures that we eliminate inference variables wherever
possible.
* Process all nested obligations we get from a vtable, not just ones
with depth=1.
* The 'depth=1' check was a hack to work around issues processing
certain predicates. The other changes in this commit allow us to
properly process all predicates that we encounter, so the check is no
longer necessary,
* Ensure that we only display predicates *without* inference variables
to the user, and only attempt to unify predicates that *have* an
inference variable as their type.
Additionally, the internal helper method is_of_param now operates
directly on a type, rather than taking a Substs. This allows us to use
the 'self_ty' method, rather than directly dealing with Substs.
Changes:
````
Remove -preview suffix from README
rustup clippy build with latest rustc (breakage due to https://github.com/rust-lang/rust/commit/08f8faedd0e30f45762afbb8d4873f7041e7462c )
Forgot to remove some debugging code ...
Improved code noted by clippy.
Fix bug in `implicit_return`. Bug was already covered by test, but test was not checked for.
fix #3482 and add ui test for it
Don't change current working directory of cargo tests
Use cargo's "PROFILE" envvar and set CLIPPY_DOGFOOD
Use dogfood_runner for deterministic test ordering
Remove unnecessary documentation
Fix dogfood tests.
Added additional reasoning to `Why is this bad?`. Added comment to explain usage of MIR.
Renamed to `implicit_return`. Covered all other kinds besides `ExprKind::Lit`. Added check for replacing `break` with `return`.
Appeasing the Test Gods. Seems I'm not smart enough to run the tests locally before committing.
Renamed `forced_return` to `missing_returns`. Better clarification in the docs. Ran `update_lints`.
Added `FORCED_RETURN` lint.
````
r? @oli-obk
bors [Thu, 6 Dec 2018 17:31:15 +0000 (17:31 +0000)]
Auto merge of #56282 - qnighy:additional-sizedness-fix, r=nikomatsakis
Fix #56237: normalize type before deferred sizedness checking.
This seems to fix #56237, which was introduced by #56045. I don't thoroughly understand how this works, but the problem seemed to be a lack of normalization.
Changes:
````
Remove -preview suffix from README
rustup clippy build with latest rustc (breakage due to https://github.com/rust-lang/rust/commit/08f8faedd0e30f45762afbb8d4873f7041e7462c )
Forgot to remove some debugging code ...
Improved code noted by clippy.
Fix bug in `implicit_return`. Bug was already covered by test, but test was not checked for.
fix #3482 and add ui test for it
Don't change current working directory of cargo tests
Use cargo's "PROFILE" envvar and set CLIPPY_DOGFOOD
Use dogfood_runner for deterministic test ordering
Remove unnecessary documentation
Fix dogfood tests.
Added additional reasoning to `Why is this bad?`. Added comment to explain usage of MIR.
Renamed to `implicit_return`. Covered all other kinds besides `ExprKind::Lit`. Added check for replacing `break` with `return`.
Appeasing the Test Gods. Seems I'm not smart enough to run the tests locally before committing.
Renamed `forced_return` to `missing_returns`. Better clarification in the docs. Ran `update_lints`.
Added `FORCED_RETURN` lint.
````
bors [Thu, 6 Dec 2018 15:08:11 +0000 (15:08 +0000)]
Auto merge of #56392 - petrochenkov:regensym, r=oli-obk
Delay gensym creation for "underscore items" (`use foo as _`/`const _`) until name resolution
So they cannot be cloned by macros. See https://github.com/rust-lang/rust/pull/56303 for the discussion.
Mostly fix cross-crate use of underscore items by inverting the "gensyms are lost in metadata" bug as described in https://github.com/rust-lang/rust/pull/56303#issuecomment-442464695.
Fix unused import warnings for single-segment imports (first commit) and `use crate_name as _` imports (as specified in https://github.com/rust-lang/rust/pull/56303#issuecomment-442274118).
Prohibit accidentally implemented `static _: TYPE = EXPR;` (cc https://github.com/rust-lang/rust/pull/55983).
Add more tests for `use foo as _` imports.
Pietro Albini [Thu, 6 Dec 2018 06:49:01 +0000 (07:49 +0100)]
Rollup merge of #56548 - Lucretiel:string-extend-optimize, r=sfackler
Optimized string FromIterator + Extend impls
I noticed that there was a lost opportunity to reuse string buffers in `FromIterator<String>` and `FromIterator<Cow<str>>`; updated the implementations to use these. In practice this translates to at least one fewer allocation when using these APIs.
Additionally, rewrote `Extend` implementations to use `iter.for_each`, which (supposedly) helps the compiler optimize those loops (because iterator adapters are encouraged to provide optimized implementations of `fold` and `try_fold`.
Pietro Albini [Thu, 6 Dec 2018 06:48:55 +0000 (07:48 +0100)]
Rollup merge of #56441 - ollie27:rustbuild_compiler_docs, r=alexcrichton
rustbuild: Fix issues with compiler docs
* Create output directories for crates beforehand so rustdoc uses relative links (fixes #56107)
* Readd rustc_codegen_ssa (fixes #56196)
* Don't build out of tree dependencies for rustdoc like we don't for rustc
Pietro Albini [Thu, 6 Dec 2018 06:48:52 +0000 (07:48 +0100)]
Rollup merge of #56362 - varkor:stabilise-exhaustive-integer-patterns, r=nikomatsakis
Stabilise exhaustive integer patterns
This is dependent on the FCP for https://github.com/rust-lang/rfcs/pull/2591 being completed, but that should happen tomorrow, so there's little harm in opening this PR early.
Mark Rousskov [Thu, 6 Dec 2018 04:48:25 +0000 (21:48 -0700)]
Send textual profile data to stderr, not stdout
This makes it possible to run with RUSTFLAGS="-Zself-profile" without
having to redirect compiler output; otherwise Cargo will error out due
to non-empty compiler stdout.
bors [Thu, 6 Dec 2018 01:36:51 +0000 (01:36 +0000)]
Auto merge of #54517 - mcr431:53956-panic-on-include_bytes-of-own-file, r=michaelwoerister
53956 panic on include bytes of own file
fix #53956
When using `include_bytes!` on a source file in the project, compiler would panic on subsequent compilations because `expand_include_bytes` would overwrite files in the source_map with no source. This PR changes `expand_include_bytes` to check source_map and use the already existing src, if any.
Pietro Albini [Wed, 5 Dec 2018 22:54:38 +0000 (23:54 +0100)]
Rollup merge of #56523 - JohnHeitmann:es6, r=GuillaumeGomez
Added a bare-bones eslint config (removing jslint)
This change removes the small bit of jslint config, replacing it
with eslint. I've currently configured eslint to mostly only report
the more serious of lints, although there are still some style nits
turned on.
Eslint better supports modern js, and will be a good pre-TypeScript code
quality aid.
Install eslint with `npm install -g eslint`. Run with `eslint html/static/*.js`,
or let your IDE do it. This requires no build step.
Upcoming changes will start fixing identified bugs and other lints (mostly unused and var redef issues).
Pietro Albini [Wed, 5 Dec 2018 22:54:21 +0000 (23:54 +0100)]
Rollup merge of #51753 - gruberb:document-from-conversions-libstdpath, r=QuietMisdreavus
Document `From` implementations
This PR is solves part of https://github.com/rust-lang/rust/issues/51430. It's my first PR, so I might need some guidance from @skade (as already mentioned in the issue).
The purpose of the PR is to document the `impl From` inside `path.rs` and answering the questions:
- What does it convert?
- Does it allocate memory?
- How expensive are the allocations?
I gave it a first shot, though an experienced rust developer might want to look over it.
bors [Wed, 5 Dec 2018 20:27:17 +0000 (20:27 +0000)]
Auto merge of #55933 - euclio:doc-panic, r=QuietMisdreavus
emit error when doc generation fails
Fixes #41813.
The diagnostic looks something like this:
```
error: couldn't generate documentation: No space left on device (os error 28)
|
= note: failed to create or modify "/path/to/crate/target/doc/src/lazycell"
```
Changes:
````
Fix ty::TyKind usage
Fix TyKind::<kind> usage in codebase
Extract single_match_else UI test
cargo fmt
Adds inequality cases to bool comparison lint
Remove unsafe_vector_initialization lint
Fix wildcard_dependencies false positive
Fix rustfmt format
Disable incremental build for windows
Travis: Add rustc sysroot bin to PATH for windows build
Fix some nursery links
Enforce LF lineendings for everything
Mention triage procedure in contributing.md
Keep testing large_digit_groups as ui test
Keep testing unsafe_vector_initialization as ui test
Downgrade large_digit_groups to pedantic
Downgrade unsafe_vector_initialization to restriction
remove macro_at_most_once_rep feature attribute since it's stable
Add missing word
Update docs in regards to the merged RFC
Document how to run rustfmt in CONTRIBUTING.md
Don't run integration tests in forks
Fix some formatting issues
Run rustfmt on clippy_lints
Run rustfmt on build.rs
Run rustfmt on clippy_dev
Run rustfmt on rustc_tools_util
Run rustfmt on src
Run rustfmt on the tests
Let travis run cargo fmt --all -- --check
Error on line overflow
````
No need to increase priority, please just rollup :)
Changes:
````
Fix ty::TyKind usage
Fix TyKind::<kind> usage in codebase
Extract single_match_else UI test
cargo fmt
Adds inequality cases to bool comparison lint
Remove unsafe_vector_initialization lint
Fix wildcard_dependencies false positive
Fix rustfmt format
Disable incremental build for windows
Travis: Add rustc sysroot bin to PATH for windows build
Fix some nursery links
Enforce LF lineendings for everything
Mention triage procedure in contributing.md
Keep testing large_digit_groups as ui test
Keep testing unsafe_vector_initialization as ui test
Downgrade large_digit_groups to pedantic
Downgrade unsafe_vector_initialization to restriction
remove macro_at_most_once_rep feature attribute since it's stable
Add missing word
Update docs in regards to the merged RFC
Document how to run rustfmt in CONTRIBUTING.md
Don't run integration tests in forks
Fix some formatting issues
Run rustfmt on clippy_lints
Run rustfmt on build.rs
Run rustfmt on clippy_dev
Run rustfmt on rustc_tools_util
Run rustfmt on src
Run rustfmt on the tests
Let travis run cargo fmt --all -- --check
Error on line overflow
````
John Heitmann [Tue, 4 Dec 2018 21:59:27 +0000 (13:59 -0800)]
Added a bare-bones eslint config (removing jslint)
This change removes the small bit of jslint config, replacing it
with eslint. I've currently configured eslint to mostly only report
the more serious of lints, although there are still some style nits
turned on.
Nikita Popov [Mon, 3 Dec 2018 16:13:01 +0000 (17:13 +0100)]
Refactor LTO type determination
Instead of only determining whether some form of LTO is necessary,
determine whether thin, fat or no LTO is necessary. I've rewritten
the conditions in a way that I think is more obvious, i.e. specified
LTO type + additional preconditions.
Hugues de Valon [Tue, 13 Nov 2018 15:00:51 +0000 (15:00 +0000)]
Add Armv8-M Mainline targets
This commit enables the Armv8-M Mainline architecture profile.
It adds two targets:
- thumbv8m.main-none-eabi
- thumbv8m.main-none-eabihf
The second one uses the Floating Point Unit for floating point
operations. It mainly targets the Cortex-M33 processor, which
can have the optional Floating Point Unit extension.
bors [Tue, 4 Dec 2018 11:47:07 +0000 (11:47 +0000)]
Auto merge of #55871 - ljedrz:llvm_back_allocations, r=nagisa
codegen_llvm_back: improve allocations
This commit was split out from https://github.com/rust-lang/rust/pull/54864. Last time it was causing an LLVM OOM, which was most probably caused by not collecting the globals.
- preallocate vectors of known length
- `extend` instead of `append` where the argument is consumable
- turn 2 `push` loops into `extend`s
- create a vector from a function producing one instead of using `extend_from_slice` on it
- consume `modules` when no longer needed
- ~~return an `impl Iterator` from `generate_lto_work`~~
- ~~don't `collect` `globals`, as they are iterated over and consumed right afterwards~~
While I'm hoping it won't cause an OOM anymore, I would still consider this a "high-risk" PR and not roll it up.