#![cfg_attr(feature = "alloc", feature(allocator_api))] use core::convert::Infallible; #[cfg(feature = "alloc")] use std::alloc::AllocError; #[derive(Debug)] pub struct Error; impl From for Error { fn from(e: Infallible) -> Self { match e {} } } #[cfg(feature = "alloc")] impl From for Error { fn from(_: AllocError) -> Self { Self } } fn main() {}