diff options
| author | Laurențiu Nicola <lnicola@dend.ro> | 2023-03-13 10:42:24 +0200 |
|---|---|---|
| committer | Laurențiu Nicola <lnicola@dend.ro> | 2023-03-13 10:42:24 +0200 |
| commit | b2f6fd4f961fc7e4fbfdb80cae2e6065f8436f15 (patch) | |
| tree | bcdfaabb2821bb74ce6313de7e2741e4625bf74b /crates/test-utils | |
| parent | 15b867b5db35d67e0f1026b55f22ba6b25ad6dcb (diff) | |
| download | rust-b2f6fd4f961fc7e4fbfdb80cae2e6065f8436f15.tar.gz rust-b2f6fd4f961fc7e4fbfdb80cae2e6065f8436f15.zip | |
:arrow_up: rust-analyzer
Diffstat (limited to 'crates/test-utils')
| -rw-r--r-- | crates/test-utils/src/fixture.rs | 4 | ||||
| -rw-r--r-- | crates/test-utils/src/minicore.rs | 49 |
2 files changed, 52 insertions, 1 deletions
diff --git a/crates/test-utils/src/fixture.rs b/crates/test-utils/src/fixture.rs index d1afd0039aa..cd1235fa6dc 100644 --- a/crates/test-utils/src/fixture.rs +++ b/crates/test-utils/src/fixture.rs @@ -180,7 +180,9 @@ impl Fixture { let mut cfg_key_values = Vec::new(); let mut env = FxHashMap::default(); let mut introduce_new_source_root = None; - let mut target_data_layout = None; + let mut target_data_layout = Some( + "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128".to_string(), + ); for component in components[1..].iter() { let (key, value) = component.split_once(':').unwrap_or_else(|| panic!("invalid meta line: {meta:?}")); diff --git a/crates/test-utils/src/minicore.rs b/crates/test-utils/src/minicore.rs index 3b033e1aae5..93ff76a040c 100644 --- a/crates/test-utils/src/minicore.rs +++ b/crates/test-utils/src/minicore.rs @@ -510,6 +510,7 @@ pub mod fmt { pub mod slice { #[lang = "slice"] impl<T> [T] { + #[lang = "slice_len_fn"] pub fn len(&self) -> usize { loop {} } @@ -533,6 +534,40 @@ pub mod option { None => panic!("called `Option::unwrap()` on a `None` value"), } } + + pub fn and<U>(self, optb: Option<U>) -> Option<U> { + loop {} + } + pub fn unwrap_or(self, default: T) -> T { + loop {} + } + // region:fn + pub fn and_then<U, F>(self, f: F) -> Option<U> + where + F: FnOnce(T) -> Option<U>, + { + loop {} + } + pub fn unwrap_or_else<F>(self, f: F) -> T + where + F: FnOnce() -> T, + { + loop {} + } + pub fn map_or<U, F>(self, default: U, f: F) -> U + where + F: FnOnce(T) -> U, + { + loop {} + } + pub fn map_or_else<U, D, F>(self, default: D, f: F) -> U + where + D: FnOnce() -> U, + F: FnOnce(T) -> U, + { + loop {} + } + // endregion:fn } } // endregion:option @@ -727,6 +762,20 @@ pub mod iter { self } } + pub struct IntoIter<T, const N: usize>([T; N]); + impl<T, const N: usize> IntoIterator for [T; N] { + type Item = T; + type IntoIter = IntoIter<T, N>; + fn into_iter(self) -> I { + IntoIter(self) + } + } + impl<T, const N: usize> Iterator for IntoIter<T, N> { + type Item = T; + fn next(&mut self) -> Option<T> { + loop {} + } + } } pub use self::collect::IntoIterator; } |
