4 use super::{check_infer, check_types};
15 10..37 '{ ... {}; }': ()
17 24..34 'if true {}': ()
25 fn no_panic_on_field_of_enum() {
36 25..46 '{ ...eld; }': ()
38 31..43 'x.some_field': {unknown}
56 10..88 '{ ... } }': ()
57 16..20 'X {}': {unknown}
58 26..86 'match ... }': ()
60 44..51 'A::B {}': {unknown}
62 67..73 'A::Y()': {unknown}
78 10..40 '{ ...+ y; }': ()
90 mark::check!(type_var_cycles_resolve_completely);
91 mark::check!(type_var_cycles_resolve_as_possible);
100 10..47 '{ ...&y]; }': ()
101 20..21 'y': &{unknown}
102 24..31 'unknown': &{unknown}
103 37..44 '[y, &y]': [&&{unknown}; _]
104 38..39 'y': &{unknown}
105 41..43 '&y': &&{unknown}
106 42..43 'y': &{unknown}
112 fn recursive_vars_2() {
122 10..79 '{ ...x)]; }': ()
123 20..21 'x': &&{unknown}
124 24..31 'unknown': &&{unknown}
125 41..42 'y': &&{unknown}
126 45..52 'unknown': &&{unknown}
127 58..76 '[(x, y..., &x)]': [(&&&{unknown}, &&&{unknown}); _]
128 59..65 '(x, y)': (&&&{unknown}, &&&{unknown})
129 60..61 'x': &&{unknown}
130 63..64 'y': &&{unknown}
131 67..75 '(&y, &x)': (&&&{unknown}, &&&{unknown})
132 68..70 '&y': &&&{unknown}
133 69..70 'y': &&{unknown}
134 72..74 '&x': &&&{unknown}
135 73..74 'x': &&{unknown}
141 fn infer_std_crash_1() {
142 // caused stack overflow, taken from std
151 match something_unknown {
152 Maybe::Real(ref mut something) => (),
157 53..138 '{ ... } }': ()
158 59..136 'match ... }': ()
159 65..82 'someth...nknown': Maybe<{unknown}>
160 93..123 'Maybe:...thing)': Maybe<{unknown}>
161 105..122 'ref mu...ething': &mut {unknown}
168 fn infer_std_crash_2() {
169 mark::check!(type_var_resolves_to_int_var);
170 // caused "equating two type variables, ...", taken from std
173 fn test_line_buffer() {
174 &[0, b'\n', 1, b'\n'];
178 22..52 '{ ...n']; }': ()
179 28..49 '&[0, b...b'\n']': &[u8; _]
180 29..49 '[0, b'...b'\n']': [u8; _]
190 fn infer_std_crash_3() {
196 SizeSkeleton::Pointer { non_zero: true, tail } => {}
201 17..107 '{ ... } }': ()
202 23..105 'match ... }': ()
203 29..36 'nope!()': {unknown}
204 47..93 'SizeSk...tail }': {unknown}
207 87..91 'tail': {unknown}
214 fn infer_std_crash_4() {
218 pub fn primitive_type() {
220 BorrowedRef { type_: Primitive(p), ..} => {},
225 24..105 '{ ... } }': ()
226 30..103 'match ... }': ()
227 36..41 '*self': {unknown}
228 37..41 'self': {unknown}
229 52..90 'Borrow...), ..}': {unknown}
230 73..85 'Primitive(p)': {unknown}
231 83..84 'p': {unknown}
238 fn infer_std_crash_5() {
242 fn extra_compiler_flags() {
243 for content in doesnt_matter {
244 let name = if doesnt_matter {
250 let content = if ICE_REPORT_COMPILER_FLAGS_STRIP_VALUE.contains(&name) {
259 26..322 '{ ... } }': ()
260 32..320 'for co... }': ()
261 36..43 'content': &{unknown}
262 47..60 'doesnt_matter': {unknown}
263 61..320 '{ ... }': ()
264 75..79 'name': &&{unknown}
265 82..166 'if doe... }': &&{unknown}
266 85..98 'doesnt_matter': bool
267 99..128 '{ ... }': &&{unknown}
268 113..118 'first': &&{unknown}
269 134..166 '{ ... }': &&{unknown}
270 148..156 '&content': &&{unknown}
271 149..156 'content': &{unknown}
272 181..188 'content': &{unknown}
273 191..313 'if ICE... }': &{unknown}
274 194..231 'ICE_RE..._VALUE': {unknown}
275 194..247 'ICE_RE...&name)': bool
276 241..246 '&name': &&&{unknown}
277 242..246 'name': &&{unknown}
278 248..276 '{ ... }': &&{unknown}
279 262..266 'name': &&{unknown}
280 282..313 '{ ... }': &{unknown}
281 296..303 'content': &{unknown}
287 fn infer_nested_generics_crash() {
288 // another crash found typechecking rustc
291 struct Canonical<V> {
294 struct QueryResponse<V> {
297 fn test<R>(query_response: Canonical<QueryResponse<R>>) {
298 &query_response.value;
302 91..105 'query_response': Canonical<QueryResponse<R>>
303 136..166 '{ ...lue; }': ()
304 142..163 '&query....value': &QueryResponse<R>
305 143..157 'query_response': Canonical<QueryResponse<R>>
306 143..163 'query_....value': QueryResponse<R>
312 fn infer_paren_macro_call() {
315 macro_rules! bar { () => {0u32} }
322 44..69 '{ ...()); }': ()
332 struct HashSet<T, H>;
334 type FxHashSet<T> = HashSet<T, FxHasher>;
336 impl<T, H> HashSet<T, H> {
337 fn default() -> HashSet<T, H> {}
341 FxHashSet::default();
346 168..197 '{ ...t(); }': ()
347 174..192 'FxHash...efault': fn default<{unknown}, FxHasher>() -> HashSet<{unknown}, FxHasher>
348 174..194 'FxHash...ault()': HashSet<{unknown}, FxHasher>
359 struct Response<T> {}
365 impl<T:A> D for Response<T> {
375 119..214 '{ ... }': ()
376 129..132 'end': fn end<{unknown}>()
378 163..208 '{ ... }': ()
380 190..197 'loop {}': !
396 25..52 '{ ...oo() }': ()
397 31..48 '<Trait...>::foo': {unknown}
398 31..50 '<Trait...:foo()': ()
404 fn issue_2683_chars_impl() {
407 //- /main.rs crate:main deps:std
409 let chars: std::str::Chars<'_>;
410 (chars.next(), chars.nth(1));
411 } //^ (Option<char>, Option<char>)
413 //- /std.rs crate:std
418 pub use crate::iter::Iterator;
419 pub use crate::option::Option;
423 pub use self::traits::Iterator;
425 pub use self::iterator::Iterator;
430 fn next(&mut self) -> Option<Self::Item>;
431 fn nth(&mut self, n: usize) -> Option<Self::Item> {}
438 pub enum Option<T> {}
442 pub struct Chars<'a> {}
443 impl<'a> Iterator for Chars<'a> {
445 fn next(&mut self) -> Option<char> {}
453 fn issue_3642_bad_macro_stackover() {
457 macro_rules! match_ast {
458 (match $node:ident { $($tt:tt)* }) => { match_ast!(match ($node) { $($tt)* }) };
460 (match ($node:expr) {
461 $( ast::$ast:ident($it:ident) => $res:expr, )*
462 _ => $catch_all:expr $(,)?
464 $( if let Some($it) = ast::$ast::cast($node.clone()) { $res } else )*
470 let anchor = match_ast! {
482 fn issue_3999_slice() {
485 fn foo(params: &[usize]) {
492 7..13 'params': &[usize]
493 25..80 '{ ... } }': ()
494 31..78 'match ... }': ()
495 37..43 'params': &[usize]
496 54..66 '[ps @ .., _]': [usize]
497 55..62 'ps @ ..': &[usize]
506 fn issue_3999_struct() {
507 // rust-analyzer should not panic on seeing this malformed
522 43..95 '{ ... } }': ()
523 49..93 'match ... }': ()
525 67..80 'Bar { a: .. }': Bar
533 fn issue_4235_name_conflicts() {
537 static FOO:FOO = FOO {};
552 85..119 '{ ...o(); }': ()
557 109..116 'a.foo()': ()
563 fn issue_4465_dollar_crate_at_type() {
567 pub fn anything<T>() -> T {
572 let r: $crate::Foo = anything();
581 44..59 '{ loop {} }': T
584 !0..31 '{letr:...g();r}': Foo
586 !18..26 'anything': fn anything<Foo>() -> Foo
587 !18..28 'anything()': Foo
589 163..187 '{ ...!(); }': ()
596 fn issue_4053_diesel_where_clauses() {
601 fn internal_into_boxed(self) -> Self::Output;
604 struct SelectStatement<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Locking> {
608 trait QueryFragment<DB: Backend> {}
610 trait Into<T> { fn into(self) -> T; }
612 impl<F, S, D, W, O, LOf, DB> BoxedDsl<DB>
613 for SelectStatement<F, S, D, W, O, LOf, G>
615 O: Into<dyn QueryFragment<DB>>,
619 fn internal_into_boxed(self) -> Self::Output {
626 267..271 'self': Self
627 466..470 'self': SelectStatement<F, S, D, W, O, LOf, {unknown}, {unknown}>
628 488..522 '{ ... }': ()
629 498..502 'self': SelectStatement<F, S, D, W, O, LOf, {unknown}, {unknown}>
630 498..508 'self.order': O
631 498..515 'self.o...into()': dyn QueryFragment<DB>
640 pub struct Foo(pub i64);
642 fn test() -> Self { Self(0i64) }
646 58..72 '{ Self(0i64) }': Foo
647 60..64 'Self': Foo(i64) -> Foo
648 60..70 'Self(0i64)': Foo
654 pub struct Foo<T>(pub T);
656 fn test() -> Self { Self(0i64) }
660 64..78 '{ Self(0i64) }': Foo<i64>
661 66..70 'Self': Foo<i64>(i64) -> Foo<i64>
662 66..76 'Self(0i64)': Foo<i64>
676 trait CheckedDiv: Div<()> {}
678 trait PrimInt: CheckedDiv<Output = ()> {
682 fn check<T: PrimInt>(i: T) {
687 117..121 'self': Self
689 154..170 '{ ...w(); }': ()
691 160..167 'i.pow()': ()
700 #[lang = "coerce_unsized"]
701 pub trait CoerceUnsized<T> {}
709 fn foo<R, K>(key: &K) -> impl Future<Output = K::Bar>
715 fn bar<R, K>(key: &K) -> impl Future<Output = K::Bar>
723 198..214 '{ ...key) }': impl Future<Output = <K as Foo<R>>::Bar>
724 204..207 'bar': fn bar<R, K>(&K) -> impl Future<Output = <K as Foo<R>>::Bar>
725 204..212 'bar(key)': impl Future<Output = <K as Foo<R>>::Bar>
741 type E1<T> = (T, T, T);
742 type E2<T> = E1<E1<E1<(T, T, T)>>>;
744 impl Debug for Foo<E2<()>> {}
752 pub struct PeerSet<D>;
754 impl<D> Service<Request> for PeerSet<D>
760 type Future = dyn Future<Output = Self::Error>;
762 fn call(&mut self) -> Self::Future {
771 pub trait Service<Request> {
773 type Future: Future<Output = Self::Error>;
774 fn call(&mut self) -> Self::Future;
778 379..383 'self': &mut PeerSet<D>
779 401..424 '{ ... }': dyn Future<Output = ()>
780 411..418 'loop {}': !
782 575..579 'self': &mut Self
791 pub trait IntoIterator {
795 struct Repeat<A> { element: A }
797 struct Map<F> { f: F }
806 impl<T> Deref for Vec<T> {
810 fn from_iter<A, T: IntoIterator<Item = A>>(iter: T) -> Vec<A> {}
813 let inner = Map { f: |_: &f64| 0.0 };
815 let repeat = Repeat { element: inner };
817 let vec = from_iter(repeat);
825 303..447 '{ ...r(); }': ()
826 313..318 'inner': Map<|&f64| -> f64>
827 321..345 'Map { ... 0.0 }': Map<|&f64| -> f64>
828 330..343 '|_: &f64| 0.0': |&f64| -> f64
831 356..362 'repeat': Repeat<Map<|&f64| -> f64>>
832 365..390 'Repeat...nner }': Repeat<Map<|&f64| -> f64>>
833 383..388 'inner': Map<|&f64| -> f64>
834 401..404 'vec': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>>
835 407..416 '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>>>>
836 407..424 'from_i...epeat)': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>>
837 417..423 'repeat': Repeat<Map<|&f64| -> f64>>
838 431..434 'vec': Vec<IntoIterator::Item<Repeat<Map<|&f64| -> f64>>>>
839 431..444 'vec.foo_bar()': {unknown}