Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #65723

Closed
wants to merge 44 commits into from
Closed

Conversation

Centril
Copy link
Contributor

@Centril Centril commented Oct 23, 2019

Successful merges:

Failed merges:

r? @ghost

Mark-Simulacrum and others added 30 commits October 17, 2019 19:16
Replace early_error and sess.err with bug!, in all cases. If the
compiler we're running with, including plugins, is registering something
twice, that's a (compiler/plugin) programmer error -- we should not try
to be nice at the cost of developer ergononomics (hiding the stacktrace
of the second registration is bad).

This also is basically a static bug in ~all cases so it should not be a
detriment to users, including with plugins.
This is straight up removing dead code, but is a separate commit from
the previous to avoid conflating clean up and important changes.
This extracts the call to get_lints() to callers.
This is in preparation for on-demand constructing passes
This moves from calling get_lints on instantiated pass objects to the
raw object
This stops storing the pass objects and instead stores constructor
functions.

The primary effect is that LintStore no longer has any interior
mutability.
Moves this information to a direct field of Lint, which is where it
belongs.
Avoid querying LintStore when not necessary
Access through tcx is fine -- by that point, the lint store is frozen,
but direct access through Session will go away in future commits, as
lint store is still mutable in early stages of Session, and will be
removed completely.
Remove lint store from Session
Move to using Box<dyn Fn() -> ...> so that we can let plugins register
state.

This also adds a callback that'll get called from plugin registration so
that Clippy and other tools can register lints without using the plugin
API. The plugin API still works, but this new API is more compatible
with drivers other than rustc.
`TokenStream` used to be a complex type, but it is now just a newtype
around a `Lrc<Vec<TreeAndJoint>>`. Currently it uses custom encoding
that discards the `IsJoint` and custom decoding that adds `NonJoint`
back in for every token tree. This requires building intermediate
`Vec<TokenTree>`s.

This commit makes `TokenStream` derive `Rustc{En,De}codable`. This
simplifies the code, and avoids the creation of the intermediate
vectors, saving up to 3% on various benchmarks. It also changes the AST
JSON output in one test.
This avoids the needs for various conversions, and makes the code
slightly faster, because `Symbol` comparisons and hashing is faster.
Its fourth argument is always `Some(pred)`, so the pattern matching is
unnecessary. This commit inlines and removes it.
It's a full conversion, except in `DefKey::compute_stable_hash()` where
a `Symbol` now is converted to an `InternedString` before being hashed.
This was necessary to avoid test failures.
This requires changing the `PartialOrd`/`Ord` implementations to look at
the chars rather than the symbol index.
This is a straightforward replacement except for two places where we
have to convert to `LocalInternedString` to get a stable sort.
By using `LocalInternedString` instead for the few remaining uses.
Change-Id: Ib3a396e7334d209fe6c6ef425bbfc7b2ae471378
Change-Id: Ib3a396e7334d209fe6c6ef425bbfc7b2ae471378
eddyb and others added 14 commits October 22, 2019 14:21
Add Cow::is_borrowed and Cow::is_owned

Implements rust-lang#65143.
… 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.
…ables, r=michaelwoerister

rustc_metadata: use a table for super_predicates, fn_sig, impl_trait_ref.

This is an attempt at a part of rust-lang#65407, i.e. moving parts of cross-crate "metadata" into tables that match queries more closely.

