|
| 1 | +//! This module reexports the primitive types to allow usage that is not |
| 2 | +//! possibly shadowed by other declared types. |
| 3 | +//! |
| 4 | +//! This is normally only useful in macro generated code. |
| 5 | +//! |
| 6 | +//! An example of this is when generating a new struct and an impl for it: |
| 7 | +//! |
| 8 | +//! ```rust,compile_fail |
| 9 | +//! pub struct bool; |
| 10 | +//! |
| 11 | +//! impl QueryId for bool { |
| 12 | +//! const SOME_PROPERTY: bool = true; |
| 13 | +//! } |
| 14 | +//! |
| 15 | +//! # trait QueryId { const SOME_PROPERTY: core::primitive::bool; } |
| 16 | +//! ``` |
| 17 | +//! |
| 18 | +//! Note that the `SOME_PROPERTY` associated constant would not compile, as its |
| 19 | +//! type `bool` refers to the struct, rather than to the primitive bool type. |
| 20 | +//! |
| 21 | +//! A correct implementation could look like: |
| 22 | +//! |
| 23 | +//! ```rust |
| 24 | +//! # #[allow(non_camel_case_types)] |
| 25 | +//! pub struct bool; |
| 26 | +//! |
| 27 | +//! impl QueryId for bool { |
| 28 | +//! const SOME_PROPERTY: core::primitive::bool = true; |
| 29 | +//! } |
| 30 | +//! |
| 31 | +//! # trait QueryId { const SOME_PROPERTY: core::primitive::bool; } |
| 32 | +//! ``` |
| 33 | +
|
| 34 | +#[stable(feature = "core_primitive", since = "1.42.0")] |
| 35 | +pub use bool; |
| 36 | +#[stable(feature = "core_primitive", since = "1.42.0")] |
| 37 | +pub use char; |
| 38 | +#[stable(feature = "core_primitive", since = "1.42.0")] |
| 39 | +pub use f32; |
| 40 | +#[stable(feature = "core_primitive", since = "1.42.0")] |
| 41 | +pub use f64; |
| 42 | +#[stable(feature = "core_primitive", since = "1.42.0")] |
| 43 | +pub use i128; |
| 44 | +#[stable(feature = "core_primitive", since = "1.42.0")] |
| 45 | +pub use i16; |
| 46 | +#[stable(feature = "core_primitive", since = "1.42.0")] |
| 47 | +pub use i32; |
| 48 | +#[stable(feature = "core_primitive", since = "1.42.0")] |
| 49 | +pub use i64; |
| 50 | +#[stable(feature = "core_primitive", since = "1.42.0")] |
| 51 | +pub use i8; |
| 52 | +#[stable(feature = "core_primitive", since = "1.42.0")] |
| 53 | +pub use isize; |
| 54 | +#[stable(feature = "core_primitive", since = "1.42.0")] |
| 55 | +pub use str; |
| 56 | +#[stable(feature = "core_primitive", since = "1.42.0")] |
| 57 | +pub use u128; |
| 58 | +#[stable(feature = "core_primitive", since = "1.42.0")] |
| 59 | +pub use u16; |
| 60 | +#[stable(feature = "core_primitive", since = "1.42.0")] |
| 61 | +pub use u32; |
| 62 | +#[stable(feature = "core_primitive", since = "1.42.0")] |
| 63 | +pub use u64; |
| 64 | +#[stable(feature = "core_primitive", since = "1.42.0")] |
| 65 | +pub use u8; |
| 66 | +#[stable(feature = "core_primitive", since = "1.42.0")] |
| 67 | +pub use usize; |
0 commit comments