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

Differentiate todo! and unimplemented! #67445

Merged
merged 1 commit into from Dec 25, 2019
Merged

Differentiate todo! and unimplemented! #67445

merged 1 commit into from Dec 25, 2019

Conversation

@llogiq
Copy link
Contributor

llogiq commented Dec 20, 2019

This updates the panic message and docs to make it clear that todo! is for unfinished code and unimplemented! is for partial trait or enum impls.

r? @Centril

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Dec 20, 2019

The job x86_64-gnu-llvm-7 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-12-20T06:48:19.3450265Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-12-20T06:48:19.3461481Z ##[command]git config gc.auto 0
2019-12-20T06:48:19.3466885Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-12-20T06:48:19.3470746Z ##[command]git config --get-all http.proxy
2019-12-20T06:48:19.3478082Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/67445/merge:refs/remotes/pull/67445/merge
---
2019-12-20T07:40:47.2053321Z .................................................................................................... 1600/9380
2019-12-20T07:40:50.9736684Z .................................................................................................... 1700/9380
2019-12-20T07:41:01.8828096Z ...................................................................i................................ 1800/9380
2019-12-20T07:41:08.6053491Z .................................................................................................... 1900/9380
2019-12-20T07:41:22.2217581Z ....................................................iiiii........................................... 2000/9380
2019-12-20T07:41:31.7281124Z .................................................................................................... 2200/9380
2019-12-20T07:41:33.9747421Z .................................................................................................... 2300/9380
2019-12-20T07:41:36.9953071Z .................................................................................................... 2400/9380
2019-12-20T07:41:57.3997502Z .................................................................................................... 2500/9380
---
2019-12-20T07:44:12.7199724Z .............................................................i...............i...................... 4800/9380
2019-12-20T07:44:19.1978801Z .................................................................................................... 4900/9380
2019-12-20T07:44:26.4845957Z .................................................................................................... 5000/9380
2019-12-20T07:44:30.8742116Z .....i.............................................................................................. 5100/9380
2019-12-20T07:44:39.8137444Z .......................................................................ii.ii...........i............ 5200/9380
2019-12-20T07:44:47.1810158Z .......i............................................................................................ 5400/9380
2019-12-20T07:44:55.7448600Z .................................................................................................... 5500/9380
2019-12-20T07:45:01.4870547Z .....................................................i.............................................. 5600/9380
2019-12-20T07:45:07.4884740Z .................................................................................................... 5700/9380
2019-12-20T07:45:07.4884740Z .................................................................................................... 5700/9380
2019-12-20T07:45:16.3037473Z .................................................................................................... 5800/9380
2019-12-20T07:45:22.4683490Z ..........................................ii..i..ii...........i..................................... 5900/9380
2019-12-20T07:45:41.6395364Z .................................................................................................... 6100/9380
2019-12-20T07:45:48.4844140Z .................................................................................................... 6200/9380
2019-12-20T07:45:48.4844140Z .................................................................................................... 6200/9380
2019-12-20T07:45:56.2723980Z ..................................................................i..ii............................. 6300/9380
2019-12-20T07:46:20.7110291Z .................................................................................................... 6500/9380
2019-12-20T07:46:22.4121731Z ......................................i............................................................. 6600/9380
2019-12-20T07:46:24.2492115Z .................................................................................................... 6700/9380
2019-12-20T07:46:26.2718440Z ..............................i..................................................................... 6800/9380
---
2019-12-20T07:47:52.2419648Z .................................................................................................... 7400/9380
2019-12-20T07:47:56.5150180Z .................................................................................................... 7500/9380
2019-12-20T07:48:01.1194114Z .................................................................................................... 7600/9380
2019-12-20T07:48:09.6208007Z .................................................................................................... 7700/9380
2019-12-20T07:48:17.4428531Z ....................................................iiii............................................ 7800/9380
2019-12-20T07:48:30.2112627Z .................................................................................................... 8000/9380
2019-12-20T07:48:35.9163079Z .................................................................................................... 8100/9380
2019-12-20T07:48:49.3709625Z .................................................................................................... 8200/9380
2019-12-20T07:48:56.0653347Z .................................................................................................... 8300/9380
---
2019-12-20T07:50:36.2506805Z 
2019-12-20T07:50:36.2507011Z 25 LL | pub const X: () = unimplemented!();
2019-12-20T07:50:36.2507725Z 26    | ------------------^^^^^^^^^^^^^^^^-
2019-12-20T07:50:36.2507999Z 27    |                   |
2019-12-20T07:50:36.2508449Z -    |                   the evaluated program panicked at 'not yet implemented', $DIR/const_panic.rs:10:19
2019-12-20T07:50:36.2509320Z +    |                   the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:10:19
2019-12-20T07:50:36.2510419Z 30    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2019-12-20T07:50:36.2510794Z 31 
2019-12-20T07:50:36.2510862Z 
2019-12-20T07:50:36.2510917Z 
2019-12-20T07:50:36.2510917Z 
2019-12-20T07:50:36.2510964Z The actual stderr differed from the expected stderr.
2019-12-20T07:50:36.2511606Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-eval/const_panic/const_panic.stderr
2019-12-20T07:50:36.2511887Z To update references, rerun the tests and pass the `--bless` flag
2019-12-20T07:50:36.2512154Z To only update this specific test, also pass `--test-args consts/const-eval/const_panic.rs`
2019-12-20T07:50:36.2512249Z error: 1 errors occurred comparing output.
2019-12-20T07:50:36.2512291Z status: exit code: 1
2019-12-20T07:50:36.2512291Z status: exit code: 1
2019-12-20T07:50:36.2513684Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/consts/const-eval/const_panic.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-eval/const_panic" "-Crpath" "-O" "-Cdebuginfo=0" "-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/ui/consts/const-eval/const_panic/auxiliary" "-A" "unused"
2019-12-20T07:50:36.2514162Z ------------------------------------------
2019-12-20T07:50:36.2514192Z 
2019-12-20T07:50:36.2514376Z ------------------------------------------
2019-12-20T07:50:36.2514432Z stderr:
2019-12-20T07:50:36.2514432Z stderr:
2019-12-20T07:50:36.2514612Z ------------------------------------------
2019-12-20T07:50:36.2514655Z error: any use of this value will cause an error
2019-12-20T07:50:36.2514895Z   --> /checkout/src/test/ui/consts/const-eval/const_panic.rs:4:19
2019-12-20T07:50:36.2514939Z    |
2019-12-20T07:50:36.2514978Z LL | pub const Z: () = panic!("cheese");
2019-12-20T07:50:36.2515388Z    |                   |
2019-12-20T07:50:36.2515388Z    |                   |
2019-12-20T07:50:36.2515675Z    |                   the evaluated program panicked at 'cheese', /checkout/src/test/ui/consts/const-eval/const_panic.rs:4:19
2019-12-20T07:50:36.2515791Z    = note: `#[deny(const_err)]` on by default
2019-12-20T07:50:36.2516218Z    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2019-12-20T07:50:36.2516253Z 
2019-12-20T07:50:36.2516289Z error: any use of this value will cause an error
2019-12-20T07:50:36.2516289Z error: any use of this value will cause an error
2019-12-20T07:50:36.2516511Z   --> /checkout/src/test/ui/consts/const-eval/const_panic.rs:7:19
2019-12-20T07:50:36.2516551Z    |
2019-12-20T07:50:36.2516587Z LL | pub const Y: () = unreachable!();
2019-12-20T07:50:36.2516924Z    |                   |
2019-12-20T07:50:36.2517207Z    |                   the evaluated program panicked at 'internal error: entered unreachable code', /checkout/src/test/ui/consts/const-eval/const_panic.rs:7:19
2019-12-20T07:50:36.2517272Z    |
2019-12-20T07:50:36.2517718Z    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2019-12-20T07:50:36.2517718Z    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2019-12-20T07:50:36.2517755Z 
2019-12-20T07:50:36.2517813Z error: any use of this value will cause an error
2019-12-20T07:50:36.2518022Z   --> /checkout/src/test/ui/consts/const-eval/const_panic.rs:10:19
2019-12-20T07:50:36.2518062Z    |
2019-12-20T07:50:36.2518116Z LL | pub const X: () = unimplemented!();
2019-12-20T07:50:36.2518298Z    | ------------------^^^^^^^^^^^^^^^^-
2019-12-20T07:50:36.2518511Z    |                   |
2019-12-20T07:50:36.2518829Z    |                   the evaluated program panicked at 'not implemented', /checkout/src/test/ui/consts/const-eval/const_panic.rs:10:19
2019-12-20T07:50:36.2519165Z    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2019-12-20T07:50:36.2519220Z 
2019-12-20T07:50:36.2519257Z error: aborting due to 3 previous errors
2019-12-20T07:50:36.2519282Z 
---
2019-12-20T07:50:36.2520205Z 
2019-12-20T07:50:36.2520240Z 25 LL | const X: () = unimplemented!();
2019-12-20T07:50:36.2520422Z 26    | --------------^^^^^^^^^^^^^^^^-
2019-12-20T07:50:36.2520479Z 27    |               |
2019-12-20T07:50:36.2520726Z -    |               the evaluated program panicked at 'not yet implemented', $DIR/const_panic_libcore.rs:11:15
2019-12-20T07:50:36.2520986Z +    |               the evaluated program panicked at 'not implemented', $DIR/const_panic_libcore.rs:11:15
2019-12-20T07:50:36.2521471Z 30    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2019-12-20T07:50:36.2521518Z 31 
2019-12-20T07:50:36.2521544Z 
2019-12-20T07:50:36.2521583Z 
2019-12-20T07:50:36.2521583Z 
2019-12-20T07:50:36.2521620Z The actual stderr differed from the expected stderr.
2019-12-20T07:50:36.2521882Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-eval/const_panic_libcore/const_panic_libcore.stderr
2019-12-20T07:50:36.2522103Z To update references, rerun the tests and pass the `--bless` flag
2019-12-20T07:50:36.2522328Z To only update this specific test, also pass `--test-args consts/const-eval/const_panic_libcore.rs`
2019-12-20T07:50:36.2522419Z error: 1 errors occurred comparing output.
2019-12-20T07:50:36.2522456Z status: exit code: 1
2019-12-20T07:50:36.2522456Z status: exit code: 1
2019-12-20T07:50:36.2523407Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/consts/const-eval/const_panic_libcore.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-eval/const_panic_libcore" "-Crpath" "-O" "-Cdebuginfo=0" "-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/ui/consts/const-eval/const_panic_libcore/auxiliary" "-A" "unused"
2019-12-20T07:50:36.2523884Z ------------------------------------------
2019-12-20T07:50:36.2523927Z 
2019-12-20T07:50:36.2524098Z ------------------------------------------
2019-12-20T07:50:36.2524199Z stderr:
2019-12-20T07:50:36.2524199Z stderr:
2019-12-20T07:50:36.2524382Z ------------------------------------------
2019-12-20T07:50:36.2524439Z error: any use of this value will cause an error
2019-12-20T07:50:36.2524642Z   --> /checkout/src/test/ui/consts/const-eval/const_panic_libcore.rs:5:15
2019-12-20T07:50:36.2524683Z    |
2019-12-20T07:50:36.2524736Z LL | const Z: () = panic!("cheese");
2019-12-20T07:50:36.2524940Z    |               |
2019-12-20T07:50:36.2524940Z    |               |
2019-12-20T07:50:36.2525196Z    |               the evaluated program panicked at 'cheese', /checkout/src/test/ui/consts/const-eval/const_panic_libcore.rs:5:15
2019-12-20T07:50:36.2525274Z    = note: `#[deny(const_err)]` on by default
2019-12-20T07:50:36.2525541Z    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2019-12-20T07:50:36.2525573Z 
2019-12-20T07:50:36.2525614Z error: any use of this value will cause an error
2019-12-20T07:50:36.2525614Z error: any use of this value will cause an error
2019-12-20T07:50:36.2525829Z   --> /checkout/src/test/ui/consts/const-eval/const_panic_libcore.rs:8:15
2019-12-20T07:50:36.2525866Z    |
2019-12-20T07:50:36.2525907Z LL | const Y: () = unreachable!();
2019-12-20T07:50:36.2526125Z    |               |
2019-12-20T07:50:36.2526389Z    |               the evaluated program panicked at 'internal error: entered unreachable code', /checkout/src/test/ui/consts/const-eval/const_panic_libcore.rs:8:15
2019-12-20T07:50:36.2526450Z    |
2019-12-20T07:50:36.2526867Z    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2019-12-20T07:50:36.2526867Z    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2019-12-20T07:50:36.2526901Z 
2019-12-20T07:50:36.2526954Z error: any use of this value will cause an error
2019-12-20T07:50:36.2527411Z   --> /checkout/src/test/ui/consts/const-eval/const_panic_libcore.rs:11:15
2019-12-20T07:50:36.2527457Z    |
2019-12-20T07:50:36.2527492Z LL | const X: () = unimplemented!();
2019-12-20T07:50:36.2527686Z    | --------------^^^^^^^^^^^^^^^^-
2019-12-20T07:50:36.2527725Z    |               |
2019-12-20T07:50:36.2527987Z    |               the evaluated program panicked at 'not implemented', /checkout/src/test/ui/consts/const-eval/const_panic_libcore.rs:11:15
2019-12-20T07:50:36.2528484Z    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2019-12-20T07:50:36.2528519Z 
2019-12-20T07:50:36.2528574Z error: aborting due to 3 previous errors
2019-12-20T07:50:36.2528598Z 
---
2019-12-20T07:50:36.2529142Z 
2019-12-20T07:50:36.2529197Z 25 LL | const X: () = unimplemented!();
2019-12-20T07:50:36.2529382Z 26    | --------------^^^^^^^^^^^^^^^^-
2019-12-20T07:50:36.2529423Z 27    |               |
2019-12-20T07:50:36.2529745Z -    |               the evaluated program panicked at 'not yet implemented', $DIR/const_panic_libcore_main.rs:15:15
2019-12-20T07:50:36.2530019Z +    |               the evaluated program panicked at 'not implemented', $DIR/const_panic_libcore_main.rs:15:15
2019-12-20T07:50:36.2530354Z 30    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2019-12-20T07:50:36.2530559Z 31 
2019-12-20T07:50:36.2530584Z 
2019-12-20T07:50:36.2530605Z 
2019-12-20T07:50:36.2530605Z 
2019-12-20T07:50:36.2530659Z The actual stderr differed from the expected stderr.
2019-12-20T07:50:36.2530932Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-eval/const_panic_libcore_main/const_panic_libcore_main.stderr
2019-12-20T07:50:36.2531212Z To update references, rerun the tests and pass the `--bless` flag
2019-12-20T07:50:36.2531690Z To only update this specific test, also pass `--test-args consts/const-eval/const_panic_libcore_main.rs`
2019-12-20T07:50:36.2531759Z error: 1 errors occurred comparing output.
2019-12-20T07:50:36.2531815Z status: exit code: 1
2019-12-20T07:50:36.2531815Z status: exit code: 1
2019-12-20T07:50:36.2532694Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/consts/const-eval/const_panic_libcore_main.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/const-eval/const_panic_libcore_main" "-Crpath" "-O" "-Cdebuginfo=0" "-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/ui/consts/const-eval/const_panic_libcore_main/auxiliary" "-A" "unused"
2019-12-20T07:50:36.2532983Z ------------------------------------------
2019-12-20T07:50:36.2533018Z 
2019-12-20T07:50:36.2533215Z ------------------------------------------
2019-12-20T07:50:36.2533252Z stderr:
2019-12-20T07:50:36.2533252Z stderr:
2019-12-20T07:50:36.2533425Z ------------------------------------------
2019-12-20T07:50:36.2533484Z error: any use of this value will cause an error
2019-12-20T07:50:36.2533694Z   --> /checkout/src/test/ui/consts/const-eval/const_panic_libcore_main.rs:9:15
2019-12-20T07:50:36.2533736Z    |
2019-12-20T07:50:36.2533790Z LL | const Z: () = panic!("cheese");
2019-12-20T07:50:36.2534002Z    |               |
2019-12-20T07:50:36.2534002Z    |               |
2019-12-20T07:50:36.2534254Z    |               the evaluated program panicked at 'cheese', /checkout/src/test/ui/consts/const-eval/const_panic_libcore_main.rs:9:15
2019-12-20T07:50:36.2534515Z    = note: `#[deny(const_err)]` on by default
2019-12-20T07:50:36.2534971Z    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2019-12-20T07:50:36.2535003Z 
2019-12-20T07:50:36.2535037Z error: any use of this value will cause an error
2019-12-20T07:50:36.2535037Z error: any use of this value will cause an error
2019-12-20T07:50:36.2535237Z   --> /checkout/src/test/ui/consts/const-eval/const_panic_libcore_main.rs:12:15
2019-12-20T07:50:36.2535293Z    |
2019-12-20T07:50:36.2535326Z LL | const Y: () = unreachable!();
2019-12-20T07:50:36.2535541Z    |               |
2019-12-20T07:50:36.2535811Z    |               the evaluated program panicked at 'internal error: entered unreachable code', /checkout/src/test/ui/consts/const-eval/const_panic_libcore_main.rs:12:15
2019-12-20T07:50:36.2535855Z    |
2019-12-20T07:50:36.2536117Z    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2019-12-20T07:50:36.2536117Z    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2019-12-20T07:50:36.2536157Z 
2019-12-20T07:50:36.2536194Z error: any use of this value will cause an error
2019-12-20T07:50:36.2536471Z   --> /checkout/src/test/ui/consts/const-eval/const_panic_libcore_main.rs:15:15
2019-12-20T07:50:36.2536514Z    |
2019-12-20T07:50:36.2536548Z LL | const X: () = unimplemented!();
2019-12-20T07:50:36.2536923Z    | --------------^^^^^^^^^^^^^^^^-
2019-12-20T07:50:36.2536962Z    |               |
2019-12-20T07:50:36.2537453Z    |               the evaluated program panicked at 'not implemented', /checkout/src/test/ui/consts/const-eval/const_panic_libcore_main.rs:15:15
2019-12-20T07:50:36.2537780Z    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2019-12-20T07:50:36.2537813Z 
2019-12-20T07:50:36.2537866Z error: aborting due to 3 previous errors
2019-12-20T07:50:36.2537890Z 
---
2019-12-20T07:50:36.2559282Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:537:22
2019-12-20T07:50:36.2559381Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-12-20T07:50:36.2585307Z 
2019-12-20T07:50:36.2585378Z 
2019-12-20T07:50:36.2586998Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "/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/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-7/bin/FileCheck" "--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/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" "7.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"
2019-12-20T07:50:36.2587478Z 
2019-12-20T07:50:36.2587503Z 
2019-12-20T07:50:36.2625330Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-12-20T07:50:36.2625437Z Build completed unsuccessfully in 0:56:37
2019-12-20T07:50:36.2625437Z Build completed unsuccessfully in 0:56:37
2019-12-20T07:50:36.2630774Z == clock drift check ==
2019-12-20T07:50:36.2646580Z   local time: Fri Dec 20 07:50:36 UTC 2019
2019-12-20T07:50:36.5523217Z   network time: Fri, 20 Dec 2019 07:50:36 GMT
2019-12-20T07:50:36.5523341Z == end clock drift check ==
2019-12-20T07:50:37.7841143Z 
2019-12-20T07:50:37.7935749Z ##[error]Bash exited with code '1'.
2019-12-20T07:50:37.7968241Z ##[section]Starting: Checkout
2019-12-20T07:50:37.7969662Z ==============================================================================
2019-12-20T07:50:37.7969704Z Task         : Get sources
2019-12-20T07:50:37.7969758Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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)

