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

Clippy showsunreachable-patterns in #[frame_support::pallet] after update to Rust 1.81.0 #6127

Closed
AndreiEres opened this issue Oct 18, 2024 · 3 comments
Assignees
Labels
I3-annoyance The node behaves within expectations, however this “expected behaviour” itself is at issue.

Comments

@AndreiEres
Copy link
Contributor

During the update of Rust in runtimes, many warnings about unreachable-patterns in #[frame_support::pallet] appeared, as noted in polkadot-fellows/runtimes#473. These warnings were silenced, but it is better to fix the bug in the macros.

error: unreachable pattern
   --> relay/kusama/src/governance/origins.rs:22:1
    |
22  | / pub mod pallet_custom_origins {
23  | |     use crate::{Balance, GRAND, QUID};
24  | |     use frame_support::pallet_prelude::*;
...   |
[19](https://github.com/polkadot-fellows/runtimes/actions/runs/11389304108/job/31688274427#step:7:20)6 | |     }
197 | | }
    | |_^ matches no values because `governance::origins::pallet_custom_origins::Call<T>` is uninhabited
    |
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
    = note: `-D unreachable-patterns` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unreachable_patterns)]`
@ggwpez ggwpez added the I3-annoyance The node behaves within expectations, however this “expected behaviour” itself is at issue. label Oct 18, 2024
@bkontur
Copy link
Contributor

bkontur commented Oct 18, 2024

I encountered the same issue here when we were using cargo +nightly clippy in bridges repo CI. This warning seems to be related to +nightly, which is likely why we haven't seen it in the polkadot-sdk repo - most, if not all, CI jobs were switched from +nightly to stable at some point (not sure why and I cannot find that PR).

Now, polkadot-fellows uses cargo +nightly clippy. Shouldn't we switch and align that to stable as well? Giving it a try here: polkadot-fellows/runtimes#489

Anyway, if we can fix it regardless of stable or +nightly, let's do it.

@bkchr
Copy link
Member

bkchr commented Oct 19, 2024

@AndreiEres could you reproduce this on master? (I tried and failed) As I said already in the pr, there was already a similar issue that is now closed: #5697

@AndreiEres AndreiEres self-assigned this Oct 19, 2024
fellowship-merge-bot bot pushed a commit to polkadot-fellows/runtimes that referenced this issue Oct 21, 2024
@AndreiEres
Copy link
Contributor Author

  • Stable: cargo clippy -p pallet-alliance shows no warnings
  • Latest nightly: cargo +nightly clippy -p pallet-alliance shows warnings but not unreachable pattern
  • CI nightly: cargo +nightly-2024-09-11 clippy -p pallet-alliance shows unreachable pattern
warning: unreachable pattern
   --> substrate/frame/system/src/lib.rs:672:12
    |
672 |     #[pallet::call]
    |               ^^^^ matches no values because `frame_support::Never` is uninhabited
    |
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
    = note: `#[warn(unreachable_patterns)]` on by default

I suppose we can be OK with current situation, and since in runtimes we moved to a stable rust in CI we can close the issue.
@bkchr, @bkchr WDYT?

@bkchr bkchr closed this as completed Nov 14, 2024
@github-project-automation github-project-automation bot moved this from Backlog to Done in Runtime / FRAME Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I3-annoyance The node behaves within expectations, however this “expected behaviour” itself is at issue.
Projects
Status: Done
Development

No branches or pull requests

4 participants