summaryrefslogtreecommitdiffstats
path: root/src/tools/rust-analyzer/crates/test-utils/src/minicore.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:50 +0000
commit2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35 (patch)
treed325add32978dbdc1db975a438b3a77d571b1ab8 /src/tools/rust-analyzer/crates/test-utils/src/minicore.rs
parentReleasing progress-linux version 1.68.2+dfsg1-1~progress7.99u1. (diff)
downloadrustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.tar.xz
rustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.zip
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/rust-analyzer/crates/test-utils/src/minicore.rs')
-rw-r--r--src/tools/rust-analyzer/crates/test-utils/src/minicore.rs44
1 files changed, 39 insertions, 5 deletions
diff --git a/src/tools/rust-analyzer/crates/test-utils/src/minicore.rs b/src/tools/rust-analyzer/crates/test-utils/src/minicore.rs
index 3ca63fcab..3b033e1aa 100644
--- a/src/tools/rust-analyzer/crates/test-utils/src/minicore.rs
+++ b/src/tools/rust-analyzer/crates/test-utils/src/minicore.rs
@@ -28,6 +28,7 @@
//! generator: pin
//! hash:
//! index: sized
+//! infallible:
//! iterator: option
//! iterators: iterator, fn
//! non_zero:
@@ -40,7 +41,7 @@
//! sized:
//! slice:
//! sync: sized
-//! try:
+//! try: infallible
//! unsize: sized
pub mod marker {
@@ -105,6 +106,11 @@ pub mod marker {
impl<T: ?Sized> Copy for &T {}
}
// endregion:copy
+
+ // region:fn
+ #[lang = "tuple_trait"]
+ pub trait Tuple {}
+ // endregion:fn
}
// region:default
@@ -172,6 +178,9 @@ pub mod convert {
fn as_ref(&self) -> &T;
}
// endregion:as_ref
+ // region:infallible
+ pub enum Infallibe {}
+ // endregion:infallible
}
pub mod ops {
@@ -269,6 +278,24 @@ pub mod ops {
}
}
+ impl<T, I, const N: usize> Index<I> for [T; N]
+ where
+ I: SliceIndex<[T]>,
+ {
+ type Output = I::Output;
+ fn index(&self, index: I) -> &I::Output {
+ loop {}
+ }
+ }
+ impl<T, I, const N: usize> IndexMut<I> for [T; N]
+ where
+ I: SliceIndex<[T]>,
+ {
+ fn index_mut(&mut self, index: I) -> &mut I::Output {
+ loop {}
+ }
+ }
+
pub unsafe trait SliceIndex<T: ?Sized> {
type Output: ?Sized;
}
@@ -325,19 +352,26 @@ pub mod ops {
// region:fn
mod function {
+ use crate::marker::Tuple;
+
#[lang = "fn"]
#[fundamental]
- pub trait Fn<Args>: FnMut<Args> {}
+ pub trait Fn<Args: Tuple>: FnMut<Args> {
+ extern "rust-call" fn call(&self, args: Args) -> Self::Output;
+ }
#[lang = "fn_mut"]
#[fundamental]
- pub trait FnMut<Args>: FnOnce<Args> {}
+ pub trait FnMut<Args: Tuple>: FnOnce<Args> {
+ extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
+ }
#[lang = "fn_once"]
#[fundamental]
- pub trait FnOnce<Args> {
+ pub trait FnOnce<Args: Tuple> {
#[lang = "fn_once_output"]
type Output;
+ extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
}
}
pub use self::function::{Fn, FnMut, FnOnce};
@@ -352,7 +386,7 @@ pub mod ops {
#[lang = "from_residual"]
fn from_residual(residual: R) -> Self;
}
- #[lang = "try"]
+ #[lang = "Try"]
pub trait Try: FromResidual<Self::Residual> {
type Output;
type Residual;