Skip to content

Crate store cleanup #52927

New issue

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

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

Already on GitHub? # to your account

Merged
merged 5 commits into from
Aug 4, 2018
Merged

Conversation

Mark-Simulacrum
Copy link
Member

Each commit mostly stands on its own.

Most of the diff is lifetime-related and uninteresting.

@rust-highfive
Copy link
Contributor

r? @varkor

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 31, 2018
@rust-highfive
Copy link
Contributor

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (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.
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading https://files.pythonhosted.org/packages/ae/3a/b30eb9b2e05d0fa102ad6f1544e10129de857a570ee25549665021fa7450/awscli-1.15.68-py2.py3-none-any.whl (1.3MB)
    0% |▎                               | 10kB 13.4MB/s eta 0:00:01
    1% |▌                               | 20kB 1.9MB/s eta 0:00:01
    2% |▊                               | 30kB 2.1MB/s eta 0:00:01
    3% |█                               | 40kB 2.0MB/s eta 0:00:01
---

[00:04:17] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:17] tidy error: /checkout/src/librustc_resolve/macros.rs:139: line longer than 100 chars
[00:04:17] tidy error: /checkout/src/librustc_metadata/creader.rs:1072: line longer than 100 chars
[00:04:19] some tidy checks failed
[00:04:19] 
[00:04:19] 
[00:04:19] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:04:19] 
[00:04:19] 
[00:04:19] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:19] Build completed unsuccessfully in 0:00:51
[00:04:19] Build completed unsuccessfully in 0:00:51
[00:04:19] Makefile:79: recipe for target 'tidy' failed
[00:04:19] make: *** [tidy] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:040c9958
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:14a601fc:start=1533081528538736572,finish=1533081528547601060,duration=8864488
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:21fd0342
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:066097e8
travis_time:start:066097e8
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:007ab3a8
$ dmesg | grep -i kill

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)

@rust-highfive
Copy link
Contributor

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (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.
travis_time:start:test_run-pass-fulldeps
Check compiletest suite=run-pass-fulldeps mode=run-pass (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:49:43] 
[00:49:43] running 96 tests
[00:51:27] ..F.................................................................test [run-pass] run-pass-fulldeps/myriad-closures.rs has been running for over 60 seconds
cked at 'Some tests failed', tools/compiletest/src/main.rs:498:22
[00:52:42] 
[00:52:42] 
[00:52:42] 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/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/run-pass-fulldeps" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass-fulldeps" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "run-pass" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-5.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "5.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:52:42] 
[00:52:42] 
[00:52:42] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:52:42] Build completed unsuccessfully in 0:13:00
[00:52:42] Build completed unsuccessfully in 0:13:00
[00:52:42] make: *** [check] Error 1
[00:52:42] Makefile:58: recipe for target 'check' failed
34560 ./.git/modules/src/libcompiler_builtins/modules/compiler-rt
34196 ./obj/build/x86_64-unknown-linux-gnu/doc/core/arch
34108 ./.git/modules/src/libcompiler_builtins/modules/compiler-rt/objects
34100 ./.git/modules/src/libcompiler_builtins/modules/compiler-rt/objects/pack
---
travis_time:end:05db6861:start=1533090332777025738,finish=1533090332786607674,duration=9581936
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0fe79160
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:1728ce96
travis_time:start:1728ce96
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:00b29faa
$ dmesg | grep -i kill

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)

@varkor
Copy link
Member

varkor commented Aug 1, 2018

@bors r+

@bors
Copy link
Collaborator

bors commented Aug 1, 2018

📌 Commit dd753cd has been approved by varkor

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 1, 2018
cramertj added a commit to cramertj/rust that referenced this pull request Aug 2, 2018
… r=varkor

Crate store cleanup

Each commit mostly stands on its own.

Most of the diff is lifetime-related and uninteresting.
cramertj added a commit to cramertj/rust that referenced this pull request Aug 2, 2018
… r=varkor

Crate store cleanup

Each commit mostly stands on its own.