@Centril

This comment has been minimized.

Copy link
Member

Centril commented Dec 20, 2019

My understanding is that @dtolnay said (#56348 (comment)) we shouldn't differentiate like this.

r? @dtolnay cc @withoutboats @matklad

@rust-highfive rust-highfive assigned dtolnay and unassigned Centril Dec 20, 2019
@matklad

This comment has been minimized.

Copy link
Member

matklad commented Dec 20, 2019

In practice people use unimplemented! for both "todo" and "trait signature forces me to write this method, but it doesn't make sense for my use case and is never called" (I saw the latter in rustc when trying to actively deprecate unimplmented). If we pick any one of the meanings, some code will be "misusing" todo.

I'd prefer to just say "unimplemented is an alias for todo", thus nudging folks towards using shorter and less ambiguous todo. Maybe even apply #[doc(hidden)] / #[derecated] to unimplemented in some distant future.

@petertodd

This comment has been minimized.

Copy link
Contributor

petertodd commented Dec 22, 2019

Re: the partial trait use-case, here's an abbreviated example from one of my projects:

trait Zone {
    type Alllocator;
    fn allocator() -> Self::Allocator where Self: Default {
        todo!("Zone::allocator() required because {} implements Default", type_name::<Self>())
    }
}

This is a requirement for implementing the trait; it's a genuine todo!() as it's unfinished code. Indeed, you could imagine a more targeted #[no_panic] actually check if any todo!()'s remained after release optimizations. Also, note the run-time error message:

thread 'main' panicked at 'not yet implemented: Zone::allocator() required because todotest::Heap implements Default', src/main.rs:7:9

The wording is something hasn't yet been implemented; it will be implemented in the future.

Conversely here's another example from the same project (again, very simplified):

trait Decode {
    type Error;
    fn decode(buf: &[u8]) -> Result<Self, Self::Error>;
}

impl Decode for ! {
    type Error = !;
    fn decode(buf: &[u8]) -> Result<Self, Self::Error> {
        panic!("! can't be decoded")
    }
}

At one point IIRC I actually used unimplemented!() for the above, but I removed it when I realized the error message was wrong: decode() will never be implemented for !, and the panicking implementation only exists at due to it being an edge case in my overall API design. (unreachable!() might be good here too) edit: and to be clear, I think even the change to it saying "not implemented" as suggested by this pull-req is still confusing in this case: decode can't be implemented. Also, there's the (weaker) argument that the wording change in conjunction with existing uses that did mean "will be implemented" is confusing.

tl;dr:

  1. I really like how short todo!() is and use it all the time now.
  2. I agree with @matklad on depreciating unimplemented!()
@withoutboats

This comment has been minimized.

Copy link
Contributor

withoutboats commented Dec 23, 2019

We've had this debate again and again during the development of todo, and my opinion is that std should not attempt to prescribe any particular way of using the APIs, because we all will use them differently.

Attempts to say that unimplemented is for a use case other than unfinished usually runs into the problem of differentiating unimplemented from unreachable.

In my opinion, panicking in a case that is neither unfinished nor unreachable (e.g. any public API which panics) should use panic! and contain a unique message explaining the error made in calling it. This leaves no use case for unimplemented in the way that I write Rust. However, I respect that other people have different ideas of what to use, and I think that's fine.

I don't understand the constant impulse to systematically prescribe every decision users make in writing code.

@withoutboats

This comment has been minimized.

Copy link
Contributor

withoutboats commented Dec 23, 2019

Just changing unimplemented's panic message to "not implemented" instead of "not yet implemented" seems fine to me, since it just makes it more flexible (though again, I would personally just use panic for anything I expected to merge to master). I just don't think we should put nearly as much energy as we already have into trying to dictate how these several semantically equivalent macros gets used.

@llogiq

This comment has been minimized.

Copy link
Contributor Author

llogiq commented Dec 23, 2019

@withoutboats thank you! That's a good suggestion. I'll update the PR shortly.

@llogiq llogiq force-pushed the llogiq:todo branch from 10b3a4c to 2635acc Dec 23, 2019
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Dec 23, 2019

The job x86_64-gnu-llvm-7 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-12-23T12:28:51.6564532Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-12-23T12:28:52.4886504Z ##[command]git config gc.auto 0
2019-12-23T12:28:52.4891327Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-12-23T12:28:52.4893873Z ##[command]git config --get-all http.proxy
2019-12-23T12:28:52.4898129Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/67445/merge:refs/remotes/pull/67445/merge
---
2019-12-23T13:29:07.3128719Z .................................................................................................... 1600/9427
2019-12-23T13:29:12.0984322Z .................................................................................................... 1700/9427
2019-12-23T13:29:22.6859862Z .....................................................................................i.............. 1800/9427
2019-12-23T13:29:30.2731535Z .................................................................................................... 1900/9427
2019-12-23T13:29:37.4071583Z ......................................................................iiiii......................... 2000/9427
2019-12-23T13:29:58.0994333Z .................................................................................................... 2200/9427
2019-12-23T13:30:00.5557440Z .................................................................................................... 2300/9427
2019-12-23T13:30:03.2998744Z .................................................................................................... 2400/9427
2019-12-23T13:30:16.4348918Z .................................................................................................... 2500/9427
---
2019-12-23T13:33:09.3187061Z .i...............i.................................................................................. 4900/9427
2019-12-23T13:33:19.3180345Z .................................................................................................... 5000/9427
2019-12-23T13:33:24.1844244Z .............................................i...................................................... 5100/9427
2019-12-23T13:33:34.0787378Z .................................................................................................... 5200/9427
2019-12-23T13:33:39.9766308Z ............ii.ii...........i....................................................................... 5300/9427
2019-12-23T13:33:49.1486754Z .................................................................................................... 5500/9427
2019-12-23T13:34:00.3397999Z ..............................................................................................i..... 5600/9427
2019-12-23T13:34:08.3860341Z .................................................................................................... 5700/9427
2019-12-23T13:34:13.6835982Z .................................................................................................... 5800/9427
2019-12-23T13:34:13.6835982Z .................................................................................................... 5800/9427
2019-12-23T13:34:23.4700137Z ..................................................................................ii...i..ii........ 5900/9427
2019-12-23T13:34:46.2985218Z .................................................................................................... 6100/9427
2019-12-23T13:34:53.9472722Z .................................................................................................... 6200/9427
2019-12-23T13:35:02.2165997Z .................................................................................................... 6300/9427
2019-12-23T13:35:02.2165997Z .................................................................................................... 6300/9427
2019-12-23T13:35:16.2659535Z .........i..ii...................................................................................... 6400/9427
2019-12-23T13:35:35.6315697Z .....................................................................................i.............. 6600/9427
2019-12-23T13:35:37.8277678Z .................................................................................................... 6700/9427
2019-12-23T13:35:40.1240341Z .....................................................................................i.............. 6800/9427
2019-12-23T13:35:42.9045688Z .................................................................................................... 6900/9427
---
2019-12-23T13:40:49.3244709Z failures:
2019-12-23T13:40:49.3244741Z 
2019-12-23T13:40:49.3245052Z ---- [run-fail] run-fail/unimplemented-macro-panic.rs stdout ----
2019-12-23T13:40:49.3245087Z 
2019-12-23T13:40:49.3245322Z error: error pattern 'not yet implemented' not found!
2019-12-23T13:40:49.3245369Z status: exit code: 101
2019-12-23T13:40:49.3245745Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-fail/unimplemented-macro-panic/a" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-fail/unimplemented-macro-panic/a"
2019-12-23T13:40:49.3246046Z ------------------------------------------
2019-12-23T13:40:49.3246076Z 
2019-12-23T13:40:49.3246275Z ------------------------------------------
2019-12-23T13:40:49.3246325Z stderr:
2019-12-23T13:40:49.3246325Z stderr:
2019-12-23T13:40:49.3246545Z ------------------------------------------
2019-12-23T13:40:49.3246812Z thread 'main' panicked at 'not implemented', /checkout/src/test/run-fail/unimplemented-macro-panic.rs:3:5
2019-12-23T13:40:49.3246899Z 
2019-12-23T13:40:49.3247119Z ------------------------------------------
2019-12-23T13:40:49.3247149Z 
2019-12-23T13:40:49.3247173Z 
---
2019-12-23T13:40:49.3253043Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:385:22
2019-12-23T13:40:49.3253162Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-12-23T13:40:49.3258897Z 
2019-12-23T13:40:49.3258988Z 
2019-12-23T13:40:49.3265652Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "/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-fail" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-fail" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "run-fail" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-7/bin/FileCheck" "--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/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" "7.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"
2019-12-23T13:40:49.3266056Z 
2019-12-23T13:40:49.3266106Z 
2019-12-23T13:40:49.3280873Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-12-23T13:40:49.3280997Z Build completed unsuccessfully in 1:05:33
2019-12-23T13:40:49.3280997Z Build completed unsuccessfully in 1:05:33
2019-12-23T13:40:49.3340369Z == clock drift check ==
2019-12-23T13:40:50.1557109Z   local time: Mon Dec 23 13:40:49 UTC 2019
2019-12-23T13:40:50.1557181Z   network time: Mon, 23 Dec 2019 13:40:49 GMT
2019-12-23T13:40:50.1557252Z == end clock drift check ==
2019-12-23T13:40:50.7909024Z 
2019-12-23T13:40:50.8024184Z ##[error]Bash exited with code '1'.
2019-12-23T13:40:50.8068205Z ##[section]Starting: Checkout
2019-12-23T13:40:50.8070690Z ==============================================================================
2019-12-23T13:40:50.8070751Z Task         : Get sources
2019-12-23T13:40:50.8070817Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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)

