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

Rename Executor trait to Spawn #53068

Merged
merged 1 commit into from
Aug 7, 2018
Merged

Rename Executor trait to Spawn #53068

merged 1 commit into from
Aug 7, 2018

Conversation

MajorBreakfast
Copy link
Contributor

Renames the Executor trait to Spawn and the method on Context to spawner.

Note: Best only merge this after we've the alpha 3 announcement post ready.

r? @cramertj

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 4, 2018
@MajorBreakfast MajorBreakfast force-pushed the spawn branch 5 times, most recently from f05f123 to 0023a28 Compare August 6, 2018 08:23
@rust-highfive
Copy link
Collaborator

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.
[00:03:44]    Compiling rustc_asan v0.0.0 (file:///checkout/src/librustc_asan)
[00:03:44]    Compiling rustc_msan v0.0.0 (file:///checkout/src/librustc_msan)
[00:03:56]    Compiling libc v0.0.0 (file:///checkout/src/rustc/libc_shim)
[00:03:56]    Compiling alloc v0.0.0 (file:///checkout/src/liballoc)
[00:03:56] error[E0425]: cannot find value `task` in this scope
[00:03:56]    --> liballoc/boxed.rs:983:28
[00:03:56]     |
[00:03:56] 983 |         (**self).spawn_obj(task)
[00:03:56] 
bstd/Cargo.toml" "--message-format" "json"
[00:03:58] expected success, got: exit code: 101
[00:03:58] expected success, got: exit code: 101
[00:03:58] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1118:9
[00:03:58] travis_fold:end:stage0-std

[00:03:58] travis_time:end:stage0-std:start=1533544141013852465,finish=1533544167850848073,duration=26836995608


[00:03:58] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:03:58] Build completed unsuccessfully in 0:00:27
[00:03:59] make: *** [all] Error 1
[00:03:59] Makefile:28: recipe for target 'all' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:2be8f658
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

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
Collaborator

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.
[00:49:03] ....................................................................................................
[00:49:06] ....................................................................................................
[00:49:08] ....................................................................................................
[00:49:11] ....................................................................................................
[00:49:14] iiiiiiiii...........................................................................................
[00:49:20] ....................................................................................................
[00:49:24] .....i..............................................................................................
[00:49:26] ..............i.....................................................................................
[00:49:30] ....................................................................................................
---
Check compiletest suite=run-pass mode=run-pass (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:49:38] 
[00:49:38] running 3056 tests
[00:49:47] ....................................................................................................
[00:49:57] ...............F...............................i....................................................
[00:50:19] ....................................................................................................
[00:50:28] ....................................................................................................
[00:50:43] ....................................................................................................
[00:50:51] ....................................................................................................
[00:50:51] ....................................................................................................
[00:51:01] ...............................................................F....................................
[00:51:24] ....................................................................................................
[00:51:34] ....................................................................................................
[00:51:41] ....................................................................................................
[00:51:50] ....................................................................................................
---
[00:55:34] ---- [run-pass] run-pass/async-await.rs stdout ----
[00:55:34] 
[00:55:34] error: compilation failed!
[00:55:34] status: exit code: 1
[00:55:34] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/run-pass/async-await.rs" "--target=x86_64-unknown-linux-gnu" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass/async-await/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2018" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass/async-await/auxiliary"
[00:55:34] ------------------------------------------
[00:55:34] 
[00:55:34] ------------------------------------------
[00:55:34] stderr:
[00:55:34] stderr:
[00:55:34] ------------------------------------------
[00:55:34] error[E0432]: unresolved import `std::task::Spawner`
[00:55:34]    |
[00:55:34]    |
[00:55:34] 25 |     Spawner, SpawnObjError,
[00:55:34]    |     ^^^^^^^ no `Spawner` in `task`. Did you mean to use `Spawn`?
[00:55:34] error: aborting due to previous error
[00:55:34] 
[00:55:34] For more information about this error, try `rustc --explain E0432`.
[00:55:34] 
---
[00:55:34] ---- [run-pass] run-pass/futures-api.rs stdout ----
[00:55:34] 
[00:55:34] error: compilation failed!
[00:55:34] status: exit code: 1
[00:55:34] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/run-pass/futures-api.rs" "--target=x86_64-unknown-linux-gnu" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass/futures-api/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass/futures-api/auxiliary"
[00:55:34] ------------------------------------------
[00:55:34] 
[00:55:34] ------------------------------------------
[00:55:34] stderr:
[00:55:34] stderr:
[00:55:34] ------------------------------------------
[00:55:34] error[E0432]: unresolved import `std::task::Spawner`
[00:55:34]    |
[00:55:34]    |
[00:55:34] 26 |     Spawner, SpawnObjError,
[00:55:34]    |     ^^^^^^^ no `Spawner` in `task`. Did you mean to use `Spawn`?
[00:55:34] error: aborting due to previous error
[00:55:34] 
[00:55:34] For more information about this error, try `rustc --explain E0432`.
[00:55:34] 
---
[00:55:34] 
[00:55:34] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:498:22
[00:55:34] 
[00:55:34] 
[00:55:34] 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" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass" "--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:55:34] 
[00:55:34] 
[00:55:34] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:55:34] Build completed unsuccessfully in 0:09:17
[00:55:34] Build completed unsuccessfully in 0:09:17
[00:55:34] Makefile:58: recipe for target 'check' failed
[00:55:34] make: *** [check] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:23c982c0
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:0182aa82:start=1533549382015331555,finish=1533549382022348192,duration=7016637
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:1f0c5513
$ 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:16c328fd
travis_time:start:16c328fd
$ 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:36ebdae7
$ 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)

@cramertj
Copy link
Member

cramertj commented Aug 6, 2018

@MajorBreakfast On #wg-net-async we'd talked about renaming to Spawner but your PR is for Spawn. What was the reasoning behind the change? I'm not opposed to it necessarily-- consistency isn't absolute here (see io::{Read, Write}, Iterator, task::{Executor, Wake}) but I liked that spawner and waker were symmetrical items in task::Context.

@MajorBreakfast
Copy link
Contributor Author

The suggestion came from @Nemo157 (also on Discord). I just ran with it. I'd say the difference between Waker and Spawn makes it easier to see that Waker is a struct and Spawn a trait. I like both names, though.

cc @Nemo157

@Nemo157
Copy link
Member

Nemo157 commented Aug 6, 2018

It seems to me that Spawn falls into the category of “named function” traits, similar to From, Borrow, Clone, Read etc. (although the last one is a bit sketchy since it’s not the exact name of the function). I feel like I’ve seen recommendations to name traits after the action they encompass instead of the thing that does their action somewhere.

I’m not really against Spawner if you prefer that, but note that there’s still consistency in the methods on context, it’s just the trait name that’s changed.

@cramertj
Copy link
Member

cramertj commented Aug 6, 2018

Sounds good to me, thanks!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Aug 6, 2018

📌 Commit 60aa11d has been approved by cramertj

@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 6, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Aug 7, 2018
Rename Executor trait to Spawn

Renames the `Executor` trait to `Spawn` and the method on `Context` to `spawner`.

Note: Best only merge this after we've the alpha 3 announcement post ready.

r? @cramertj
bors added a commit that referenced this pull request Aug 7, 2018
Rollup of 10 pull requests

Successful merges:

 - #52885 (Remove some unused method arguments from typeck)
 - #52886 (cleanup: Remove `Def::GlobalAsm`)
 - #53028 (Building librustc_codegen_llvm in a separate directory)
 - #53052 (fixed broken links to char)
 - #53060 (Change rustdoc style so fully qualified name does not overlap src link)
 - #53068 (Rename Executor trait to Spawn)
 - #53093 (Enable macros to pass $:literal to another macro)
 - #53107 (Remove references to `StaticMutex` which got removed a while ago)
 - #53135 (Rust 2018: Disable catch_expr, not targeted for 2018 edition)
 - #53139 (set emit_debug_gdb_scripts: false for riscv32imac-unknown-none target)
@bors bors merged commit 60aa11d into rust-lang:master Aug 7, 2018
@eddyb
Copy link
Member

eddyb commented Aug 15, 2018

I wanted to beat a dead horse and mention that I also prefer Spawner, just because it reads off very "meaningfully" ("placing your futures into the Spawner", that is).

@cramertj
Copy link
Member

@eddyb Yeah, but you might also want Spawner to be a concrete type that implements Spawn, similar to how Waker is a concrete type and Wake is a trait. shrug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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