Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/test-utils/src/minicore.rs')
-rw-r--r--crates/test-utils/src/minicore.rs32
1 files changed, 30 insertions, 2 deletions
diff --git a/crates/test-utils/src/minicore.rs b/crates/test-utils/src/minicore.rs
index 696928b522..d5905afc38 100644
--- a/crates/test-utils/src/minicore.rs
+++ b/crates/test-utils/src/minicore.rs
@@ -68,6 +68,7 @@
//! transmute:
//! try: infallible
//! tuple:
+//! unary_ops:
//! unpin: sized
//! unsize: sized
//! write: fmt
@@ -591,13 +592,13 @@ pub mod ops {
impl<T: PointeeSized> Deref for &T {
type Target = T;
fn deref(&self) -> &T {
- loop {}
+ *self
}
}
impl<T: PointeeSized> Deref for &mut T {
type Target = T;
fn deref(&self) -> &T {
- loop {}
+ *self
}
}
// region:deref_mut
@@ -1056,6 +1057,9 @@ pub mod ops {
type Output = $t;
fn add(self, other: $t) -> $t { self + other }
}
+ impl AddAssign for $t {
+ fn add_assign(&mut self, other: $t) { *self += other; }
+ }
)*)
}
@@ -1063,6 +1067,24 @@ pub mod ops {
// endregion:builtin_impls
// endregion:add
+ // region:unary_ops
+ #[lang = "not"]
+ pub const trait Not {
+ type Output;
+
+ #[must_use]
+ fn not(self) -> Self::Output;
+ }
+
+ #[lang = "neg"]
+ pub const trait Neg {
+ type Output;
+
+ #[must_use = "this returns the result of the operation, without modifying the original"]
+ fn neg(self) -> Self::Output;
+ }
+ // endregion:unary_ops
+
// region:coroutine
mod coroutine {
use crate::pin::Pin;
@@ -1118,6 +1140,12 @@ pub mod cmp {
pub trait Eq: PartialEq<Self> + PointeeSized {}
+ // region:builtin_impls
+ impl PartialEq for () {
+ fn eq(&self, other: &()) -> bool { true }
+ }
+ // endregion:builtin_impls
+
// region:derive
#[rustc_builtin_macro]
pub macro PartialEq($item:item) {}