@llogiq llogiq force-pushed the llogiq:todo branch from 2635acc to 54f8fc1 Dec 23, 2019
src/libcore/macros/mod.rs Outdated Show resolved Hide resolved
@llogiq llogiq force-pushed the llogiq:todo branch from 54f8fc1 to f4d0a04 Dec 24, 2019
@dtolnay

This comment has been minimized.

Copy link
Member

dtolnay commented Dec 24, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 24, 2019

📌 Commit f4d0a04 has been approved by dtolnay

/// // We have some logic here,
/// // so we can use unimplemented! to display what we have so far.
/// // We can add a message to unimplemented! to display our omission.

This comment has been minimized.

Copy link
@petertodd

petertodd Dec 24, 2019

Contributor

Minor typo/awkward wording. How about wording it as the following:

"We have some logic here. We can add a message to unimplemented! to explain our omission."

@petertodd

This comment has been minimized.

Copy link
Contributor

petertodd commented Dec 24, 2019

@withoutboats That's fair! I didn't follow that discussion closely so I'm probably lacking context. :)

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 24, 2019

⌛️ Testing commit f4d0a04 with merge a5bc786...

bors added a commit that referenced this pull request Dec 24, 2019
Differentiate todo! and unimplemented!

This updates the panic message and docs to make it clear that `todo!` is for unfinished code and `unimplemented!` is for partial trait or enum impls.

r? @Centril
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 25, 2019

☀️ Test successful - checks-azure
Approved by: dtolnay
Pushing a5bc786 to master...

@bors bors added the merged-by-bors label Dec 25, 2019
@bors bors merged commit f4d0a04 into rust-lang:master Dec 25, 2019
5 checks passed
5 checks passed
homu Test successful
Details
pr Build #20191224.28 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-7) Linux x86_64-gnu-llvm-7 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
@llogiq llogiq deleted the llogiq:todo branch Dec 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants
You can’t perform that action at this time.