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

Add #[must_use] to From::from and Into::into #89770

Merged
merged 1 commit into from Oct 12, 2021

Conversation

jkugelman
Copy link
Contributor

@jkugelman jkugelman commented Oct 11, 2021

Risk of churn: High
Magic 8-Ball says: Outlook not so good

I figured I'd put this out there. If we don't do it now maybe we save it for a rainy day.

Parent issue: #89692

r? @joshtriplett

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 11, 2021
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@joshtriplett joshtriplett added the relnotes Marks issues that should be documented in the release notes of the next release. label Oct 11, 2021
@joshtriplett
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Oct 11, 2021

📌 Commit 3d1996a has been approved by joshtriplett

@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 Oct 11, 2021
@jkugelman
Copy link
Contributor Author

jkugelman commented Oct 11, 2021

@joshtriplett Should I go look at all the other traits like Eq and Clone and whatnot? Clippy ignores trait methods so they're not on my list.

Edit: Bad examples, though. They're already must-use.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 11, 2021
…=joshtriplett

Add #[must_use] to From::from and Into::into

Risk of churn: **High**
Magic 8-Ball says: **Outlook not so good**

I figured I'd put this out there. If we don't do it now maybe we save it for a rainy day.

Parent issue: rust-lang#89692

r? `@joshtriplett`
@matthiaskrgr
Copy link
Member

Rollup failure in #89783 , I think it is this pr, but not 100% sure

#89783 (comment)

---- compile_test stdout ----

