never type
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
#![no_std] #![feature(decl_macro)] #![allow(unused)]
|
||||
#![no_std] #![feature(decl_macro)]
|
||||
#![feature(inherent_associated_types)]
|
||||
#![allow(unused, incomplete_features)]
|
||||
|
||||
|
||||
//
|
||||
@@ -22,6 +24,7 @@ pub mod fnv1;
|
||||
pub mod pstruct;
|
||||
pub mod align;
|
||||
|
||||
pub mod never;
|
||||
//
|
||||
// Export Preludes:
|
||||
//
|
||||
@@ -53,6 +56,7 @@ pub mod prelude {
|
||||
pub use crate::pstruct::struct_offset;
|
||||
pub use crate::pod::{Pod,Mut};
|
||||
pub use crate::align::Align;
|
||||
pub use crate::never::Never;
|
||||
}
|
||||
|
||||
pub mod public {
|
||||
|
||||
9
sub/core/src/never.rs
Normal file
9
sub/core/src/never.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
pub type Never = <fn()->! as Ret>::Ret;
|
||||
|
||||
trait Ret { type Ret; }
|
||||
impl<R> Ret for fn() -> R {
|
||||
type Ret=R;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user