Three new tables should be enough to see some perf/metadata size changes.
(need to do something similar to rust-lang#59953 (comment))

There are other bits of data that could be made into tables, but they can be more compact so the impact would likely be not as bad, and they're also more work to set up.
…dable-Decodable, r=petrochenkov

Derive `Rustc{En,De}codable` for `TokenStream`.

`TokenStream` used to be a complex type, but it is now just a newtype
around a `Lrc<Vec<TreeAndJoint>>`. Currently it uses custom encoding
that discards the `IsJoint` and custom decoding that adds `NonJoint`
back in for every token tree. This requires building intermediate
`Vec<TokenTree>`s.

This commit makes `TokenStream` derive `Rustc{En,De}codable`. This
simplifies the code, and avoids the creation of the intermediate
vectors, saving up to 3% on various benchmarks. It also changes the AST
JSON output in one test.

r? @petrochenkov
…omatsakis

Eliminate `intersect_opt`.

Its fourth argument is always `Some(pred)`, so the pattern matching is
unnecessary. This commit inlines and removes it.

r? @nikomatsakis
…rly, r=eddyb

Remove `InternedString`

This PR removes `InternedString` by converting all occurrences to `Symbol`. There are a handful of places that need to use the symbol chars instead of the symbol index, e.g. for stable sorting; local conversions `LocalInternedString` is used in those places.

r? @eddyb
Deprecated proc_macro doesn't trigger warning on build library

Fix rust-lang#65189
…r=Dylan-DPC

Update E0659 error code long explanation to 2018 edition

Fixes rust-lang#65571

r? @Centril
relax ExactSizeIterator bound on write_bytes

Too many iterators don't have that bound. Instead we do run-time checks.

r? @oli-obk
@Centril
Copy link
Contributor Author

Centril commented Oct 23, 2019

@bors r+ p=9 rollup=never

@bors
Copy link
Contributor

bors commented Oct 23, 2019

📌 Commit fe3eb32 has been approved by Centril

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Oct 23, 2019
@Centril Centril added the rollup A PR which is a rollup label Oct 23, 2019
@bors
Copy link
Contributor

bors commented Oct 23, 2019

⌛ Testing commit fe3eb32 with merge 37cd49308c7abb6fae6d640bf73d41eb13bcbc6e...

@rust-highfive
Copy link
Collaborator

The job test-various of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-10-23T17:26:22.7521197Z ##[section]Starting: Linux test-various
2019-10-23T17:26:23.3854033Z ##[section]Starting: Initialize job
2019-10-23T17:26:23.3854282Z Agent name: 'Azure Pipelines 56'
2019-10-23T17:26:23.3854404Z Agent machine name: 'fv-az619'
2019-10-23T17:26:23.3854475Z Current agent version: '2.159.2'
2019-10-23T17:26:23.3877528Z Agent running as: 'vsts'
2019-10-23T17:26:23.4288542Z Set build variables.
2019-10-23T17:26:23.4333751Z Download all required tasks.
2019-10-23T17:26:23.4490879Z Downloading task: Bash (3.159.3)
2019-10-23T17:26:24.5410276Z Downloading task: CmdLine (2.151.2)
---
2019-10-23T18:58:56.0475200Z ---- [ui] ui/proc-macro/proc-macro-deprecated-attr.rs stdout ----
2019-10-23T18:58:56.0476092Z 
2019-10-23T18:58:56.0476444Z error: test compilation failed although it shouldn't!
2019-10-23T18:58:56.0476547Z status: exit code: 1
2019-10-23T18:58:56.0478226Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/proc-macro/proc-macro-deprecated-attr.rs" "-Zthreads=1" "--target=wasm32-unknown-unknown" "--error-format" "json" "-Zui-testing" "--emit" "metadata" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/proc-macro/proc-macro-deprecated-attr" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/wasm32-unknown-unknown/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/proc-macro/proc-macro-deprecated-attr/auxiliary" "-A" "unused"
2019-10-23T18:58:56.0478940Z ------------------------------------------
2019-10-23T18:58:56.0478991Z 
2019-10-23T18:58:56.0479248Z ------------------------------------------
2019-10-23T18:58:56.0479333Z stderr:
2019-10-23T18:58:56.0479333Z stderr:
2019-10-23T18:58:56.0480429Z ------------------------------------------
2019-10-23T18:58:56.0481063Z warning: dropping unsupported crate type `proc-macro` for target `wasm32-unknown-unknown`
2019-10-23T18:58:56.0481155Z 
2019-10-23T18:58:56.0481541Z error: the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type
2019-10-23T18:58:56.0481959Z    |
2019-10-23T18:58:56.0482023Z LL | #[proc_macro]
2019-10-23T18:58:56.0482106Z    | ^^^^^^^^^^^^^
2019-10-23T18:58:56.0482149Z 
---
2019-10-23T18:58:56.0545196Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:537:22
2019-10-23T18:58:56.0546429Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-10-23T18:58:56.0560905Z 
2019-10-23T18:58:56.0561405Z 
2019-10-23T18:58:56.0566118Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/wasm32-unknown-unknown/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-wasm32-unknown-unknown" "--mode" "ui" "--target" "wasm32-unknown-unknown" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" "--nodejs" "/node-v9.2.0-linux-x64/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/wasm32-unknown-unknown/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--llvm-version" "9.0.0-rust-1.40.0-dev\n" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2019-10-23T18:58:56.0567789Z 
2019-10-23T18:58:56.0568016Z 
2019-10-23T18:58:56.0627297Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --target wasm32-unknown-unknown src/test/run-make src/test/ui src/test/compile-fail src/test/mir-opt src/test/codegen-units src/libcore
2019-10-23T18:58:56.0627764Z Build completed unsuccessfully in 1:23:19
2019-10-23T18:58:56.0627764Z Build completed unsuccessfully in 1:23:19
2019-10-23T18:58:56.0631266Z == clock drift check ==
2019-10-23T18:58:56.0659221Z   local time: Wed Oct 23 18:58:56 UTC 2019
2019-10-23T18:58:56.0928023Z   network time: Wed, 23 Oct 2019 18:58:56 GMT
2019-10-23T18:58:56.0933703Z == end clock drift check ==
2019-10-23T18:58:57.2645265Z 
2019-10-23T18:58:57.2755098Z ##[error]Bash exited with code '1'.
2019-10-23T18:58:57.2798907Z ##[section]Starting: Upload CPU usage statistics
2019-10-23T18:58:57.2823254Z ==============================================================================
2019-10-23T18:58:57.2823368Z Task         : Bash
2019-10-23T18:58:57.2823560Z Description  : Run a Bash script on macOS, Linux, or Windows

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors
Copy link
Contributor

bors commented Oct 23, 2019

💔 Test failed - checks-azure

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 23, 2019
@Centril Centril closed this Oct 23, 2019
@Centril Centril deleted the rollup-llc38jq branch October 23, 2019 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants