// Copyright 2025 Gabriel Bjørnager Jensen.
//
// This Source Code Form is subject to the terms of
// the Mozilla Public License, v. 2.0. If a copy of
// the MPL was not distributed with this file, you
// can obtain one at:
// <https://mozilla.org/MPL/2.0/>.

macro_rules! def_compat_traits {
	{ $($CompatTrait:ident = $Trait:ty = $feature:literal),*$(,)? } => {$(
		#[cfg(feature = $feature)]
		pub use $Trait as $CompatTrait;

		#[cfg(not(feature = $feature))]
		pub trait $CompatTrait {}

		#[cfg(not(feature = $feature))]
		impl<T> $CompatTrait for T {}
	)*};
}

def_compat_traits! {
	CloneToUninit       = core::clone::CloneToUninit        = "clone_to_uninit",
	ConstParamTy_       = core::marker::ConstParamTy_       = "const_param_ty",
	Freeze              = core::marker::Freeze              = "freeze",
	Step                = core::iter::Step                  = "step",
	StructuralPartialEq = core::marker::StructuralPartialEq = "step",
	Thin                = core::ptr::Thin                   = "thin",
	ToOwned             = alloc::borrow::ToOwned            = "alloc",
	ToString            = alloc::string::ToString           = "alloc",
	TrustedStep         = core::iter::TrustedStep           = "trusted_step",
	UseCloned           = core::clone::UseCloned            = "use_cloned",
}
