Rollup merge of #65193 - Mark-Simulacrum:lockless-lintstore, r=nikomatsakis
Lockless LintStore
This removes mutability from the lint store after registration. Each commit stands alone, for the most part, though they don't make sense out of sequence.
The intent here is to move LintStore to a more parallel-friendly architecture, although also just a cleaner one from an implementation perspective. Specifically, this has the following changes:
* We no longer implicitly register lints when registering lint passes
* For the most part this means that registration calls now likely want to call something like:
`lint_store.register_lints(&Pass::get_lints())` as well as `register_*_pass`.
* In theory this is a simplification as it's much easier for folks to just register lints and then have passes that implement whichever lint however they want, rather than necessarily tying passes to lints.
* Lint passes still have a list of associated lints, but a followup PR could plausibly change that
* This list must be known for a given pass type, not instance, i.e., `fn get_lints()` is the signature instead of `fn get_lints(&self)` as before.
* We do not store pass objects, instead storing constructor functions. This means we always get new passes when running lints (this happens approximately once though for a given compiler session, so no behavior change is expected).
* Registration API is _much_ simpler: generally all functions are just taking `Fn() -> PassObject` rather than several different `bool`s.
bors [Wed, 23 Oct 2019 09:53:32 +0000 (09:53 +0000)]
Auto merge of #65716 - JohnTitor:rollup-fkcr85k, r=JohnTitor
Rollup of 14 pull requests
Successful merges:
- #64145 (Target-feature documented as unsafe)
- #65007 (Mention keyword closing policy)
- #65417 (Add more coherence tests)
- #65507 (Fix test style in unused parentheses lint test)
- #65591 (Add long error explanation for E0588)
- #65617 (Fix WASI sleep impl)
- #65656 (Add option to disable keyboard shortcuts in docs)
- #65678 (Add long error explanation for E0728)
- #65681 (Code cleanups following up on #65576.)
- #65686 (refactor and move `maybe_append` )
- #65688 (Add some tests for fixed ICEs)
- #65689 (bring back some Debug instances for Miri)
- #65695 (self-profiling: Remove module names from some event-ids in codegen backend.)
- #65706 (Add missing space in librustdoc)
Yuki Okushi [Wed, 23 Oct 2019 08:14:46 +0000 (17:14 +0900)]
Rollup merge of #65695 - michaelwoerister:fix-self-profiling-work-item-event-names, r=wesleywiser
self-profiling: Remove module names from some event-ids in codegen backend.
Event-IDs are not supposed to contain argument values. Event-IDs are the equivalent of function names. Proper support for parameters will be added to self-profiling down the line.
This PR fixes an oversight from https://github.com/rust-lang/rust/pull/64840.
Yuki Okushi [Wed, 23 Oct 2019 08:14:33 +0000 (17:14 +0900)]
Rollup merge of #65507 - polyedre:master, r=nikomatsakis
Fix test style in unused parentheses lint test
I think this fixes #63237
I'm not sure if I had to add text after the `//~ ERROR` comments.
This is my first pull request, so I'm open to feedback.
This issues already received one pull request [here](https://github.com/rust-lang/rust/pull/63257) but it was marked as closed for inactivity.
Yuki Okushi [Wed, 23 Oct 2019 08:14:31 +0000 (17:14 +0900)]
Rollup merge of #65417 - weiznich:more_coherence_tests, r=nikomatsakis
Add more coherence tests
I've wrote the missing test cases listed in [this google doc](https://docs.google.com/spreadsheets/d/1WlroTEXE6qxxGvEOhICkUpqguYZP9YOZEvnmEtSNtM0/edit#gid=0)
> The other thing that might be useful is to rename the existing tests so they all fit the new naming scheme we were using.
I'm not entirely sure how to do this. If everything from the google sheet is covered could I just remove the remaining tests in `src/test/ui/coherence` or is there something in there that should remain?
> Also in the referenced issue, the commit number of the new commit
> that could close that issue is not really informative. The PR number itself appeared in the issue
> is more informative and concise.
@lzutao what do you mean with that? Is this fixed by the new "May be fixed by #XXXXX"?
Yuki Okushi [Wed, 23 Oct 2019 08:14:27 +0000 (17:14 +0900)]
Rollup merge of #64145 - togiberlin:feature/target-features-doc, r=ehuss
Target-feature documented as unsafe
@nikomatsakis asked me to help out on the docs on this issue: https://github.com/rust-lang/rust/issues/63597
The following docs have been modified
- ```rustc -C help``` text for `target-feature`
- RustC book:
## Preview of src/doc/rustc/src/targets/index.md
![Screenshot 2019-09-17 at 12 22 45](https://user-images.githubusercontent.com/13764830/65033746-f7826700-d945-11e9-9dd2-d8f9b08f45de.png)
## Preview of src/doc/rustc/src/targets/known-issues.md
![Screenshot 2019-09-17 at 12 22 25](https://user-images.githubusercontent.com/13764830/65033774-00733880-d946-11e9-9398-90f01f3938d5.png)
bors [Tue, 22 Oct 2019 12:01:41 +0000 (12:01 +0000)]
Auto merge of #65503 - popzxc:refactor-libtest, r=wesleywiser
Refactor libtest
## Short overview
`libtest` got refactored and splitted into smaller modules
## Description
`libtest` module is already pretty big and hard to understand. Everything is mixed up: CLI, console output, test execution, etc.
This PR splits `libtest` into smaller logically-consistent modules, makes big functions smaller and more readable, and adds more comments, so `libtest` will be easier to understand and maintain.
Although there are a lot of changes, all the refactoring is "soft", meaning that no public interfaces were affected and nothing should be broken.
Thus this PR (at least should be) completely backward-compatible.
bors [Tue, 22 Oct 2019 04:09:28 +0000 (04:09 +0000)]
Auto merge of #65501 - alexcrichton:remove-emscripten-backend, r=Mark-Simulacrum
Remove `src/llvm-emscripten` submodule
With #65251 landed there's no need to build two LLVM backends and ship
them with rustc, every target we have now uses the same LLVM backend!
This removes the `src/llvm-emscripten` submodule and additionally
removes all support from rustbuild for building the emscripten LLVM
backend. Multiple codegen backend support is left in place for now, and
this is intended to be an easy 10-15 minute win on CI times by avoiding
having to build LLVM twice.
bors [Tue, 22 Oct 2019 00:20:12 +0000 (00:20 +0000)]
Auto merge of #65671 - Centril:rollup-00glhmb, r=Centril
Rollup of 7 pull requests
Successful merges:
- #62330 (Change untagged_unions to not allow union fields with drop)
- #65092 (make is_power_of_two a const function)
- #65621 (miri: add write_bytes method to Memory doing bounds-checks and supporting iterators)
- #65647 (Remove unnecessary trait bounds and derivations)
- #65653 (keep the root dir clean from debugging)
- #65660 (Rename `ConstValue::Infer(InferConst::Canonical(..))` to `ConstValue::Bound(..)`)
- #65663 (Fix typo from #65214)
Alex Crichton [Thu, 17 Oct 2019 14:04:39 +0000 (07:04 -0700)]
Remove `src/llvm-emscripten` submodule
With #65251 landed there's no need to build two LLVM backends and ship
them with rustc, every target we have now uses the same LLVM backend!
This removes the `src/llvm-emscripten` submodule and additionally
removes all support from rustbuild for building the emscripten LLVM
backend. Multiple codegen backend support is left in place for now, and
this is intended to be an easy 10-15 minute win on CI times by avoiding
having to build LLVM twice.
Rollup merge of #65653 - RalfJung:gitignore, r=Mark-Simulacrum,Centril
keep the root dir clean from debugging
We landed this before with https://github.com/rust-lang/rust/pull/63307 but recently in https://github.com/rust-lang/rust/pull/65630 the IMO bad ignore crept back in.
If you regularly do graphviz-based debugging and you are fine leaving junk in the rustc root dir, please configure your local `.git/info/exclude`. But most people working on rustc don't work with graphciz all that often (I for once never did), and not everyone likes to have stray generated files in their source dirs.
Also Cc https://github.com/rust-lang/rust/pull/63373 https://github.com/rust-lang/rust/pull/53768 @ecstatic-morse @Mark-Simulacrum
Rollup merge of #65092 - tspiteri:const-is-pow2, r=oli-obk
make is_power_of_two a const function
This makes `is_power_of_two` a const function by using `&` instead of short-circuiting `&&`; Rust supports bitwise `&` for `bool` and short-circuiting is not required in the existing expression.
I don't think this needs a const-hack label as I don't find the changed code less readable, if anything I prefer that it is clearer that short circuiting is not used.
Rollup merge of #62330 - SimonSapin:no-drop-in-union-fields, r=RalfJung
Change untagged_unions to not allow union fields with drop
This is a rebase of #56440, massaged to solve merge conflicts and make the test suite pass.
Change untagged_unions to not allow union fields with drop
Union fields may now never have a type with attached destructor. This for example allows unions to use arbitrary field types only by wrapping them in `ManuallyDrop` (or similar).
The stable rule remains, that union fields must be `Copy`. We use the new rule for the `untagged_union` feature.
bors [Mon, 21 Oct 2019 15:50:37 +0000 (15:50 +0000)]
Auto merge of #65661 - JohnTitor:rollup-68la1fq, r=JohnTitor
Rollup of 5 pull requests
Successful merges:
- #65544 (Added doc on keyword break)
- #65620 (Correctly note code as Ok not error for E0573)
- #65624 ([mir-opt] Improve SimplifyLocals pass so it can remove unused consts)
- #65650 (use unwrap_or in lint code)
- #65652 (Fix `canonicalize_const_var` leaking inference variables)
Yuki Okushi [Mon, 21 Oct 2019 10:53:04 +0000 (19:53 +0900)]
Rollup merge of #65624 - wesleywiser:improve_simplify_locals, r=oli-obk
[mir-opt] Improve SimplifyLocals pass so it can remove unused consts
The `ConstProp` can cause many locals to be initialized to a constant
value and then never read from. `ConstProp` can also evaluate ZSTs into
constant values. Previously, many of these would be removed by other
parts of the MIR optimization pipeline. However, evaluating ZSTs
(especially `()`) into constant values defeated those parts of the
optimizer and so in a2e3ed5, I added a
hack to `ConstProp` that skips evaluating ZSTs to avoid that regression.
This commit changes `SimplifyLocals` so that it doesn't consider writes
of const values to a local to be a use of that local. In doing so,
`SimplifyLocals` is able to remove otherwise unused locals left behind
by other optimization passes (`ConstProp` in particular).
Yuki Okushi [Mon, 21 Oct 2019 10:53:02 +0000 (19:53 +0900)]
Rollup merge of #65620 - ryoqun:remove-unneeded-comment, r=varkor
Correctly note code as Ok not error for E0573
Hi, this is my first pull request to the Rust project.
The fix is very small one just to fix an oversight in a comment.
Namely, [this documentation PR](https://github.com/rust-lang/rust/pull/65234) added a longer explanation for E0573. It illustrated the error using erroneous/corrected contrasting examples. But it accidentally forgot to remove `// error` from the corrected example.
Sadly, I found the error after the PR got merged. [As suggested by the original author](https://github.com/rust-lang/rust/pull/65234/files#r336518549) of the PR, I created an PR to fix this.
bors [Mon, 21 Oct 2019 04:01:37 +0000 (04:01 +0000)]
Auto merge of #65630 - ecstatic-morse:graphviz-tidy, r=Mark-Simulacrum
Check all files in `src/test` for `borrowck_graphviz_postflow`
This attribute causes DOT files to be generated in the top-level directory. It is intended to be used only temporarily and should never appear on master. This also tells git to ignore DOT files in the root or the `mir_dump` directory, which `-Z dump-mir` uses by default.
This will prevent #65071 from occurring again. It needs to be merged after #65629, otherwise `tidy` will start failing.
Wesley Wiser [Thu, 17 Oct 2019 10:46:51 +0000 (06:46 -0400)]
Improve SimplifyLocals pass so it can remove unused consts
The `ConstProp` can cause many locals to be initialized to a constant
value and then never read from. `ConstProp` can also evaluate ZSTs into
constant values. Previously, many of these would be removed by other
parts of the MIR optimization pipeline. However, evaluating ZSTs
(especially `()`) into constant values defeated those parts of the
optimizer and so in a2e3ed5c054b544df6ceeb9e612d39af819f4aae, I added a
hack to `ConstProp` that skips evaluating ZSTs to avoid that regression.
This commit changes `SimplifyLocals` so that it doesn't consider writes
of const values to a local to be a use of that local. In doing so,
`SimplifyLocals` is able to remove otherwise unused locals left behind
by other optimization passes (`ConstProp` in particular).
bors [Sun, 20 Oct 2019 23:40:12 +0000 (23:40 +0000)]
Auto merge of #65644 - Centril:rollup-gez1xhe, r=Centril
Rollup of 8 pull requests
Successful merges:
- #65314 (rustdoc: forward -Z options to rustc)
- #65592 (clarify const_prop ICE protection comment)
- #65603 (Avoid ICE when include! is used by stdin crate)
- #65614 (Improve error message for APIT with explicit generic arguments)
- #65629 (Remove `borrowck_graphviz_postflow` from test)
- #65633 (Remove leading :: from paths in doc examples)
- #65638 (Rename the default argument 'def' to 'default')
- #65639 (Fix parameter name in documentation)
Couldn't find an existing issue on this (then again, "::" makes for an annoying thing to search for) so if there is already something fixing this and/or there's a reason to not fix it, just close this PR.
(Also fixed indentation in the `process::exit()` docs)
Rollup merge of #65592 - RalfJung:const-prop-comment, r=wesleywiser
clarify const_prop ICE protection comment
This is based on discussion at https://github.com/rust-lang/rust/pull/64890/files#r334555787.
That said, why are function arguments the only unsized locals that could remain uninitialized? Couldn't we also fail to initialize some local but still go on with const_prop, and then hit a line that takes a reference to that? Cc @wesleywiser @oli-obk ; I don't know enough about const-prop to understand why this can happen only for function arguments.
~~The PR includes https://github.com/rust-lang/rust/pull/64890; the only new commit is 05e4e6ba0d5.~~
Rollup merge of #65314 - tmiasko:rustdoc-z, r=ollie27
rustdoc: forward -Z options to rustc
Currently rustdoc does not forward `-Z` options to rustc when building
test executables. This makes impossible to use rustdoc to run test
samples when crate under test is instrumented with one of sanitizers
`-Zsanitizer=...`, since the final linking step will not include
sanitizer runtime library.