Most of the diff is lifetime-related and uninteresting.
src/Cargo.lock Outdated
@@ -2115,6 +2115,7 @@ dependencies = [
"rustc 0.0.0",
"rustc_data_structures 0.0.0",
"rustc_incremental 0.0.0",
"rustc_metadata 0.0.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this and the dependency for rustc_resolve be avoided? Keeping these crates decoupled keeps incremental compile times down if the crates are being modified and helps parallel builds in general

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can, yes -- I'd rather not though. metadata compiles in ~10 seconds for me at least on a non-incremental build IIRC so it's not too heavy weight; generally speaking it feels like optimizing dependency edges between crates like that isn't the right thing to be doing; it's not tenable long-term and generally feels somewhat wrong to me.

But if you think this is a serious hit I can spend some time pulling things back into librustc, though some part of me thinks that we should be actively trying to reduce the size of librustc, syntax, and librustc_mir so that they compile faster as today each takes >100 seconds on clean builds even on good hardware.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm are you sure it compiles that fast? This travis log claims 152s for rustc_metadata (and 373s for rustc), and locally it just took 76s for rustc_metadata and and 159s for rustc. I think 10s is vastly underestimating how long it takes to build this crate (unless you've got hyper-speed hardware!)

I agree though yeah this shouldn't go in librustc, this could perhaps go in a new utils crate or something like that (not putting things in librustc is good).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure we can create "utils" crates but ultimately then what it feels like we're going to end up with is librustc_metadata_utils, librustc_target_utils, librustc_typeck_utils etc for those functions which are currently somewhat out of place in librustc/middle (often used by driver and metadata, or typeck and driver, or some other pair of libraries with one always ultimately depending on the other); or at least that's been my impression while trying to do some mild cleanup to middle.

I'll see if it makes sense to have a util crate that essentially just depends on librustc and then put this and some similar functions in there (for now probably adding a comment that if you find yourself wanting to add a dependency other than rustc/syntax to it you probably shouldn't; the timing results below do seem to indicate that metadata is a bit more hefty than I had expected.


Looking at a build I just did it's actually quite painful that metadata takes so long to build on Travis: as a loose statistic, metadata is ~10k lines of code and librustc is ~100k, but on Travis they build in around a 2.6x difference (400s for librustc and 150s for metadata in stage1).

Locally in stage 1 I see librustc build in 270 seconds and metadata in 60 seconds -- it does look like it's a little heavier than I thought; I might've been recalling a check build.

It's also rather surprising that metadata builds in 114 seconds in stage0 but 150 seconds in stage 1. That's a rather significant disparity!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I didn't even consider this. I'll pay more careful attention to the dependencies next time.

r? @alexcrichton

@@ -61,7 +62,7 @@ pub fn find_crate_name(sess: Option<&Session>,
attrs: &[ast::Attribute],
input: &Input) -> String {
let validate = |s: String, span: Option<Span>| {
cstore::validate_crate_name(sess, &s, span);
creader::validate_crate_name(sess, &s, span);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, could this move to rustc or to a different crate? The rustc_metadata crate is quite heavyweight and pulling it in for one function may not quite be worth it

@Mark-Simulacrum
Copy link
Member Author

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 2, 2018
@varkor
Copy link
Member

varkor commented Aug 3, 2018

r? @alexcrichton

@rust-highfive rust-highfive assigned alexcrichton and unassigned varkor Aug 3, 2018
@Mark-Simulacrum
Copy link
Member Author

I've removed the dependency on metadata from codegen utils but the resolve dependency is more deeply rooted; fundamentally that's because resolve is actually guiding metadata loading/crate registration. The previous way of avoiding the dep was to have a trait in librustc and then resolve would store a trait object which I can return to but doesn't feel quite right.

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Collaborator

bors commented Aug 3, 2018

📌 Commit 6fdd6f6 has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 3, 2018
cramertj added a commit to cramertj/rust that referenced this pull request Aug 3, 2018
… r=alexcrichton

Crate store cleanup

Each commit mostly stands on its own.

Most of the diff is lifetime-related and uninteresting.
@bors
Copy link
Collaborator

bors commented Aug 4, 2018

⌛ Testing commit 6fdd6f6 with merge c11f2d2...

bors added a commit that referenced this pull request Aug 4, 2018
…hton

Crate store cleanup

Each commit mostly stands on its own.

Most of the diff is lifetime-related and uninteresting.
@bors
Copy link
Collaborator

bors commented Aug 4, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing c11f2d2 to master...

@bors bors merged commit 6fdd6f6 into rust-lang:master Aug 4, 2018
@rust-highfive
Copy link
Contributor

📣 Toolstate changed by #52927!

Tested on commit c11f2d2.
Direct link to PR: #52927

💔 rls on windows: test-pass → build-fail (cc @nrc, @rust-lang/infra).
💔 rls on linux: test-pass → build-fail (cc @nrc, @rust-lang/infra).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Aug 4, 2018
Tested on commit rust-lang/rust@c11f2d2.
Direct link to PR: <rust-lang/rust#52927>

💔 rls on windows: test-pass → build-fail (cc @nrc, @rust-lang/infra).
💔 rls on linux: test-pass → build-fail (cc @nrc, @rust-lang/infra).
@kennytm
Copy link
Member

kennytm commented Aug 4, 2018

[01:09:28] error[E0053]: method `late_callback` has an incompatible type for trait
[01:09:28]   --> /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/rls-rustc-0.4.0/src/lib.rs:56:5
[01:09:28]    |
[01:09:28] 56 | /     fn late_callback(&mut self,
[01:09:28] 57 | |                      a: &CodegenBackend,
[01:09:28] 58 | |                      b: &getopts::Matches,
[01:09:28] 59 | |                      c: &Session,
[01:09:28] ...  |
[01:09:28] 65 | |         RustcDefaultCalls.late_callback(a, b, c, d, e, f, g)
[01:09:28] 66 | |     }
[01:09:28]    | |_____^ expected struct `rustc_metadata::cstore::CStore`, found trait rustc::middle::cstore::CrateStore
[01:09:28]    |
[01:09:28]    = note: expected type `fn(&mut ShimCalls, &dyn rustc_codegen_utils::codegen_backend::CodegenBackend, &getopts::Matches, &rustc::session::Session, &rustc_metadata::cstore::CStore, &rustc::session::config::Input, &std::option::Option<std::path::PathBuf>, &std::option::Option<std::path::PathBuf>) -> rustc_driver::Compilation`
[01:09:28]               found type `fn(&mut ShimCalls, &dyn rustc_codegen_utils::codegen_backend::CodegenBackend, &getopts::Matches, &rustc::session::Session, &dyn rustc::middle::cstore::CrateStore, &rustc::session::config::Input, &std::option::Option<std::path::PathBuf>, &std::option::Option<std::path::PathBuf>) -> rustc_driver::Compilation`
[01:09:28]
[01:09:28] error: aborting due to previous error
[01:09:28]
[01:09:28] For more information about this error, try `rustc --explain E0053`.
[01:09:28] [RUSTC-TIMING] rls_rustc test:false 1.737
[01:09:28] error: Could not compile `rls-rustc`.

@Mark-Simulacrum Mark-Simulacrum deleted the cratestore-cleanup branch June 8, 2019 13:49
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants