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 {
580 103..131 '{ ...!(); }': ()
586 fn issue_4053_diesel_where_clauses() {
591 fn internal_into_boxed(self) -> Self::Output;
594 struct SelectStatement<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Locking> {
598 trait QueryFragment<DB: Backend> {}
600 trait Into<T> { fn into(self) -> T; }
602 impl<F, S, D, W, O, LOf, DB> BoxedDsl<DB>
603 for SelectStatement<F, S, D, W, O, LOf, G>
605 O: Into<dyn QueryFragment<DB>>,
609 fn internal_into_boxed(self) -> Self::Output {
616 267..271 'self': Self
617 466..470 'self': SelectStatement<F, S, D, W, O, LOf, {unknown}, {unknown}>
618 488..522 '{ ... }': ()
619 498..502 'self': SelectStatement<F, S, D, W, O, LOf, {unknown}, {unknown}>
620 498..508 'self.order': O
621 498..515 'self.o...into()': dyn QueryFragment<DB>
630 pub struct Foo(pub i64);
632 fn test() -> Self { Self(0i64) }
636 58..72 '{ Self(0i64) }': Foo
637 60..64 'Self': Foo(i64) -> Foo
638 60..70 'Self(0i64)': Foo
644 pub struct Foo<T>(pub T);
646 fn test() -> Self { Self(0i64) }
650 64..78 '{ Self(0i64) }': Foo<i64>
651 66..70 'Self': Foo<i64>(i64) -> Foo<i64>
652 66..76 'Self(0i64)': Foo<i64>
666 trait CheckedDiv: Div<()> {}
668 trait PrimInt: CheckedDiv<Output = ()> {
672 fn check<T: PrimInt>(i: T) {
677 117..121 'self': Self
679 154..170 '{ ...w(); }': ()
681 160..167 'i.pow()': ()
690 //- minicore: coerce_unsized, future
691 use core::future::Future;
695 fn foo<R, K>(key: &K) -> impl Future<Output = K::Bar>
701 fn bar<R, K>(key: &K) -> impl Future<Output = K::Bar>
709 132..148 '{ ...key) }': impl Future<Output = <K as Foo<R>>::Bar>
710 138..141 'bar': fn bar<R, K>(&K) -> impl Future<Output = <K as Foo<R>>::Bar>
711 138..146 'bar(key)': impl Future<Output = <K as Foo<R>>::Bar>
727 type E1<T> = (T, T, T);
728 type E2<T> = E1<E1<E1<(T, T, T)>>>;
730 impl Debug for Foo<E2<()>> {}
738 pub struct PeerSet<D>;
740 impl<D> Service<Request> for PeerSet<D>
746 type Future = dyn Future<Output = Self::Error>;
748 fn call(&mut self) -> Self::Future {
757 pub trait Service<Request> {
759 type Future: Future<Output = Self::Error>;
760 fn call(&mut self) -> Self::Future;
764 379..383 'self': &mut PeerSet<D>
765 401..424 '{ ... }': dyn Future<Output = ()>
766 411..418 'loop {}': !
768 575..579 'self': &mut Self
778 pub trait IntoIterator {
782 struct Repeat<A> { element: A }
784 struct Map<F> { f: F }
788 impl<T> core::ops::Deref for Vec<T> {
792 fn from_iter<A, T: IntoIterator<Item = A>>(iter: T) -> Vec<A> {}
795 let inner = Map { f: |_: &f64| 0.0 };
797 let repeat = Repeat { element: inner };
799 let vec = from_iter(repeat);
806 244..246 '{}': Vec<A>
807 258..402 '{ ...r(); }': ()
808 268..273 'inner': Map<|&f64| -> f64>
809 276..300 'Map { ... 0.0 }': Map<|&f64| -> f64>
810 285..298 '|_: &f64| 0.0': |&f64| -> f64
813 311..317 'repeat': Repeat<Map<|&f64| -> f64>>
814 320..345 'Repeat...nner }': Repeat<Map<|&f64| -> f64>>
815 338..343 'inner': Map<|&f64| -> f64>
816 356..359 'vec': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>>
817 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>>>>
818 362..379 'from_i...epeat)': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>>
819 372..378 'repeat': Repeat<Map<|&f64| -> f64>>
820 386..389 'vec': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>>
821 386..399 'vec.foo_bar()': {unknown}
833 fn f(&self, _t: T) {}
834 fn g<F: FnOnce(&T)>(&self, _f: F) {}
849 109..160 '{ ...10); }': ()
851 123..124 'S': S<i32>() -> S<i32>
852 123..126 'S()': S<i32>
854 132..144 's.g(|_x| {})': ()
855 136..143 '|_x| {}': |&i32| -> ()
859 150..157 's.f(10)': ()
870 use core::ops::Deref;
875 struct MutexGuard<'a, T> {}
877 fn lock(&self) -> MutexGuard<'_, T> {}
879 impl<'a, T: 'a> Deref for MutexGuard<'a, T> {
883 let w: &Mutex<BufWriter>;
888 123..127 'self': &Mutex<T>
889 150..152 '{}': MutexGuard<T>
890 234..238 'self': &{unknown}
891 240..290 '{ ...()); }': ()
892 250..251 'w': &Mutex<BufWriter>
893 276..287 '*(w.lock())': BufWriter
894 278..279 'w': &Mutex<BufWriter>
895 278..286 'w.lock()': MutexGuard<BufWriter>
901 fn param_overrides_fn() {
904 fn example(example: i32) {
914 fn lifetime_from_chalk_during_deref() {
918 struct Box<T: ?Sized> {}
919 impl<T: ?Sized> core::ops::Deref for Box<T> {
922 fn deref(&self) -> &Self::Target {
931 pub struct Iter<'a, T: 'a> {
932 inner: Box<dyn IterTrait<'a, T, Item = &'a T> + 'a>,
935 trait IterTrait<'a, T: 'a>: Iterator<Item = &'a T> {
939 fn clone_iter<T>(s: Iter<T>) {
941 //^^^^^^^^^^^^^^^^^^^ ()
951 pub trait Try: FromResidual {
955 pub trait FromResidual<R = <Self as Try>::Residual> {
956 fn from_residual(residual: R) -> Self;
959 struct ControlFlow<B, C>;
960 impl<B, C> Try for ControlFlow<B, C> {
962 type Residual = ControlFlow<B, !>;
964 impl<B, C> FromResidual for ControlFlow<B, C> {
965 fn from_residual(r: ControlFlow<B, !>) -> Self { ControlFlow }
969 ControlFlow::from_residual(ControlFlow::<u32, !>);
973 144..152 'residual': R
974 365..366 'r': ControlFlow<B, !>
975 395..410 '{ ControlFlow }': ControlFlow<B, C>
976 397..408 'ControlFlow': ControlFlow<B, C>
977 424..482 '{ ...!>); }': ()
978 430..456 'Contro...sidual': fn from_residual<ControlFlow<u32, {unknown}>, ControlFlow<u32, !>>(ControlFlow<u32, !>) -> ControlFlow<u32, {unknown}>
979 430..479 'Contro...2, !>)': ControlFlow<u32, {unknown}>
980 457..478 'Contro...32, !>': ControlFlow<u32, !>
987 // https://github.com/rust-lang/rust-analyzer/issues/8378
1002 fn no_normal_tail(){
1007 fn no_actual_tail(){
1014 14..53 '{ ...)] 9 }': ()
1015 20..31 '{ "first" }': ()
1016 22..29 '"first"': &str
1017 72..190 '{ ...] 13 }': ()
1018 78..88 '{ "fake" }': &str
1019 80..86 '"fake"': &str
1020 93..103 '{ "fake" }': &str
1021 95..101 '"fake"': &str
1022 108..120 '{ "second" }': ()
1023 110..118 '"second"': &str
1024 210..273 '{ ... 15; }': ()
1025 216..227 '{ "third" }': ()
1026 218..225 '"third"': &str
1027 293..357 '{ ...] 15 }': ()
1028 299..311 '{ "fourth" }': &str
1029 301..309 '"fourth"': &str
1035 fn impl_trait_in_option_9530() {
1041 fn unwrap(self) -> T { loop {} }
1043 fn make() -> Option<impl Copy> { Option }
1048 //^^^^^^^^^^ impl Copy
1055 fn bare_dyn_trait_binders_9639() {
1056 check_no_mismatches(
1058 //- minicore: fn, coerce_unsized
1059 fn infix_parse<T, S>(_state: S, _level_code: &Fn(S)) -> T {
1064 infix_parse((), &(|_recurse| ()))
1071 fn call_expected_type_closure() {
1074 //- minicore: fn, option
1076 fn map<T, U>(o: Option<T>, f: impl FnOnce(T) -> U) -> Option<U> { loop {} }
1082 let o = Some(S { field: 2 });
1083 let _: Option<()> = map(o, |s| { s.field; });
1091 fn coerce_diesel_panic() {
1092 check_no_mismatches(
1094 //- minicore: option
1096 trait TypeMetadata {
1097 type MetadataLookup;
1100 pub struct Output<'a, T, DB>
1103 DB::MetadataLookup: 'a,
1106 metadata_lookup: Option<&'a DB::MetadataLookup>,
1109 impl<'a, T, DB: TypeMetadata> Output<'a, T, DB> {
1110 pub fn new(out: T, metadata_lookup: &'a DB::MetadataLookup) -> Self {
1113 metadata_lookup: Some(metadata_lookup),
1122 fn bitslice_panic() {
1123 check_no_mismatches(
1125 //- minicore: option, deref
1133 pub struct BitArray<V: BitView> { }
1135 pub struct BitSlice<T> { }
1137 impl<V: BitView> core::ops::Deref for BitArray<V> {
1138 type Target = BitSlice<V::Store>;
1141 impl<T> BitSlice<T> {
1142 pub fn split_first(&self) -> Option<(T, &Self)> { loop {} }
1145 fn multiexp_inner() {
1146 let exp: &BitArray<Foo>;
1154 fn macro_expands_to_impl_trait() {
1155 check_no_mismatches(
1175 fn nested_macro_in_fn_params() {
1176 check_no_mismatches(
1178 macro_rules! U32Inner {
1190 fn mamba(a: U32!(), p: u32) -> u32 {
1198 fn for_loop_block_expr_iterable() {
1202 for _ in { let x = 0; } {
1208 10..68 '{ ... } }': ()
1209 16..66 'for _ ... }': ()
1210 20..21 '_': {unknown}
1211 25..39 '{ let x = 0; }': ()
1214 40..66 '{ ... }': ()
1222 fn while_loop_block_expr_iterable() {
1232 10..59 '{ ... } }': ()
1233 16..57 'while ... }': ()
1234 22..30 '{ true }': bool
1236 31..57 '{ ... }': ()
1245 // FIXME: wrong, should be u32
1250 A: IntoIterator<Item = u32>,
1251 B: IntoIterator<Item = usize>,
1253 let _x: <A as IntoIterator>::Item;
1257 pub trait Iterator {
1261 pub trait IntoIterator {
1263 type IntoIter: Iterator<Item = Self::Item>;
1266 impl<I: Iterator> IntoIterator for I {
1267 type Item = I::Item;
1276 check_no_mismatches(
1278 struct LinkArray<const N: usize, LD>(LD);
1279 fn f<const N: usize, LD>(x: LD) -> LinkArray<N, LD> {
1280 let r = LinkArray::<N, LD>(x);
1285 let x = f::<2, i32>(5);
1286 let y = LinkArray::<52, LinkArray<2, i32>>(x);
1290 check_no_mismatches(
1292 struct LinkArray<LD, const N: usize>(LD);
1293 fn f<const N: usize, LD>(x: LD) -> LinkArray<LD, N> {
1294 let r = LinkArray::<LD, N>(x);
1299 let x = f::<i32, 2>(5);
1300 let y = LinkArray::<LinkArray<i32, 2>, 52>(x);
1307 fn const_generic_error_tolerance() {
1308 check_no_mismatches(
1313 struct CT<const N: usize, T>(T);
1314 struct TC<T, const N: usize>(T);
1315 fn f<const N: usize, T>(x: T) -> (CT<N, T>, TC<T, N>) {
1316 let l = CT::<N, T>(x);
1317 let r = TC::<N, T>(x);
1321 trait TR1<const N: usize>;
1322 trait TR2<const N: usize>;
1324 impl<const N: usize, T> TR1<N> for CT<N, T>;
1325 impl<const N: usize, T> TR1<5> for TC<T, N>;
1326 impl<const N: usize, T> TR2<N> for CT<T, N>;
1328 trait TR3<const N: usize> {
1329 fn tr3(&self) -> &Self;
1332 impl<const N: usize, T> TR3<5> for TC<T, N> {
1333 fn tr3(&self) -> &Self {
1338 impl<const N: usize, T> TR3<Item = 5> for TC<T, N> {}
1339 impl<const N: usize, T> TR3<T> for TC<T, N> {}
1341 fn impl_trait<const N: usize>(inp: impl TR1<N>) {}
1342 fn dyn_trait<const N: usize>(inp: &dyn TR2<N>) {}
1343 fn impl_trait_bad<'a, const N: usize>(inp: impl TR1<i32>) -> impl TR1<'a, i32> {}
1344 fn impl_trait_very_bad<const N: usize>(inp: impl TR1<Item = i32>) -> impl TR1<'a, Item = i32, 5, Foo = N> {}
1351 CT::<52, CT<2, i32>>(x);
1352 CT::<CT<2, i32>>(x);
1356 TR3<{ 2+3 }>::tr3();
1357 TC::<i32, 10>(5).tr3();
1358 TC::<i32, 20>(5).tr3();
1359 TC::<i32, i32>(5).tr3();
1360 TC::<i32, { 7 + 3 }>(5).tr3();
1367 fn const_generic_impl_trait() {
1368 check_no_mismatches(
1372 struct Foo<T, const M: usize>;
1378 impl<T, const M: usize> Tr<[T; M]> for Foo<T, M> {
1379 fn f(_: [T; M]) -> Self {
1385 Foo::f([1, 2, 7, 10]);
1392 fn nalgebra_factorial() {
1393 check_no_mismatches(
1395 const FACTORIAL: [u128; 4] = [1, 1, 2, 6];
1397 fn factorial(n: usize) -> u128 {
1398 match FACTORIAL.get(n) {
1400 None => panic!("{}! is greater than u128::MAX", n),
1408 fn regression_11688_1() {
1409 check_no_mismatches(
1411 pub struct Buffer<T>(T);
1412 type Writer = Buffer<u8>;
1414 fn extend_from_array<const N: usize>(&mut self, xs: &[T; N]) {
1419 fn encode(self, w: &mut Writer, s: &mut S);
1421 impl<S> Encode<S> for u8 {
1422 fn encode(self, w: &mut Writer, _: &mut S) {
1423 w.extend_from_array(&self.to_le_bytes());
1431 fn regression_11688_2() {
1434 union MaybeUninit<T> {
1439 impl<T> MaybeUninit<T> {
1440 fn uninit_array<const LEN: usize>() -> [Self; LEN] {
1446 let x = MaybeUninit::<i32>::uninit_array::<1>();
1447 //^ [MaybeUninit<i32>; 1]
1454 fn regression_11688_3() {
1457 //- minicore: iterator
1458 struct Ar<T, const N: u8>(T);
1459 fn f<const LEN: usize, T, const BASE: u8>(
1461 ) -> dyn Iterator<Item = [Ar<T, BASE>; LEN]> {
1464 fn dynamic_programming() {
1465 for board in f::<9, u8, 7>(1) {
1466 //^^^^^ [Ar<u8, 7>; 9]
1474 fn regression_11688_4() {
1477 trait Bar<const C: usize> {
1478 fn baz(&self) -> [i32; C];
1481 fn foo(x: &dyn Bar<2>) {
1491 check_no_mismatches(
1496 type Member<const N: usize>: ATrait;
1497 fn new<const N: usize>() -> Self::Member<N>;
1500 fn test<T: Crash>() {
1509 check_no_mismatches(
1511 pub struct InlineStorage {}
1513 pub struct InlineStorageHandle<T: ?Sized> {}
1515 pub unsafe trait Storage {
1516 type Handle<T: ?Sized>;
1517 fn create<T: ?Sized>() -> Self::Handle<T>;
1520 unsafe impl Storage for InlineStorage {
1521 type Handle<T: ?Sized> = InlineStorageHandle<T>;
1529 check_no_mismatches(
1533 type Member<T>: Collection<Item = T>;
1534 fn add(&mut self, value: Self::Item) -> Result<(), Self::Error>;
1536 struct ConstGen<T, const N: usize> {
1539 impl<T, const N: usize> Collection for ConstGen<T, N> {
1541 type Member<U> = ConstGen<U, N>;
1548 fn cfgd_out_self_param() {
1549 cov_mark
::check
!(cfgd_out_self_param
);
1550 check_no_mismatches(
1554 fn f(#[cfg(never)] &self) {}
1565 fn rust_161_option_clone() {
1568 //- minicore: option, drop
1570 fn test(o: &Option<i32>) {
1572 //^^^^^^^^^^^^ Option<i32>
1575 pub trait MyClone: Sized {
1576 fn my_clone(&self) -> Self;
1579 impl<T> const MyClone for Option<T>
1581 T: ~const MyClone + ~const Drop + ~const Destruct,
1583 fn my_clone(&self) -> Self {
1585 Some(x) => Some(x.my_clone()),
1591 impl const MyClone for i32 {
1592 fn my_clone(&self) -> Self {
1597 pub trait Destruct {}
1599 impl<T: ?Sized> const Destruct for T {}
1605 fn rust_162_option_clone() {
1608 //- minicore: option, drop
1610 fn test(o: &Option<i32>) {
1612 //^^^^^^^^^^^^ Option<i32>
1615 pub trait MyClone: Sized {
1616 fn my_clone(&self) -> Self;
1619 impl<T> const MyClone for Option<T>
1621 T: ~const MyClone + ~const Destruct,
1623 fn my_clone(&self) -> Self {
1625 Some(x) => Some(x.my_clone()),
1631 impl const MyClone for i32 {
1632 fn my_clone(&self) -> Self {
1637 #[lang = "destruct"]
1638 pub trait Destruct {}
1644 fn tuple_struct_pattern_with_unmatched_args_crash() {
1649 let S(.., a, b) = S(1);
1650 let (.., a, b) = (1,);
1654 27..85 '{ ...1,); }': ()
1655 37..48 'S(.., a, b)': S
1657 46..47 'b': {unknown}
1658 51..52 'S': S(usize) -> S
1661 65..75 '(.., a, b)': (i32, {unknown})
1663 73..74 'b': {unknown}
1664 78..82 '(1,)': (i32,)
1671 fn trailing_empty_macro() {
1672 check_no_mismatches(
1675 ($($t:tt)*) => {$($t)*};
1678 fn macrostmts() -> u8 {
1687 fn dyn_with_unresolved_trait() {
1690 fn foo(a: &dyn DoesNotExist) {
1699 fn self_assoc_with_const_generics_crash() {
1700 check_no_mismatches(
1702 trait Trait { type Item; }
1703 impl<T, const N: usize> Trait for [T; N] {
1705 fn f<U>(_: Self::Item) {}