error: failed to compile fixed code
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "tests/ui/cast_lossless_float.fixed" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/cast_lossless_float.stage-id" "--emit=metadata" "-Dwarnings" "-Zui-testing" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-392b40a2759b0504.rlib" "--extern" "serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-8bd56d0234290b82.so" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-89222f6e0d369b36.rlib" "--extern" "if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-b3e76e8f62643cc6.rlib" "--extern" "clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-bc2b0c8a9dcb9fb3.rlib" "--extern" "derive_new=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libderive_new-ea1db0c41efed0d6.so" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-b0f19a5fad83a10b.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-2c42e7af51424ce5.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-c6bd037ba33baa25.rlib" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/cast_lossless_float.stage-id.aux"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_float.fixed","byte_start":223,"byte_end":237,"line_start":9,"line_end":9,"column_start":5,"column_end":19,"is_primary":true,"text":[{"text":"    f32::from(x0);","highlight_start":5,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`-D unused-must-use` implied by `-D warnings`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_float.fixed:9:5\n   |\nLL |     f32::from(x0);\n   |     ^^^^^^^^^^^^^^\n   |\n   = note: `-D unused-must-use` implied by `-D warnings`\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_float.fixed","byte_start":242,"byte_end":256,"line_start":10,"line_end":10,"column_start":5,"column_end":19,"is_primary":true,"text":[{"text":"    f64::from(x0);","highlight_start":5,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_float.fixed:10:5\n   |\nLL |     f64::from(x0);\n   |     ^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_float.fixed","byte_start":279,"byte_end":293,"line_start":12,"line_end":12,"column_start":5,"column_end":19,"is_primary":true,"text":[{"text":"    f32::from(x1);","highlight_start":5,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_float.fixed:12:5\n   |\nLL |     f32::from(x1);\n   |     ^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_float.fixed","byte_start":298,"byte_end":312,"line_start":13,"line_end":13,"column_start":5,"column_end":19,"is_primary":true,"text":[{"text":"    f64::from(x1);","highlight_start":5,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_float.fixed:13:5\n   |\nLL |     f64::from(x1);\n   |     ^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_float.fixed","byte_start":336,"byte_end":350,"line_start":15,"line_end":15,"column_start":5,"column_end":19,"is_primary":true,"text":[{"text":"    f32::from(x2);","highlight_start":5,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_float.fixed:15:5\n   |\nLL |     f32::from(x2);\n   |     ^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_float.fixed","byte_start":355,"byte_end":369,"line_start":16,"line_end":16,"column_start":5,"column_end":19,"is_primary":true,"text":[{"text":"    f64::from(x2);","highlight_start":5,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_float.fixed:16:5\n   |\nLL |     f64::from(x2);\n   |     ^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_float.fixed","byte_start":393,"byte_end":407,"line_start":18,"line_end":18,"column_start":5,"column_end":19,"is_primary":true,"text":[{"text":"    f32::from(x3);","highlight_start":5,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_float.fixed:18:5\n   |\nLL |     f32::from(x3);\n   |     ^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_float.fixed","byte_start":412,"byte_end":426,"line_start":19,"line_end":19,"column_start":5,"column_end":19,"is_primary":true,"text":[{"text":"    f64::from(x3);","highlight_start":5,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_float.fixed:19:5\n   |\nLL |     f64::from(x3);\n   |     ^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_float.fixed","byte_start":450,"byte_end":464,"line_start":21,"line_end":21,"column_start":5,"column_end":19,"is_primary":true,"text":[{"text":"    f64::from(x4);","highlight_start":5,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_float.fixed:21:5\n   |\nLL |     f64::from(x4);\n   |     ^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_float.fixed","byte_start":488,"byte_end":502,"line_start":23,"line_end":23,"column_start":5,"column_end":19,"is_primary":true,"text":[{"text":"    f64::from(x5);","highlight_start":5,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_float.fixed:23:5\n   |\nLL |     f64::from(x5);\n   |     ^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_float.fixed","byte_start":557,"byte_end":575,"line_start":26,"line_end":26,"column_start":5,"column_end":23,"is_primary":true,"text":[{"text":"    f64::from(1.0f32);","highlight_start":5,"highlight_end":23}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_float.fixed:26:5\n   |\nLL |     f64::from(1.0f32);\n   |     ^^^^^^^^^^^^^^^^^^\n\n"}

------------------------------------------



error: failed to compile fixed code
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "tests/ui/cast_lossless_integer.fixed" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/cast_lossless_integer.stage-id" "--emit=metadata" "-Dwarnings" "-Zui-testing" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-392b40a2759b0504.rlib" "--extern" "serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-8bd56d0234290b82.so" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-89222f6e0d369b36.rlib" "--extern" "if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-b3e76e8f62643cc6.rlib" "--extern" "clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-bc2b0c8a9dcb9fb3.rlib" "--extern" "derive_new=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libderive_new-ea1db0c41efed0d6.so" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-b0f19a5fad83a10b.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-2c42e7af51424ce5.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-c6bd037ba33baa25.rlib" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/cast_lossless_integer.stage-id.aux"
------------------------------------------

------------------------------------------
error: test failed, to rerun pass '--test compile-test'
error: test failed, to rerun pass '--test compile-test'
stderr:
------------------------------------------
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_integer.fixed","byte_start":198,"byte_end":213,"line_start":8,"line_end":8,"column_start":5,"column_end":20,"is_primary":true,"text":[{"text":"    i16::from(1i8);","highlight_start":5,"highlight_end":20}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`-D unused-must-use` implied by `-D warnings`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_integer.fixed:8:5\n   |\nLL |     i16::from(1i8);\n   |     ^^^^^^^^^^^^^^^\n   |\n   = note: `-D unused-must-use` implied by `-D warnings`\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_integer.fixed","byte_start":218,"byte_end":233,"line_start":9,"line_end":9,"column_start":5,"column_end":20,"is_primary":true,"text":[{"text":"    i32::from(1i8);","highlight_start":5,"highlight_end":20}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_integer.fixed:9:5\n   |\nLL |     i32::from(1i8);\n   |     ^^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_integer.fixed","byte_start":238,"byte_end":253,"line_start":10,"line_end":10,"column_start":5,"column_end":20,"is_primary":true,"text":[{"text":"    i64::from(1i8);","highlight_start":5,"highlight_end":20}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_integer.fixed:10:5\n   |\nLL |     i64::from(1i8);\n   |     ^^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_integer.fixed","byte_start":258,"byte_end":273,"line_start":11,"line_end":11,"column_start":5,"column_end":20,"is_primary":true,"text":[{"text":"    i16::from(1u8);","highlight_start":5,"highlight_end":20}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_integer.fixed:11:5\n   |\nLL |     i16::from(1u8);\n   |     ^^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_integer.fixed","byte_start":278,"byte_end":293,"line_start":12,"line_end":12,"column_start":5,"column_end":20,"is_primary":true,"text":[{"text":"    i32::from(1u8);","highlight_start":5,"highlight_end":20}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_integer.fixed:12:5\n   |\nLL |     i32::from(1u8);\n   |     ^^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_integer.fixed","byte_start":298,"byte_end":313,"line_start":13,"line_end":13,"column_start":5,"column_end":20,"is_primary":true,"text":[{"text":"    i64::from(1u8);","highlight_start":5,"highlight_end":20}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_integer.fixed:13:5\n   |\nLL |     i64::from(1u8);\n   |     ^^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_integer.fixed","byte_start":318,"byte_end":333,"line_start":14,"line_end":14,"column_start":5,"column_end":20,"is_primary":true,"text":[{"text":"    u16::from(1u8);","highlight_start":5,"highlight_end":20}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_integer.fixed:14:5\n   |\nLL |     u16::from(1u8);\n   |     ^^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_integer.fixed","byte_start":338,"byte_end":353,"line_start":15,"line_end":15,"column_start":5,"column_end":20,"is_primary":true,"text":[{"text":"    u32::from(1u8);","highlight_start":5,"highlight_end":20}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_integer.fixed:15:5\n   |\nLL |     u32::from(1u8);\n   |     ^^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_integer.fixed","byte_start":358,"byte_end":373,"line_start":16,"line_end":16,"column_start":5,"column_end":20,"is_primary":true,"text":[{"text":"    u64::from(1u8);","highlight_start":5,"highlight_end":20}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_integer.fixed:16:5\n   |\nLL |     u64::from(1u8);\n   |     ^^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_integer.fixed","byte_start":378,"byte_end":394,"line_start":17,"line_end":17,"column_start":5,"column_end":21,"is_primary":true,"text":[{"text":"    i32::from(1i16);","highlight_start":5,"highlight_end":21}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_integer.fixed:17:5\n   |\nLL |     i32::from(1i16);\n   |     ^^^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_integer.fixed","byte_start":399,"byte_end":415,"line_start":18,"line_end":18,"column_start":5,"column_end":21,"is_primary":true,"text":[{"text":"    i64::from(1i16);","highlight_start":5,"highlight_end":21}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_integer.fixed:18:5\n   |\nLL |     i64::from(1i16);\n   |     ^^^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_integer.fixed","byte_start":420,"byte_end":436,"line_start":19,"line_end":19,"column_start":5,"column_end":21,"is_primary":true,"text":[{"text":"    i32::from(1u16);","highlight_start":5,"highlight_end":21}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_integer.fixed:19:5\n   |\nLL |     i32::from(1u16);\n   |     ^^^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_integer.fixed","byte_start":441,"byte_end":457,"line_start":20,"line_end":20,"column_start":5,"column_end":21,"is_primary":true,"text":[{"text":"    i64::from(1u16);","highlight_start":5,"highlight_end":21}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_integer.fixed:20:5\n   |\nLL |     i64::from(1u16);\n   |     ^^^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_integer.fixed","byte_start":462,"byte_end":478,"line_start":21,"line_end":21,"column_start":5,"column_end":21,"is_primary":true,"text":[{"text":"    u32::from(1u16);","highlight_start":5,"highlight_end":21}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_integer.fixed:21:5\n   |\nLL |     u32::from(1u16);\n   |     ^^^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_integer.fixed","byte_start":483,"byte_end":499,"line_start":22,"line_end":22,"column_start":5,"column_end":21,"is_primary":true,"text":[{"text":"    u64::from(1u16);","highlight_start":5,"highlight_end":21}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_integer.fixed:22:5\n   |\nLL |     u64::from(1u16);\n   |     ^^^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_integer.fixed","byte_start":504,"byte_end":520,"line_start":23,"line_end":23,"column_start":5,"column_end":21,"is_primary":true,"text":[{"text":"    i64::from(1i32);","highlight_start":5,"highlight_end":21}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_integer.fixed:23:5\n   |\nLL |     i64::from(1i32);\n   |     ^^^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_integer.fixed","byte_start":525,"byte_end":541,"line_start":24,"line_end":24,"column_start":5,"column_end":21,"is_primary":true,"text":[{"text":"    i64::from(1u32);","highlight_start":5,"highlight_end":21}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_integer.fixed:24:5\n   |\nLL |     i64::from(1u32);\n   |     ^^^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_integer.fixed","byte_start":546,"byte_end":562,"line_start":25,"line_end":25,"column_start":5,"column_end":21,"is_primary":true,"text":[{"text":"    u64::from(1u32);","highlight_start":5,"highlight_end":21}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_integer.fixed:25:5\n   |\nLL |     u64::from(1u32);\n   |     ^^^^^^^^^^^^^^^^\n\n"}
{"message":"unused return value of `std::convert::From::from` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"error","spans":[{"file_name":"tests/ui/cast_lossless_integer.fixed","byte_start":617,"byte_end":638,"line_start":28,"line_end":28,"column_start":5,"column_end":26,"is_primary":true,"text":[{"text":"    u16::from(1u8 + 1u8);","highlight_start":5,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: unused return value of `std::convert::From::from` that must be used\n  --> tests/ui/cast_lossless_integer.fixed:28:5\n   |\nLL |     u16::from(1u8 + 1u8);\n   |     ^^^^^^^^^^^^^^^^^^^^^\n\n"}

------------------------------------------

thread 'compile_test' panicked at 'Some tests failed', /cargo/registry/src/github.com-1ecc6299db9ec823/compiletest_rs-0.7.0/src/lib.rs:105:22

@jkugelman
Copy link
Contributor Author

Yes, it definitely is.

What's the process here? I'll fix the test(s) and re-push. Do I need to do anything else?

Any tips how I can verify that this is fixed for sure? This is the first time a change of mine has passed CI but failed in the rollup stage.

@matthiaskrgr
Copy link
Member

iirc ./x.py test src/tools/clippy is the command to run clippy tests within the rustc repo.
The clippy sources are inside the repo so you can edit the test files or bless the output files to make sure the tests pass.
Don't worry about the ci failure, things like that just happen :)

@jkugelman
Copy link
Contributor Author

Clippy tests fixed.

@the8472 the8472 added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Oct 11, 2021
@joshtriplett
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Oct 12, 2021

📌 Commit f9692b5 has been approved by joshtriplett

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 12, 2021
…=joshtriplett

Add #[must_use] to From::from and Into::into

Risk of churn: **High**
Magic 8-Ball says: **Outlook not so good**

I figured I'd put this out there. If we don't do it now maybe we save it for a rainy day.

Parent issue: rust-lang#89692

r? `@joshtriplett`
@bors
Copy link
Contributor

bors commented Oct 12, 2021

⌛ Testing commit f9692b5 with merge 9475e60...

@bors
Copy link
Contributor

bors commented Oct 12, 2021

☀️ Test successful - checks-actions
Approved by: joshtriplett
Pushing 9475e60 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 12, 2021
@bors bors merged commit 9475e60 into rust-lang:master Oct 12, 2021
@rustbot rustbot added this to the 1.57.0 milestone Oct 12, 2021
@jkugelman jkugelman deleted the must-use-from-and-into branch October 12, 2021 12:50
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (9475e60): comparison url.

Summary: This benchmark run did not return any relevant changes.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

flip1995 pushed a commit to flip1995/rust that referenced this pull request Oct 21, 2021
…oshtriplett

Add #[must_use] to From::from and Into::into

Risk of churn: **High**
Magic 8-Ball says: **Outlook not so good**

I figured I'd put this out there. If we don't do it now maybe we save it for a rainy day.

Parent issue: rust-lang#89692

r? `@joshtriplett`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants