|
|
|
@ -1,3 +1,5 @@
|
|
|
|
|
use alloc::string::String;
|
|
|
|
|
|
|
|
|
|
/// Calls a function and aborts if it panics.
|
|
|
|
|
///
|
|
|
|
|
/// This is useful in unsafe code where we can't recover from panics.
|
|
|
|
@ -104,6 +106,7 @@ macro_rules! cfg_unstable_default {
|
|
|
|
|
|
|
|
|
|
/// Declares Unix-specific items.
|
|
|
|
|
#[doc(hidden)]
|
|
|
|
|
#[allow(unused_macros)]
|
|
|
|
|
macro_rules! cfg_unix {
|
|
|
|
|
($($item:item)*) => {
|
|
|
|
|
$(
|
|
|
|
@ -116,6 +119,7 @@ macro_rules! cfg_unix {
|
|
|
|
|
|
|
|
|
|
/// Declares Windows-specific items.
|
|
|
|
|
#[doc(hidden)]
|
|
|
|
|
#[allow(unused_macros)]
|
|
|
|
|
macro_rules! cfg_windows {
|
|
|
|
|
($($item:item)*) => {
|
|
|
|
|
$(
|
|
|
|
@ -128,6 +132,7 @@ macro_rules! cfg_windows {
|
|
|
|
|
|
|
|
|
|
/// Declares items when the "docs" feature is enabled.
|
|
|
|
|
#[doc(hidden)]
|
|
|
|
|
#[allow(unused_macros)]
|
|
|
|
|
macro_rules! cfg_docs {
|
|
|
|
|
($($item:item)*) => {
|
|
|
|
|
$(
|
|
|
|
@ -139,6 +144,7 @@ macro_rules! cfg_docs {
|
|
|
|
|
|
|
|
|
|
/// Declares items when the "docs" feature is disabled.
|
|
|
|
|
#[doc(hidden)]
|
|
|
|
|
#[allow(unused_macros)]
|
|
|
|
|
macro_rules! cfg_not_docs {
|
|
|
|
|
($($item:item)*) => {
|
|
|
|
|
$(
|
|
|
|
@ -160,6 +166,18 @@ macro_rules! cfg_std {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Declares no-std items.
|
|
|
|
|
#[allow(unused_macros)]
|
|
|
|
|
#[doc(hidden)]
|
|
|
|
|
macro_rules! cfg_alloc {
|
|
|
|
|
($($item:item)*) => {
|
|
|
|
|
$(
|
|
|
|
|
#[cfg(feature = "alloc")]
|
|
|
|
|
$item
|
|
|
|
|
)*
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Declares default items.
|
|
|
|
|
#[allow(unused_macros)]
|
|
|
|
|
#[doc(hidden)]
|
|
|
|
@ -180,6 +198,7 @@ macro_rules! cfg_default {
|
|
|
|
|
///
|
|
|
|
|
/// Inside invocations of this macro, we write a definitions that looks similar to the final
|
|
|
|
|
/// rendered docs, and the macro then generates all the boilerplate for us.
|
|
|
|
|
#[allow(unused_macros)]
|
|
|
|
|
#[doc(hidden)]
|
|
|
|
|
macro_rules! extension_trait {
|
|
|
|
|
(
|
|
|
|
@ -204,14 +223,14 @@ macro_rules! extension_trait {
|
|
|
|
|
#[allow(dead_code)]
|
|
|
|
|
mod owned {
|
|
|
|
|
#[doc(hidden)]
|
|
|
|
|
pub struct ImplFuture<T>(std::marker::PhantomData<T>);
|
|
|
|
|
pub struct ImplFuture<T>(core::marker::PhantomData<T>);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// A fake `impl Future` type that borrows its environment.
|
|
|
|
|
#[allow(dead_code)]
|
|
|
|
|
mod borrowed {
|
|
|
|
|
#[doc(hidden)]
|
|
|
|
|
pub struct ImplFuture<'a, T>(std::marker::PhantomData<&'a T>);
|
|
|
|
|
pub struct ImplFuture<'a, T>(core::marker::PhantomData<&'a T>);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Render a fake trait combining the bodies of the base trait and the extension trait.
|
|
|
|
|