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

Fix manual_assert and match_wild_err_arm for #![no_std] and Rust 2021 #7851

Merged
merged 2 commits into from
Nov 2, 2021

Conversation

nbdd0121
Copy link
Contributor

@nbdd0121 nbdd0121 commented Oct 20, 2021

Rust 2015 std::panic! has a wrapping block while core::panic! and Rust 2021 std::panic! does not. See rust-lang/rust#88919 for details.

Note that the test won't pass until clippy changes in rust-lang/rust#88860 is synced.


changelog: Fix [manual_assert] and [match_wild_err_arm] for #![no_std] and Rust 2021.

Fixes #7723

@rust-highfive
Copy link

r? @flip1995

(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 Oct 20, 2021
@@ -0,0 +1,56 @@
// run-rustfix
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should duplicate tests for lints, but instead create tests like core_macros or 2018_macros, etc. We only need to test different variations of the macro, not different cases of lints.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or maybe just run the test twice in different editions? I am not sure how to do it though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that sounds better. I think you can do it like this:

// revisions: edition2015 edition2018
// [edition2015] edition:2015
// [edition2018] edition:2018

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems that revisions didn't quite work... It expects me to have a "if_then_panic.edition2021.rs" because I have a "if_then_panic.edition2021.stderr".

@nbdd0121
Copy link
Contributor Author

The CI error confuses me. I didn't touch these files...

@camsteffen
Copy link
Contributor

error: `if_chain!` only has one `if`

this means don't use if_chain!

@camsteffen
Copy link
Contributor

Oh I don't know about the formatting errors...

@camsteffen
Copy link
Contributor

See #7871

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

Only a small comment. Otherwise this LGTM.

May conflict with #7810

@@ -1,3 +1,6 @@
// revisions: edition2018 edition2021
Copy link
Member

Choose a reason for hiding this comment

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

Is this file still necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately yes. If the file isn't there compiletest will complain that the fixed file cannot be compiled.

@flip1995 flip1995 added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Oct 28, 2021
@bors
Copy link
Contributor

bors commented Oct 28, 2021

☔ The latest upstream changes (presumably #7810) made this pull request unmergeable. Please resolve the merge conflicts.

@nbdd0121 nbdd0121 changed the title Fix if_then_panic and match_wild_err_arm for #![no_std] and Rust 2021 Fix manual_assert and match_wild_err_arm for #![no_std] and Rust 2021 Oct 29, 2021
@bors
Copy link
Contributor

bors commented Nov 1, 2021

☔ The latest upstream changes (presumably #7866) made this pull request unmergeable. Please resolve the merge conflicts.

@flip1995
Copy link
Member

flip1995 commented Nov 2, 2021

@bors r+

Thanks!

@bors
Copy link
Contributor

bors commented Nov 2, 2021

📌 Commit 14e0390 has been approved by flip1995

@bors
Copy link
Contributor

bors commented Nov 2, 2021

⌛ Testing commit 14e0390 with merge 276e895...

@bors
Copy link
Contributor

bors commented Nov 2, 2021

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: flip1995
Pushing 276e895 to master...

@bors bors merged commit 276e895 into rust-lang:master Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

if_then_panic doesn't fire when edition is 2021
5 participants