-
Notifications
You must be signed in to change notification settings - Fork 357
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
2c9312f
commit 177a36a
Showing
6 changed files
with
59 additions
and
25 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!() | ||
} | ||
} |