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

Deny bare trait objects in src/libstd #52221

Merged
merged 4 commits into from
Jul 27, 2018
Merged

Conversation

ljedrz
Copy link
Contributor

@ljedrz ljedrz commented Jul 10, 2018

Enforce #![deny(bare_trait_objects)] in src/libstd.

@rust-highfive
Copy link
Collaborator

r? @Kimundi

(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 10, 2018
@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:04:47]    Compiling std_unicode v0.0.0 (file:///checkout/src/libstd_unicode)
[00:04:47]    Compiling alloc_system v0.0.0 (file:///checkout/src/liballoc_system)
[00:04:48]    Compiling panic_abort v0.0.0 (file:///checkout/src/libpanic_abort)
[00:04:51]    Compiling panic_unwind v0.0.0 (file:///checkout/src/libpanic_unwind)
[00:04:53] error: trait objects without an explicit `dyn` are deprecated
[00:04:53]   --> libstd/sys/unix/process/process_common.rs:55:23
[00:04:53]    |
[00:04:53] 55 |     closures: Vec<Box<FnMut() -> io::Result<()> + Send + Sync>>,
[00:04:53]    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn FnMut() -> io::Result<()> + Send + Sync`
[00:04:53] note: lint level defined here
[00:04:53]   --> libstd/lib.rs:224:9
[00:04:53]    |
[00:04:53]    |
[00:04:53] 224| #![deny(bare_trait_objects)]
[00:04:53] 
[00:04:53] 
[00:04:53] error: trait objects without an explicit `dyn` are deprecated
[00:04:53]    --> libstd/sys/unix/process/process_common.rs:158:52
[00:04:53]     |
[00:04:53] 158 |     pub fn get_closures(&mut self) -> &mut Vec<Box<FnMut() -> io::Result<()> + Send + Sync>> {
[00:04:53]     |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn FnMut() -> io::Result<()> + Send + Sync`
[00:04:53] 
[00:04:53] error: trait objects without an explicit `dyn` are deprecated
[00:04:53]    --> libstd/sys/unix/process/process_common.rs:163:31
[00:04:53]     |
[00:04:53] 163 |                        f: Box<FnMut() -> io::Result<()> + Send + Sync>) {
[00:04:53]     |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn FnMut() -> io::Result<()> + Send + Sync`
[00:04:53] 
[00:04:53] error: trait objects without an explicit `dyn` are deprecated
[00:04:53]   --> libstd/sys/unix/thread.rs:52:48
[00:04:53]    |
[00:04:53] 52 |     pub unsafe fn new<'a>(stack: usize, p: Box<FnBox() + 'a>)
[00:04:53]    |                                                ^^^^^^^^^^^^ help: use `dyn`: `dyn FnBox() + 'a`
[00:04:55] error: aborting due to 4 previous errors
[00:04:55] 
[00:04:55] error: Could not compile `std`.
[00:04:55] 
[00:04:55] 
[00:04:55] Caused by:
[00:04:55]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name std libstd/lib.rs --color always --error-format json --crate-type dylib --crate-type rlib --emit=dep-info,link -C prefer-dynamic -C opt-level=2 --cfg feature="alloc_jemalloc" --cfg feature="backtrace" --cfg feature="jemalloc" --cfg feature="panic-unwind" --cfg feature="panic_unwind" -C metadata=acba8e5dff5ff58f -C extra-filename=-acba8e5dff5ff58f --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/release/deps --extern alloc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/liballoc-07d51360c24e2889.rlib --extern alloc_jemalloc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/liballoc_jemalloc-a8bbca5d1366afa9.rlib --extern alloc_system=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/liballoc_system-37588f22ef119a7c.rlib --extern compiler_builtins=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/libcompiler_builtins-8c516c50de8b60ca.rlib --extern core=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/libcore-c8f7a210a5d40dd6.rlib --extern libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/liblibc-b89e8d3f043cfac8.rlib --extern panic_abort=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/libpanic_abort-e900ea439ca38db1.rlib --extern panic_unwind=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/libpanic_unwind-12c97d41730d2562.rlib --extern rustc_asan=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/librustc_asan-d70c8d57a4734636.rlib --extern rustc_lsan=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/librustc_lsan-338adff8fe86271b.rlib --extern rustc_msan=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/librustc_msan-de5e79e57985ddeb.rlib --extern rustc_tsan=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/librustc_tsan-2f619371d304061f.rlib --extern std_unicode=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/libstd_unicode-3bc1496f398a04ef.rlib --extern unwind=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/libunwind-46b511c9b9d00ae8.rlib -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/native/libbacktrace/ -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/native/libbacktrace -l static=backtrace -l static=backtrace -l dl -l rt -l pthread -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/build/compiler_builtins-8c31df4670881c7a/out -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/native/jemalloc/lib` (exit code: 101)
[00:04:55] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "panic-unwind jemalloc backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "--message-format" "json"
[00:04:55] expected success, got: exit code: 101
[00:04:55] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1117:9
[00:04:55] travis_fold:end:stage0-std

[00:04:55] travis_time:end:stage0-std:start=1531248265189865180,finish=1531248300622290474,duration=35432425294


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

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:1dd0fcd6
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:05139c96:start=1531248301209456026,finish=1531248301217800272,duration=8344246
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:1d01a938
$ head -30 ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
head: cannot open ‘./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers’ for reading: No such file or directory
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:1227770a
$ 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
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.
[01:06:03] travis_fold:start:test_stage1-std
travis_time:start:test_stage1-std
Testing std stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:06:03]    Compiling std v0.0.0 (file:///checkout/src/libstd)
[01:06:06] error: trait objects without an explicit `dyn` are deprecated
[01:06:06]      |
[01:06:06]      |
[01:06:06] 1441 |     fn avoid_copying_the_body<F>(spawnfn: F) where F: FnOnce(Box<Fn() + Send>) {
[01:06:06]      |                                                                  ^^^^^^^^^^^ help: use `dyn`: `dyn Fn() + Send`
[01:06:06] note: lint level defined here
[01:06:06]     --> libstd/lib.rs:224:9
[01:06:06]      |
[01:06:06]      |
[01:06:06] 224  | #![deny(bare_trait_objects)]
[01:06:06] 
[01:06:06] 
[01:06:06] error: trait objects without an explicit `dyn` are deprecated
[01:06:06]      |
[01:06:06]      |
[01:06:06] 1488 |         fn child_no(x: u32) -> Box<Fn() + Send> {
[01:06:06]      |                                    ^^^^^^^^^^^ help: use `dyn`: `dyn Fn() + Send`
[01:06:06] 
[01:06:06] error: trait objects without an explicit `dyn` are deprecated
[01:06:06]      |
[01:06:06]      |
[01:06:06] 1534 |             panic!(box 413u16 as Box<Any + Send>);
[01:06:06]      |                                      ^^^^^^^^^^ help: use `dyn`: `dyn Any + Send`
[01:06:06] 
[01:06:06] error: trait objects without an explicit `dyn` are deprecated
[01:06:06]      |
[01:06:06]      |
[01:06:06] 1537 |                 type T = Box<Any + Send>;
[01:06:06]      |                              ^^^^^^^^^^ help: use `dyn`: `dyn Any + Send`
[01:06:06] 
[01:06:06] error: trait objects without an explicit `dyn` are deprecated
[01:06:06]     |
[01:06:06]     |
[01:06:06] 536 |         let a = &mut a as &mut (Error + 'static);
[01:06:06]     |                                 ^^^^^^^^^^^^^^^ help: use `dyn`: `dyn Error + 'static`
[01:06:06] 
[01:06:06] error: trait objects without an explicit `dyn` are deprecated
[01:06:06]     |
[01:06:06]     |
[01:06:06] 542 |         let a: Box<Error> = Box::new(A);
[01:06:06]     |                    ^^^^^ help: use `dyn`: `dyn Error`
[01:06:06] 
[01:06:07] error: trait objects without an explicit `dyn` are deprecated
[01:06:07]    --> libstd/io/util.rs:226:40
[01:06:07]     |
[01:06:07] 226 |         assert_eq!(copy(&mut r as &mut Read, &mut w as &mut Write).unwrap(), 1 << 17);
[01:06:07]     |                                        ^^^^ help: use `dyn`: `dyn Read`
[01:06:07] 
[01:06:07] error: trait objects without an explicit `dyn` are deprecated
[01:06:07]    --> libstd/io/util.rs:226:61
[01:06:07]     |
[01:06:07] 226 |         assert_eq!(copy(&mut r as &mut Read, &mut w as &mut Write).unwrap(), 1 << 17);
[01:06:07]     |                                                             ^^^^^ help: use `dyn`: `dyn Write`
[01:06:07] 
[01:06:07] error: trait objects without an explicit `dyn` are deprecated
[01:06:07]     |
[01:06:07]     |
[01:06:07] 930 |     fn each_ip(f: &mut FnMut(SocketAddr)) {
[01:06:07]     |                        ^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn FnMut(SocketAddr)`
[01:06:07] 
[01:06:07] error: trait objects without an explicit `dyn` are deprecated
[01:06:07]     |
[01:06:07]     |
[01:06:07] 829 |     fn each_ip(f: &mut FnMut(SocketAddr, SocketAddr)) {
[01:06:07]     |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn FnMut(SocketAddr, SocketAddr)`
[01:06:17] error: aborting due to 10 previous errors
[01:06:17] 
[01:06:17] error: Could not compile `std`.
[01:06:17] 
[01:06:17] 
[01:06:17] To learn more, run the command again with --verbose.
[01:06:17] 
[01:06:17] 
[01:06:17] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "panic-unwind jemalloc backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "std" "--" "--quiet"
[01:06:17] 
[01:06:17] 
[01:06:17] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:06:17] Build completed unsuccessfully in 0:21:55
[01:06:17] Build completed unsuccessfully in 0:21:55
[01:06:17] Makefile:58: recipe for target 'check' failed
[01:06:17] make: *** [check] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:27492dc0
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:14f9992e:start=1531252947333569348,finish=1531252947344732517,duration=11163169
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:00e37960
$ head -30 ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
head: cannot open ‘./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers’ for reading: No such file or directory
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:00e606c7
$ 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)

@ljedrz ljedrz changed the title Deny bare trait objects in src/libstd Deny bare trait objects in src/libstd Jul 12, 2018
@Kimundi
Copy link
Member

Kimundi commented Jul 12, 2018

@bors: r+

@bors
Copy link
Contributor

bors commented Jul 12, 2018

📌 Commit 1915cd1 has been approved by Kimundi

@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 Jul 12, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Jul 12, 2018
Deny bare trait objects in src/libstd

Enforce #![deny(bare_trait_objects)] in src/libstd.
@kennytm
Copy link
Member

kennytm commented Jul 12, 2018

@bors r- rollup-

Missing dyn in src/libstd/sys/redox/process.rs.

[01:06:30] error: trait objects without an explicit `dyn` are deprecated
[01:06:30]   --> libstd/sys/redox/process.rs:54:23
[01:06:30]    |
[01:06:30] 54 |     closures: Vec<Box<FnMut() -> io::Result<()> + Send + Sync>>,
[01:06:30]    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn FnMut() -> io::Result<()> + Send + Sync`
[01:06:30]    |
[01:06:30] note: lint level defined here
[01:06:30]   --> libstd/lib.rs:224:9
[01:06:30]    |
[01:06:30] 224| #![deny(bare_trait_objects)]
[01:06:30]    |         ^^^^^^^^^^^^^^^^^^
[01:06:30]
[01:06:30] error: trait objects without an explicit `dyn` are deprecated
[01:06:30]    --> libstd/sys/redox/process.rs:125:31
[01:06:30]     |
[01:06:30] 125 |                        f: Box<FnMut() -> io::Result<()> + Send + Sync>) {
[01:06:30]     |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn FnMut() -> io::Result<()> + Send + Sync`

@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 Jul 12, 2018
@ljedrz
Copy link
Contributor Author

ljedrz commented Jul 13, 2018

Fixed with this PR.

@ishitatsuyuki
Copy link
Contributor

Tip: cherry picking my commit doesn't interfere with merging.

@ljedrz
Copy link
Contributor Author

ljedrz commented Jul 13, 2018

@ishitatsuyuki thanks - I haven't done that yet, but it seems pretty handy; did I do it correctly?

@ishitatsuyuki
Copy link
Contributor

I think it's fine.

@stokhos
Copy link

stokhos commented Jul 21, 2018

Ping from triage @ljedrz we haven't heard from you for a while, any progress on this PR?

@pietroalbini
Copy link
Member

Closing this, rolled up in #52336.

@kennytm
Copy link
Member

kennytm commented Jul 21, 2018

Reopening until #52336 is confirmed mergeable.

@kennytm kennytm reopened this Jul 21, 2018
@kennytm kennytm added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 21, 2018
@bors bors merged commit 72e2c00 into rust-lang:master Jul 27, 2018
@ljedrz ljedrz deleted the dyn_libstd branch July 28, 2018 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-blocked Status: Blocked on something else such as an RFC or other implementation work.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants