1 use expect_test::expect;
3 use super::{check_infer, check_no_mismatches, check_types};
14 10..37 '{ ... {}; }': ()
16 24..34 'if true {}': ()
24 fn no_panic_on_field_of_enum() {
35 25..46 '{ ...eld; }': ()
37 31..43 'x.some_field': {unknown}
55 10..88 '{ ... } }': ()
56 16..20 'X {}': {unknown}
57 26..86 'match ... }': ()
59 44..51 'A::B {}': {unknown}
61 67..73 'A::Y()': {unknown}
77 10..40 '{ ...+ y; }': ()
97 10..47 '{ ...&y]; }': ()
99 24..31 'unknown': {unknown}
100 37..44 '[y, &y]': [{unknown}; 2]
101 38..39 'y': {unknown}
102 41..43 '&y': &{unknown}
103 42..43 'y': {unknown}
109 fn recursive_vars_2() {
119 10..79 '{ ...x)]; }': ()
120 20..21 'x': &{unknown}
121 24..31 'unknown': &{unknown}
122 41..42 'y': {unknown}
123 45..52 'unknown': {unknown}
124 58..76 '[(x, y..., &x)]': [(&{unknown}, {unknown}); 2]
125 59..65 '(x, y)': (&{unknown}, {unknown})
126 60..61 'x': &{unknown}
127 63..64 'y': {unknown}
128 67..75 '(&y, &x)': (&{unknown}, {unknown})
129 68..70 '&y': &{unknown}
130 69..70 'y': {unknown}
131 72..74 '&x': &&{unknown}
132 73..74 'x': &{unknown}
138 fn array_elements_expected_type() {
142 let x: [[u32; 2]; 2] = [[1, 2], [3, 4]];
149 fn infer_std_crash_1() {
150 // caused stack overflow, taken from std
159 match something_unknown {
160 Maybe::Real(ref mut something) => (),
165 53..138 '{ ... } }': ()
166 59..136 'match ... }': ()
167 65..82 'someth...nknown': Maybe<{unknown}>
168 93..123 'Maybe:...thing)': Maybe<{unknown}>
169 105..122 'ref mu...ething': &mut {unknown}
176 fn infer_std_crash_2() {
177 // caused "equating two type variables, ...", taken from std
180 fn test_line_buffer() {
181 &[0, b'\n', 1, b'\n'];
185 22..52 '{ ...n']; }': ()
186 28..49 '&[0, b...b'\n']': &[u8; 4]
187 29..49 '[0, b'...b'\n']': [u8; 4]
197 fn infer_std_crash_3() {
203 SizeSkeleton::Pointer { non_zero: true, tail } => {}
208 17..107 '{ ... } }': ()
209 23..105 'match ... }': ()
210 29..36 'nope!()': {unknown}
211 47..93 'SizeSk...tail }': {unknown}
214 87..91 'tail': {unknown}
221 fn infer_std_crash_4() {
225 pub fn primitive_type() {
227 BorrowedRef { type_: Primitive(p), ..} => {},
232 24..105 '{ ... } }': ()
233 30..103 'match ... }': ()
234 36..41 '*self': {unknown}
235 37..41 'self': {unknown}
236 52..90 'Borrow...), ..}': {unknown}
237 73..85 'Primitive(p)': {unknown}
238 83..84 'p': {unknown}
245 fn infer_std_crash_5() {
249 fn extra_compiler_flags() {
250 for content in doesnt_matter {
251 let name = if doesnt_matter {
257 let content = if ICE_REPORT_COMPILER_FLAGS_STRIP_VALUE.contains(&name) {
266 26..322 '{ ... } }': ()
267 32..320 'for co... }': ()
268 36..43 'content': {unknown}
269 47..60 'doesnt_matter': {unknown}
270 61..320 '{ ... }': ()
271 75..79 'name': &{unknown}
272 82..166 'if doe... }': &{unknown}
273 85..98 'doesnt_matter': bool
274 99..128 '{ ... }': &{unknown}
275 113..118 'first': &{unknown}
276 134..166 '{ ... }': &{unknown}
277 148..156 '&content': &{unknown}
278 149..156 'content': {unknown}
279 181..188 'content': &{unknown}
280 191..313 'if ICE... }': &{unknown}
281 194..231 'ICE_RE..._VALUE': {unknown}
282 194..247 'ICE_RE...&name)': bool
283 241..246 '&name': &&{unknown}
284 242..246 'name': &{unknown}
285 248..276 '{ ... }': &{unknown}
286 262..266 'name': &{unknown}
287 282..313 '{ ... }': {unknown}
288 296..303 'content': {unknown}
294 fn infer_nested_generics_crash() {
295 // another crash found typechecking rustc
298 struct Canonical<V> {
301 struct QueryResponse<V> {
304 fn test<R>(query_response: Canonical<QueryResponse<R>>) {
305 &query_response.value;
309 91..105 'query_response': Canonical<QueryResponse<R>>
310 136..166 '{ ...lue; }': ()
311 142..163 '&query....value': &QueryResponse<R>
312 143..157 'query_response': Canonical<QueryResponse<R>>
313 143..163 'query_....value': QueryResponse<R>
319 fn infer_paren_macro_call() {
322 macro_rules! bar { () => {0u32} }
329 44..69 '{ ...()); }': ()
336 fn infer_array_macro_call() {
339 macro_rules! bar { () => {0u32} }
346 44..69 '{ ...()]; }': ()
348 58..66 '[bar!()]': [u32; 1]
357 struct HashSet<T, H>;
359 type FxHashSet<T> = HashSet<T, FxHasher>;
361 impl<T, H> HashSet<T, H> {
362 fn default() -> HashSet<T, H> {}
366 FxHashSet::default();
370 143..145 '{}': HashSet<T, H>
371 168..197 '{ ...t(); }': ()
372 174..192 'FxHash...efault': fn default<{unknown}, FxHasher>() -> HashSet<{unknown}, FxHasher>
373 174..194 'FxHash...ault()': HashSet<{unknown}, FxHasher>
384 struct Response<T> {}
390 impl<T:A> D for Response<T> {
400 119..214 '{ ... }': ()
401 129..132 'end': fn end<{unknown}>()
403 163..208 '{ ... }': ()
405 190..197 'loop {}': !
421 25..52 '{ ...oo() }': ()
422 31..48 '<Trait...>::foo': {unknown}
423 31..50 '<Trait...:foo()': ()
429 fn issue_2683_chars_impl() {
432 //- minicore: iterator
433 pub struct Chars<'a> {}
434 impl<'a> Iterator for Chars<'a> {
436 fn next(&mut self) -> Option<char> { loop {} }
440 let chars: Chars<'_>;
441 (chars.next(), chars.nth(1));
442 } //^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (Option<char>, Option<char>)
448 fn issue_3999_slice() {
451 fn foo(params: &[usize]) {
458 7..13 'params': &[usize]
459 25..80 '{ ... } }': ()
460 31..78 'match ... }': ()
461 37..43 'params': &[usize]
462 54..66 '[ps @ .., _]': [usize]
463 55..62 'ps @ ..': &[usize]
472 fn issue_3999_struct() {
473 // rust-analyzer should not panic on seeing this malformed
488 43..95 '{ ... } }': ()
489 49..93 'match ... }': ()
491 67..80 'Bar { a: .. }': Bar
499 fn issue_4235_name_conflicts() {
503 static FOO:FOO = FOO {};
518 85..119 '{ ...o(); }': ()
523 109..116 'a.foo()': ()
529 fn issue_4465_dollar_crate_at_type() {
533 pub fn anything<T>() -> T {
538 let r: $crate::Foo = anything();
547 44..59 '{ loop {} }': T
550 !0..31 '{letr:...g();r}': Foo
552 !18..26 'anything': fn anything<Foo>() -> Foo
553 !18..28 'anything()': Foo
555 163..187 '{ ...!(); }': ()
565 macro_rules! profile_function {
576 !0..16 'let_a=...t_b=1;': ()
581 103..131 '{ ...!(); }': ()
587 fn issue_4053_diesel_where_clauses() {
592 fn internal_into_boxed(self) -> Self::Output;
595 struct SelectStatement<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Locking> {
599 trait QueryFragment<DB: Backend> {}
601 trait Into<T> { fn into(self) -> T; }
603 impl<F, S, D, W, O, LOf, DB> BoxedDsl<DB>
604 for SelectStatement<F, S, D, W, O, LOf, G>
606 O: Into<dyn QueryFragment<DB>>,
610 fn internal_into_boxed(self) -> Self::Output {
617 267..271 'self': Self
618 466..470 'self': SelectStatement<F, S, D, W, O, LOf, {unknown}, {unknown}>
619 488..522 '{ ... }': ()
620 498..502 'self': SelectStatement<F, S, D, W, O, LOf, {unknown}, {unknown}>
621 498..508 'self.order': O
622 498..515 'self.o...into()': dyn QueryFragment<DB>
631 pub struct Foo(pub i64);
633 fn test() -> Self { Self(0i64) }
637 58..72 '{ Self(0i64) }': Foo
638 60..64 'Self': Foo(i64) -> Foo
639 60..70 'Self(0i64)': Foo
645 pub struct Foo<T>(pub T);
647 fn test() -> Self { Self(0i64) }
651 64..78 '{ Self(0i64) }': Foo<i64>
652 66..70 'Self': Foo<i64>(i64) -> Foo<i64>
653 66..76 'Self(0i64)': Foo<i64>
667 trait CheckedDiv: Div<()> {}
669 trait PrimInt: CheckedDiv<Output = ()> {
673 fn check<T: PrimInt>(i: T) {
678 117..121 'self': Self
680 154..170 '{ ...w(); }': ()
682 160..167 'i.pow()': ()
691 //- minicore: coerce_unsized, future
692 use core::future::Future;
696 fn foo<R, K>(key: &K) -> impl Future<Output = K::Bar>
702 fn bar<R, K>(key: &K) -> impl Future<Output = K::Bar>
710 132..148 '{ ...key) }': impl Future<Output = <K as Foo<R>>::Bar>
711 138..141 'bar': fn bar<R, K>(&K) -> impl Future<Output = <K as Foo<R>>::Bar>
712 138..146 'bar(key)': impl Future<Output = <K as Foo<R>>::Bar>
728 type E1<T> = (T, T, T);
729 type E2<T> = E1<E1<E1<(T, T, T)>>>;
731 impl Debug for Foo<E2<()>> {}
739 pub struct PeerSet<D>;
741 impl<D> Service<Request> for PeerSet<D>
747 type Future = dyn Future<Output = Self::Error>;
749 fn call(&mut self) -> Self::Future {
758 pub trait Service<Request> {
760 type Future: Future<Output = Self::Error>;
761 fn call(&mut self) -> Self::Future;
765 379..383 'self': &mut PeerSet<D>
766 401..424 '{ ... }': dyn Future<Output = ()>
767 411..418 'loop {}': !
769 575..579 'self': &mut Self
779 pub trait IntoIterator {
783 struct Repeat<A> { element: A }
785 struct Map<F> { f: F }
789 impl<T> core::ops::Deref for Vec<T> {
793 fn from_iter<A, T: IntoIterator<Item = A>>(iter: T) -> Vec<A> {}
796 let inner = Map { f: |_: &f64| 0.0 };
798 let repeat = Repeat { element: inner };
800 let vec = from_iter(repeat);
807 244..246 '{}': Vec<A>
808 258..402 '{ ...r(); }': ()
809 268..273 'inner': Map<|&f64| -> f64>
810 276..300 'Map { ... 0.0 }': Map<|&f64| -> f64>
811 285..298 '|_: &f64| 0.0': |&f64| -> f64
814 311..317 'repeat': Repeat<Map<|&f64| -> f64>>
815 320..345 'Repeat...nner }': Repeat<Map<|&f64| -> f64>>
816 338..343 'inner': Map<|&f64| -> f64>
817 356..359 'vec': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>>
818 362..371 'from_iter': fn from_iter<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>, Repeat<Map<|&f64| -> f64>>>(Repeat<Map<|&f64| -> f64>>) -> Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>>
819 362..379 'from_i...epeat)': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>>
820 372..378 'repeat': Repeat<Map<|&f64| -> f64>>
821 386..389 'vec': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>>
822 386..399 'vec.foo_bar()': {unknown}
834 fn f(&self, _t: T) {}
835 fn g<F: FnOnce(&T)>(&self, _f: F) {}
850 109..160 '{ ...10); }': ()
852 123..124 'S': S<i32>() -> S<i32>
853 123..126 'S()': S<i32>
855 132..144 's.g(|_x| {})': ()
856 136..143 '|_x| {}': |&i32| -> ()
860 150..157 's.f(10)': ()
871 use core::ops::Deref;
876 struct MutexGuard<'a, T> {}
878 fn lock(&self) -> MutexGuard<'_, T> {}
880 impl<'a, T: 'a> Deref for MutexGuard<'a, T> {
884 let w: &Mutex<BufWriter>;
889 123..127 'self': &Mutex<T>
890 150..152 '{}': MutexGuard<T>
891 234..238 'self': &{unknown}
892 240..290 '{ ...()); }': ()
893 250..251 'w': &Mutex<BufWriter>
894 276..287 '*(w.lock())': BufWriter
895 278..279 'w': &Mutex<BufWriter>
896 278..286 'w.lock()': MutexGuard<BufWriter>
902 fn param_overrides_fn() {
905 fn example(example: i32) {
915 fn lifetime_from_chalk_during_deref() {
919 struct Box<T: ?Sized> {}
920 impl<T: ?Sized> core::ops::Deref for Box<T> {
923 fn deref(&self) -> &Self::Target {
932 pub struct Iter<'a, T: 'a> {
933 inner: Box<dyn IterTrait<'a, T, Item = &'a T> + 'a>,
936 trait IterTrait<'a, T: 'a>: Iterator<Item = &'a T> {
940 fn clone_iter<T>(s: Iter<T>) {
942 //^^^^^^^^^^^^^^^^^^^ ()
952 pub trait Try: FromResidual {
956 pub trait FromResidual<R = <Self as Try>::Residual> {
957 fn from_residual(residual: R) -> Self;
960 struct ControlFlow<B, C>;
961 impl<B, C> Try for ControlFlow<B, C> {
963 type Residual = ControlFlow<B, !>;
965 impl<B, C> FromResidual for ControlFlow<B, C> {
966 fn from_residual(r: ControlFlow<B, !>) -> Self { ControlFlow }
970 ControlFlow::from_residual(ControlFlow::<u32, !>);
974 144..152 'residual': R
975 365..366 'r': ControlFlow<B, !>
976 395..410 '{ ControlFlow }': ControlFlow<B, C>
977 397..408 'ControlFlow': ControlFlow<B, C>
978 424..482 '{ ...!>); }': ()
979 430..456 'Contro...sidual': fn from_residual<ControlFlow<u32, {unknown}>, ControlFlow<u32, !>>(ControlFlow<u32, !>) -> ControlFlow<u32, {unknown}>
980 430..479 'Contro...2, !>)': ControlFlow<u32, {unknown}>
981 457..478 'Contro...32, !>': ControlFlow<u32, !>
988 // https://github.com/rust-lang/rust-analyzer/issues/8378
1003 fn no_normal_tail(){
1008 fn no_actual_tail(){
1015 14..53 '{ ...)] 9 }': ()
1016 20..31 '{ "first" }': ()
1017 22..29 '"first"': &str
1018 72..190 '{ ...] 13 }': ()
1019 78..88 '{ "fake" }': &str
1020 80..86 '"fake"': &str
1021 93..103 '{ "fake" }': &str
1022 95..101 '"fake"': &str
1023 108..120 '{ "second" }': ()
1024 110..118 '"second"': &str
1025 210..273 '{ ... 15; }': ()
1026 216..227 '{ "third" }': ()
1027 218..225 '"third"': &str
1028 293..357 '{ ...] 15 }': ()
1029 299..311 '{ "fourth" }': &str
1030 301..309 '"fourth"': &str
1036 fn impl_trait_in_option_9530() {
1042 fn unwrap(self) -> T { loop {} }
1044 fn make() -> Option<impl Copy> { Option }
1049 //^^^^^^^^^^ impl Copy
1056 fn bare_dyn_trait_binders_9639() {
1057 check_no_mismatches(
1059 //- minicore: fn, coerce_unsized
1060 fn infix_parse<T, S>(_state: S, _level_code: &Fn(S)) -> T {
1065 infix_parse((), &(|_recurse| ()))
1072 fn call_expected_type_closure() {
1075 //- minicore: fn, option
1077 fn map<T, U>(o: Option<T>, f: impl FnOnce(T) -> U) -> Option<U> { loop {} }
1083 let o = Some(S { field: 2 });
1084 let _: Option<()> = map(o, |s| { s.field; });
1092 fn coerce_diesel_panic() {
1093 check_no_mismatches(
1095 //- minicore: option
1097 trait TypeMetadata {
1098 type MetadataLookup;
1101 pub struct Output<'a, T, DB>
1104 DB::MetadataLookup: 'a,
1107 metadata_lookup: Option<&'a DB::MetadataLookup>,
1110 impl<'a, T, DB: TypeMetadata> Output<'a, T, DB> {
1111 pub fn new(out: T, metadata_lookup: &'a DB::MetadataLookup) -> Self {
1114 metadata_lookup: Some(metadata_lookup),
1123 fn bitslice_panic() {
1124 check_no_mismatches(
1126 //- minicore: option, deref
1134 pub struct BitArray<V: BitView> { }
1136 pub struct BitSlice<T> { }
1138 impl<V: BitView> core::ops::Deref for BitArray<V> {
1139 type Target = BitSlice<V::Store>;
1142 impl<T> BitSlice<T> {
1143 pub fn split_first(&self) -> Option<(T, &Self)> { loop {} }
1146 fn multiexp_inner() {
1147 let exp: &BitArray<Foo>;
1155 fn macro_expands_to_impl_trait() {
1156 check_no_mismatches(
1176 fn nested_macro_in_fn_params() {
1177 check_no_mismatches(
1179 macro_rules! U32Inner {
1191 fn mamba(a: U32!(), p: u32) -> u32 {
1199 fn for_loop_block_expr_iterable() {
1203 for _ in { let x = 0; } {
1209 10..68 '{ ... } }': ()
1210 16..66 'for _ ... }': ()
1211 20..21 '_': {unknown}
1212 25..39 '{ let x = 0; }': ()
1215 40..66 '{ ... }': ()
1223 fn while_loop_block_expr_iterable() {
1233 10..59 '{ ... } }': ()
1234 16..57 'while ... }': ()
1235 22..30 '{ true }': bool
1237 31..57 '{ ... }': ()
1246 // FIXME: wrong, should be u32
1251 A: IntoIterator<Item = u32>,
1252 B: IntoIterator<Item = usize>,
1254 let _x: <A as IntoIterator>::Item;
1258 pub trait Iterator {
1262 pub trait IntoIterator {
1264 type IntoIter: Iterator<Item = Self::Item>;
1267 impl<I: Iterator> IntoIterator for I {
1268 type Item = I::Item;
1277 check_no_mismatches(
1279 struct LinkArray<const N: usize, LD>(LD);
1280 fn f<const N: usize, LD>(x: LD) -> LinkArray<N, LD> {
1281 let r = LinkArray::<N, LD>(x);
1286 let x = f::<2, i32>(5);
1287 let y = LinkArray::<52, LinkArray<2, i32>>(x);
1291 check_no_mismatches(
1293 struct LinkArray<LD, const N: usize>(LD);
1294 fn f<const N: usize, LD>(x: LD) -> LinkArray<LD, N> {
1295 let r = LinkArray::<LD, N>(x);
1300 let x = f::<i32, 2>(5);
1301 let y = LinkArray::<LinkArray<i32, 2>, 52>(x);
1308 fn const_generic_error_tolerance() {
1309 check_no_mismatches(
1314 struct CT<const N: usize, T>(T);
1315 struct TC<T, const N: usize>(T);
1316 fn f<const N: usize, T>(x: T) -> (CT<N, T>, TC<T, N>) {
1317 let l = CT::<N, T>(x);
1318 let r = TC::<N, T>(x);
1322 trait TR1<const N: usize>;
1323 trait TR2<const N: usize>;
1325 impl<const N: usize, T> TR1<N> for CT<N, T>;
1326 impl<const N: usize, T> TR1<5> for TC<T, N>;
1327 impl<const N: usize, T> TR2<N> for CT<T, N>;
1329 trait TR3<const N: usize> {
1330 fn tr3(&self) -> &Self;
1333 impl<const N: usize, T> TR3<5> for TC<T, N> {
1334 fn tr3(&self) -> &Self {
1339 impl<const N: usize, T> TR3<Item = 5> for TC<T, N> {}
1340 impl<const N: usize, T> TR3<T> for TC<T, N> {}
1342 fn impl_trait<const N: usize>(inp: impl TR1<N>) {}
1343 fn dyn_trait<const N: usize>(inp: &dyn TR2<N>) {}
1344 fn impl_trait_bad<'a, const N: usize>(inp: impl TR1<i32>) -> impl TR1<'a, i32> {}
1345 fn impl_trait_very_bad<const N: usize>(inp: impl TR1<Item = i32>) -> impl TR1<'a, Item = i32, 5, Foo = N> {}
1352 CT::<52, CT<2, i32>>(x);
1353 CT::<CT<2, i32>>(x);
1357 TR3<{ 2+3 }>::tr3();
1358 TC::<i32, 10>(5).tr3();
1359 TC::<i32, 20>(5).tr3();
1360 TC::<i32, i32>(5).tr3();
1361 TC::<i32, { 7 + 3 }>(5).tr3();
1368 fn const_generic_impl_trait() {
1369 check_no_mismatches(
1373 struct Foo<T, const M: usize>;
1379 impl<T, const M: usize> Tr<[T; M]> for Foo<T, M> {
1380 fn f(_: [T; M]) -> Self {
1386 Foo::f([1, 2, 7, 10]);
1393 fn nalgebra_factorial() {
1394 check_no_mismatches(
1396 const FACTORIAL: [u128; 4] = [1, 1, 2, 6];
1398 fn factorial(n: usize) -> u128 {
1399 match FACTORIAL.get(n) {
1401 None => panic!("{}! is greater than u128::MAX", n),
1409 fn regression_11688_1() {
1410 check_no_mismatches(
1412 pub struct Buffer<T>(T);
1413 type Writer = Buffer<u8>;
1415 fn extend_from_array<const N: usize>(&mut self, xs: &[T; N]) {
1420 fn encode(self, w: &mut Writer, s: &mut S);
1422 impl<S> Encode<S> for u8 {
1423 fn encode(self, w: &mut Writer, _: &mut S) {
1424 w.extend_from_array(&self.to_le_bytes());
1432 fn regression_11688_2() {
1435 union MaybeUninit<T> {
1440 impl<T> MaybeUninit<T> {
1441 fn uninit_array<const LEN: usize>() -> [Self; LEN] {
1447 let x = MaybeUninit::<i32>::uninit_array::<1>();
1448 //^ [MaybeUninit<i32>; 1]
1455 fn regression_11688_3() {
1458 //- minicore: iterator
1459 struct Ar<T, const N: u8>(T);
1460 fn f<const LEN: usize, T, const BASE: u8>(
1462 ) -> dyn Iterator<Item = [Ar<T, BASE>; LEN]> {
1465 fn dynamic_programming() {
1466 for board in f::<9, u8, 7>(1) {
1467 //^^^^^ [Ar<u8, 7>; 9]
1475 fn regression_11688_4() {
1478 trait Bar<const C: usize> {
1479 fn baz(&self) -> [i32; C];
1482 fn foo(x: &dyn Bar<2>) {
1492 cov_mark::check!(ignore_gats);
1493 check_no_mismatches(
1498 type Member<const N: usize>: ATrait;
1499 fn new<const N: usize>() -> Self::Member<N>;
1502 fn test<T: Crash>() {
1511 check_no_mismatches(
1513 pub struct InlineStorage {}
1515 pub struct InlineStorageHandle<T: ?Sized> {}
1517 pub unsafe trait Storage {
1518 type Handle<T: ?Sized>;
1519 fn create<T: ?Sized>() -> Self::Handle<T>;
1522 unsafe impl Storage for InlineStorage {
1523 type Handle<T: ?Sized> = InlineStorageHandle<T>;
1530 fn cfgd_out_self_param() {
1531 cov_mark::check!(cfgd_out_self_param);
1532 check_no_mismatches(
1536 fn f(#[cfg(never)] &self) {}
1547 fn rust_161_option_clone() {
1550 //- minicore: option, drop
1552 fn test(o: &Option<i32>) {
1554 //^^^^^^^^^^^^ Option<i32>
1557 pub trait MyClone: Sized {
1558 fn my_clone(&self) -> Self;
1561 impl<T> const MyClone for Option<T>
1563 T: ~const MyClone + ~const Drop + ~const Destruct,
1565 fn my_clone(&self) -> Self {
1567 Some(x) => Some(x.my_clone()),
1573 impl const MyClone for i32 {
1574 fn my_clone(&self) -> Self {
1579 pub trait Destruct {}
1581 impl<T: ?Sized> const Destruct for T {}
1587 fn rust_162_option_clone() {
1590 //- minicore: option, drop
1592 fn test(o: &Option<i32>) {
1594 //^^^^^^^^^^^^ Option<i32>
1597 pub trait MyClone: Sized {
1598 fn my_clone(&self) -> Self;
1601 impl<T> const MyClone for Option<T>
1603 T: ~const MyClone + ~const Destruct,
1605 fn my_clone(&self) -> Self {
1607 Some(x) => Some(x.my_clone()),
1613 impl const MyClone for i32 {
1614 fn my_clone(&self) -> Self {
1619 #[lang = "destruct"]
1620 pub trait Destruct {}
1626 fn tuple_struct_pattern_with_unmatched_args_crash() {
1631 let S(.., a, b) = S(1);
1632 let (.., a, b) = (1,);
1636 27..85 '{ ...1,); }': ()
1637 37..48 'S(.., a, b)': S
1639 46..47 'b': {unknown}
1640 51..52 'S': S(usize) -> S
1643 65..75 '(.., a, b)': (i32, {unknown})
1645 73..74 'b': {unknown}
1646 78..82 '(1,)': (i32,)