forked from CosmWasm/cosmwasm
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Never type for to avoid ibc_packet_receive errors
- Loading branch information
1 parent
45a122f
commit 2c10355
Showing
6 changed files
with
60 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/// Never can never be instantiated. This can be used in places | ||
/// where we want to ensure that no error is returned, such as | ||
/// the `ibc_packet_receive` entry point. | ||
/// | ||
/// Once the ! type is stable, this is not needed anymore. | ||
/// See <https://github.com/rust-lang/rust/issues/35121>. | ||
pub enum Never {} | ||
|
||
impl core::fmt::Debug for Never { | ||
fn fmt(&self, _f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { | ||
// This is unreachable because no instance of Never can exist | ||
unreachable!() | ||
} | ||
} | ||
|
||
impl core::fmt::Display for Never { | ||
fn fmt(&self, _f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { | ||
// This is unreachable because no instance of Never can exist | ||
unreachable!() | ||
} | ||
} |