Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/tests/regression.rs')
-rw-r--r--crates/hir-ty/src/tests/regression.rs371
1 files changed, 247 insertions, 124 deletions
diff --git a/crates/hir-ty/src/tests/regression.rs b/crates/hir-ty/src/tests/regression.rs
index c4c17a93c9..7c79393e65 100644
--- a/crates/hir-ty/src/tests/regression.rs
+++ b/crates/hir-ty/src/tests/regression.rs
@@ -1,3 +1,5 @@
+mod new_solver;
+
use expect_test::expect;
use super::{check_infer, check_no_mismatches, check_types};
@@ -86,6 +88,7 @@ fn bug_651() {
#[test]
fn recursive_vars() {
+ // FIXME: This isn't nice, but I guess as long as we don't hang/crash that's fine?
check_infer(
r#"
fn test() {
@@ -95,12 +98,12 @@ fn recursive_vars() {
"#,
expect![[r#"
10..47 '{ ...&y]; }': ()
- 20..21 'y': {unknown}
- 24..31 'unknown': {unknown}
- 37..44 '[y, &y]': [{unknown}; 2]
- 38..39 'y': {unknown}
- 41..43 '&y': &'? {unknown}
- 42..43 'y': {unknown}
+ 20..21 'y': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 24..31 'unknown': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 37..44 '[y, &y]': [&'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}; 2]
+ 38..39 'y': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 41..43 '&y': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 42..43 'y': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
"#]],
);
}
@@ -117,19 +120,19 @@ fn recursive_vars_2() {
"#,
expect![[r#"
10..79 '{ ...x)]; }': ()
- 20..21 'x': &'? {unknown}
- 24..31 'unknown': &'? {unknown}
- 41..42 'y': {unknown}
- 45..52 'unknown': {unknown}
- 58..76 '[(x, y..., &x)]': [(&'? {unknown}, {unknown}); 2]
- 59..65 '(x, y)': (&'? {unknown}, {unknown})
- 60..61 'x': &'? {unknown}
- 63..64 'y': {unknown}
- 67..75 '(&y, &x)': (&'? {unknown}, {unknown})
- 68..70 '&y': &'? {unknown}
- 69..70 'y': {unknown}
- 72..74 '&x': &'? &'? {unknown}
- 73..74 'x': &'? {unknown}
+ 20..21 'x': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 24..31 'unknown': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 41..42 'y': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 45..52 'unknown': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 58..76 '[(x, y..., &x)]': [(&'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}, &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}); 2]
+ 59..65 '(x, y)': (&'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}, &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown})
+ 60..61 'x': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 63..64 'y': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 67..75 '(&y, &x)': (&'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}, &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown})
+ 68..70 '&y': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 69..70 'y': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 72..74 '&x': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 73..74 'x': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
"#]],
);
}
@@ -266,37 +269,37 @@ fn infer_std_crash_5() {
expect![[r#"
26..322 '{ ... } }': ()
32..320 'for co... }': fn into_iter<{unknown}>({unknown}) -> <{unknown} as IntoIterator>::IntoIter
- 32..320 'for co... }': {unknown}
+ 32..320 'for co... }': <{unknown} as IntoIterator>::IntoIter
32..320 'for co... }': !
32..320 'for co... }': {unknown}
32..320 'for co... }': &'? mut {unknown}
32..320 'for co... }': fn next<{unknown}>(&'? mut {unknown}) -> Option<<{unknown} as Iterator>::Item>
- 32..320 'for co... }': Option<{unknown}>
+ 32..320 'for co... }': Option<<{unknown} as Iterator>::Item>
32..320 'for co... }': ()
32..320 'for co... }': ()
32..320 'for co... }': ()
32..320 'for co... }': ()
- 36..43 'content': {unknown}
+ 36..43 'content': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
47..60 'doesnt_matter': {unknown}
61..320 '{ ... }': ()
- 75..79 'name': &'? {unknown}
- 82..166 'if doe... }': &'? {unknown}
+ 75..79 'name': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 82..166 'if doe... }': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
85..98 'doesnt_matter': bool
- 99..128 '{ ... }': &'? {unknown}
- 113..118 'first': &'? {unknown}
- 134..166 '{ ... }': &'? {unknown}
- 148..156 '&content': &'? {unknown}
- 149..156 'content': {unknown}
- 181..188 'content': &'? {unknown}
- 191..313 'if ICE... }': &'? {unknown}
- 194..231 'ICE_RE..._VALUE': {unknown}
+ 99..128 '{ ... }': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 113..118 'first': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 134..166 '{ ... }': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 148..156 '&content': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 149..156 'content': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 181..188 'content': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 191..313 'if ICE... }': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 194..231 'ICE_RE..._VALUE': bool
194..247 'ICE_RE...&name)': bool
- 241..246 '&name': &'? &'? {unknown}
- 242..246 'name': &'? {unknown}
- 248..276 '{ ... }': &'? {unknown}
- 262..266 'name': &'? {unknown}
- 282..313 '{ ... }': {unknown}
- 296..303 'content': {unknown}
+ 241..246 '&name': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 242..246 'name': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 248..276 '{ ... }': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 262..266 'name': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 282..313 '{ ... }': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
+ 296..303 'content': &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? &'? {unknown}
"#]],
);
}
@@ -392,7 +395,7 @@ fn issue_2669() {
r#"
trait A {}
trait Write {}
- struct Response<T> {}
+ struct Response<T>(T);
trait D {
fn foo();
@@ -408,13 +411,13 @@ fn issue_2669() {
}
"#,
expect![[r#"
- 119..214 '{ ... }': ()
- 129..132 'end': fn end<{unknown}>()
- 129..134 'end()': ()
- 163..208 '{ ... }': ()
- 181..183 '_x': !
- 190..197 'loop {}': !
- 195..197 '{}': ()
+ 120..215 '{ ... }': ()
+ 130..133 'end': fn end<{unknown}>()
+ 130..135 'end()': ()
+ 164..209 '{ ... }': ()
+ 182..184 '_x': !
+ 191..198 'loop {}': !
+ 196..198 '{}': ()
"#]],
)
}
@@ -626,10 +629,10 @@ fn issue_4053_diesel_where_clauses() {
65..69 'self': Self
267..271 'self': Self
466..470 'self': SelectStatement<F, S, D, W, O, LOf, {unknown}, {unknown}>
- 488..522 '{ ... }': ()
+ 488..522 '{ ... }': <SelectStatement<F, S, D, W, O, LOf, {unknown}, {unknown}> as BoxedDsl<DB>>::Output
498..502 'self': SelectStatement<F, S, D, W, O, LOf, {unknown}, {unknown}>
498..508 'self.order': O
- 498..515 'self.o...into()': dyn QueryFragment<DB> + '?
+ 498..515 'self.o...into()': dyn QueryFragment<DB> + 'static
"#]],
);
}
@@ -773,7 +776,7 @@ fn issue_4800() {
"#,
expect![[r#"
379..383 'self': &'? mut PeerSet<D>
- 401..424 '{ ... }': dyn Future<Output = ()> + '?
+ 401..424 '{ ... }': dyn Future<Output = ()> + 'static
411..418 'loop {}': !
416..418 '{}': ()
575..579 'self': &'? mut Self
@@ -781,6 +784,9 @@ fn issue_4800() {
);
}
+// FIXME(next-solver): Though `Repeat: IntoIterator` does not hold here, we
+// should be able to do better at given type hints (with Chalk, we did `IntoIterator::Item<Repeat<...>>`)
+// From what I can tell, the point of this test is to not panic though.
#[test]
fn issue_4966() {
check_infer(
@@ -794,7 +800,7 @@ fn issue_4966() {
struct Map<F> { f: F }
- struct Vec<T> {}
+ struct Vec<T> { p: *mut T }
impl<T> core::ops::Deref for Vec<T> {
type Target = [T];
@@ -813,23 +819,23 @@ fn issue_4966() {
}
"#,
expect![[r#"
- 225..229 'iter': T
- 244..246 '{}': Vec<A>
- 258..402 '{ ...r(); }': ()
- 268..273 'inner': Map<impl Fn(&'? f64) -> f64>
- 276..300 'Map { ... 0.0 }': Map<impl Fn(&'? f64) -> f64>
- 285..298 '|_: &f64| 0.0': impl Fn(&'? f64) -> f64
- 286..287 '_': &'? f64
- 295..298 '0.0': f64
- 311..317 'repeat': Repeat<Map<impl Fn(&'? f64) -> f64>>
- 320..345 'Repeat...nner }': Repeat<Map<impl Fn(&'? f64) -> f64>>
- 338..343 'inner': Map<impl Fn(&'? f64) -> f64>
- 356..359 'vec': Vec<IntoIterator::Item<Repeat<Map<impl Fn(&'? f64) -> f64>>>>
- 362..371 'from_iter': fn from_iter<IntoIterator::Item<Repeat<Map<impl Fn(&'? f64) -> f64>>>, Repeat<Map<impl Fn(&'? f64) -> f64>>>(Repeat<Map<impl Fn(&'? f64) -> f64>>) -> Vec<IntoIterator::Item<Repeat<Map<impl Fn(&'? f64) -> f64>>>>
- 362..379 'from_i...epeat)': Vec<IntoIterator::Item<Repeat<Map<impl Fn(&'? f64) -> f64>>>>
- 372..378 'repeat': Repeat<Map<impl Fn(&'? f64) -> f64>>
- 386..389 'vec': Vec<IntoIterator::Item<Repeat<Map<impl Fn(&'? f64) -> f64>>>>
- 386..399 'vec.foo_bar()': {unknown}
+ 236..240 'iter': T
+ 255..257 '{}': Vec<A>
+ 269..413 '{ ...r(); }': ()
+ 279..284 'inner': Map<impl Fn(&'? f64) -> f64>
+ 287..311 'Map { ... 0.0 }': Map<impl Fn(&'? f64) -> f64>
+ 296..309 '|_: &f64| 0.0': impl Fn(&'? f64) -> f64
+ 297..298 '_': &'? f64
+ 306..309 '0.0': f64
+ 322..328 'repeat': Repeat<Map<impl Fn(&'? f64) -> f64>>
+ 331..356 'Repeat...nner }': Repeat<Map<impl Fn(&'? f64) -> f64>>
+ 349..354 'inner': Map<impl Fn(&'? f64) -> f64>
+ 367..370 'vec': Vec<{unknown}>
+ 373..382 'from_iter': fn from_iter<{unknown}, Repeat<Map<impl Fn(&'? f64) -> f64>>>(Repeat<Map<impl Fn(&'? f64) -> f64>>) -> Vec<{unknown}>
+ 373..390 'from_i...epeat)': Vec<{unknown}>
+ 383..389 'repeat': Repeat<Map<impl Fn(&'? f64) -> f64>>
+ 397..400 'vec': Vec<{unknown}>
+ 397..410 'vec.foo_bar()': {unknown}
"#]],
);
}
@@ -838,37 +844,40 @@ fn issue_4966() {
fn issue_6628() {
check_infer(
r#"
-//- minicore: fn
-struct S<T>();
+//- minicore: fn, phantom_data
+use core::marker::PhantomData;
+
+struct S<T>(PhantomData<T>);
impl<T> S<T> {
fn f(&self, _t: T) {}
fn g<F: FnOnce(&T)>(&self, _f: F) {}
}
fn main() {
- let s = S();
+ let s = S(PhantomData);
s.g(|_x| {});
s.f(10);
}
"#,
expect![[r#"
- 40..44 'self': &'? S<T>
- 46..48 '_t': T
- 53..55 '{}': ()
- 81..85 'self': &'? S<T>
- 87..89 '_f': F
- 94..96 '{}': ()
- 109..160 '{ ...10); }': ()
- 119..120 's': S<i32>
- 123..124 'S': fn S<i32>() -> S<i32>
- 123..126 'S()': S<i32>
- 132..133 's': S<i32>
- 132..144 's.g(|_x| {})': ()
- 136..143 '|_x| {}': impl FnOnce(&'? i32)
- 137..139 '_x': &'? i32
- 141..143 '{}': ()
- 150..151 's': S<i32>
- 150..157 's.f(10)': ()
- 154..156 '10': i32
+ 86..90 'self': &'? S<T>
+ 92..94 '_t': T
+ 99..101 '{}': ()
+ 127..131 'self': &'? S<T>
+ 133..135 '_f': F
+ 140..142 '{}': ()
+ 155..217 '{ ...10); }': ()
+ 165..166 's': S<i32>
+ 169..170 'S': fn S<i32>(PhantomData<i32>) -> S<i32>
+ 169..183 'S(PhantomData)': S<i32>
+ 171..182 'PhantomData': PhantomData<i32>
+ 189..190 's': S<i32>
+ 189..201 's.g(|_x| {})': ()
+ 193..200 '|_x| {}': impl FnOnce(&'? i32)
+ 194..196 '_x': &'? i32
+ 198..200 '{}': ()
+ 207..208 's': S<i32>
+ 207..214 's.f(10)': ()
+ 211..213 '10': i32
"#]],
);
}
@@ -926,7 +935,7 @@ fn lifetime_from_chalk_during_deref() {
check_types(
r#"
//- minicore: deref
-struct Box<T: ?Sized> {}
+struct Box<T: ?Sized>(T);
impl<T: ?Sized> core::ops::Deref for Box<T> {
type Target = T;
@@ -959,6 +968,9 @@ fn clone_iter<T>(s: Iter<T>) {
fn issue_8686() {
check_infer(
r#"
+//- minicore: phantom_data
+use core::marker::PhantomData;
+
pub trait Try: FromResidual {
type Output;
type Residual;
@@ -967,28 +979,32 @@ pub trait FromResidual<R = <Self as Try>::Residual> {
fn from_residual(residual: R) -> Self;
}
-struct ControlFlow<B, C>;
+struct ControlFlow<B, C>(PhantomData<(B, C)>);
impl<B, C> Try for ControlFlow<B, C> {
type Output = C;
type Residual = ControlFlow<B, !>;
}
impl<B, C> FromResidual for ControlFlow<B, C> {
- fn from_residual(r: ControlFlow<B, !>) -> Self { ControlFlow }
+ fn from_residual(r: ControlFlow<B, !>) -> Self { ControlFlow(PhantomData) }
}
fn test() {
- ControlFlow::from_residual(ControlFlow::<u32, !>);
+ ControlFlow::from_residual(ControlFlow::<u32, !>(PhantomData));
}
"#,
expect![[r#"
- 144..152 'residual': R
- 365..366 'r': ControlFlow<B, !>
- 395..410 '{ ControlFlow }': ControlFlow<B, C>
- 397..408 'ControlFlow': ControlFlow<B, C>
- 424..482 '{ ...!>); }': ()
- 430..456 'Contro...sidual': fn from_residual<ControlFlow<u32, {unknown}>, ControlFlow<u32, !>>(ControlFlow<u32, !>) -> ControlFlow<u32, {unknown}>
- 430..479 'Contro...2, !>)': ControlFlow<u32, {unknown}>
- 457..478 'Contro...32, !>': ControlFlow<u32, !>
+ 176..184 'residual': R
+ 418..419 'r': ControlFlow<B, !>
+ 448..476 '{ Cont...ata) }': ControlFlow<B, C>
+ 450..461 'ControlFlow': fn ControlFlow<B, C>(PhantomData<(B, C)>) -> ControlFlow<B, C>
+ 450..474 'Contro...mData)': ControlFlow<B, C>
+ 462..473 'PhantomData': PhantomData<(B, C)>
+ 490..561 '{ ...a)); }': ()
+ 496..522 'Contro...sidual': fn from_residual<ControlFlow<u32, {unknown}>, ControlFlow<u32, !>>(ControlFlow<u32, !>) -> ControlFlow<u32, {unknown}>
+ 496..558 'Contro...Data))': ControlFlow<u32, {unknown}>
+ 523..544 'Contro...32, !>': fn ControlFlow<u32, !>(PhantomData<(u32, !)>) -> ControlFlow<u32, !>
+ 523..557 'Contro...mData)': ControlFlow<u32, !>
+ 545..556 'PhantomData': PhantomData<(u32, !)>
"#]],
);
}
@@ -1047,12 +1063,13 @@ fn impl_trait_in_option_9530() {
check_types(
r#"
//- minicore: sized
-struct Option<T>;
+struct Option<T>(T);
impl<T> Option<T> {
fn unwrap(self) -> T { loop {} }
}
-fn make() -> Option<impl Copy> { Option }
+fn make() -> Option<impl Copy> { Option(()) }
trait Copy {}
+impl Copy for () {}
fn test() {
let o = make();
o.unwrap();
@@ -1158,9 +1175,9 @@ pub trait BitView {
pub struct Lsb0;
-pub struct BitArray<V: BitView> { }
+pub struct BitArray<V: BitView>(V);
-pub struct BitSlice<T> { }
+pub struct BitSlice<T>(T);
impl<V: BitView> core::ops::Deref for BitArray<V> {
type Target = BitSlice<V::Store>;
@@ -1224,6 +1241,8 @@ fn mamba(a: U32!(), p: u32) -> u32 {
#[test]
fn for_loop_block_expr_iterable() {
+ // FIXME(next-solver): it would be nice to be able to hint `IntoIterator::IntoIter<()>` instead of just `{unknown}`
+ // (even though `(): IntoIterator` does not hold)
check_infer(
r#"
//- minicore: iterator
@@ -1236,17 +1255,17 @@ fn test() {
expect![[r#"
10..68 '{ ... } }': ()
16..66 'for _ ... }': fn into_iter<()>(()) -> <() as IntoIterator>::IntoIter
- 16..66 'for _ ... }': IntoIterator::IntoIter<()>
+ 16..66 'for _ ... }': <() as IntoIterator>::IntoIter
16..66 'for _ ... }': !
- 16..66 'for _ ... }': IntoIterator::IntoIter<()>
- 16..66 'for _ ... }': &'? mut IntoIterator::IntoIter<()>
- 16..66 'for _ ... }': fn next<IntoIterator::IntoIter<()>>(&'? mut IntoIterator::IntoIter<()>) -> Option<<IntoIterator::IntoIter<()> as Iterator>::Item>
- 16..66 'for _ ... }': Option<IntoIterator::Item<()>>
+ 16..66 'for _ ... }': {unknown}
+ 16..66 'for _ ... }': &'? mut {unknown}
+ 16..66 'for _ ... }': fn next<{unknown}>(&'? mut {unknown}) -> Option<<{unknown} as Iterator>::Item>
+ 16..66 'for _ ... }': Option<<{unknown} as Iterator>::Item>
16..66 'for _ ... }': ()
16..66 'for _ ... }': ()
16..66 'for _ ... }': ()
16..66 'for _ ... }': ()
- 20..21 '_': IntoIterator::Item<()>
+ 20..21 '_': {unknown}
25..39 '{ let x = 0; }': ()
31..32 'x': i32
35..36 '0': i32
@@ -1283,7 +1302,6 @@ fn test() {
#[test]
fn bug_11242() {
- // FIXME: wrong, should be u32
check_types(
r#"
fn foo<A, B>()
@@ -1292,7 +1310,7 @@ where
B: IntoIterator<Item = usize>,
{
let _x: <A as IntoIterator>::Item;
- // ^^ {unknown}
+ // ^^ u32
}
pub trait Iterator {
@@ -1495,7 +1513,7 @@ fn regression_11688_2() {
fn regression_11688_3() {
check_types(
r#"
- //- minicore: iterator
+ //- minicore: iterator, dispatch_from_dyn
struct Ar<T, const N: u8>(T);
fn f<const LEN: usize, T, const BASE: u8>(
num_zeros: usize,
@@ -1514,6 +1532,7 @@ fn regression_11688_3() {
fn regression_11688_4() {
check_types(
r#"
+ //- minicore: dispatch_from_dyn
trait Bar<const C: usize> {
fn baz(&self) -> [i32; C];
}
@@ -1772,7 +1791,7 @@ fn regression_14844() {
r#"
pub type Ty = Unknown;
-pub struct Inner<T>();
+pub struct Inner<T>(T);
pub struct Outer {
pub inner: Inner<Ty>,
@@ -1780,7 +1799,7 @@ pub struct Outer {
fn main() {
_ = Outer {
- inner: Inner::<i32>(),
+ inner: Inner::<i32>(0),
};
}
"#,
@@ -2010,12 +2029,12 @@ fn tait_async_stack_overflow_17199() {
fn lifetime_params_move_param_defaults() {
check_types(
r#"
-pub struct Thing<'s, T = u32>;
+pub struct Thing<'s, T = u32>(&'s T);
impl <'s> Thing<'s> {
pub fn new() -> Thing<'s> {
- Thing
- //^^^^^ Thing<'?, u32>
+ Thing(&0)
+ //^^^^^^^^^ Thing<'?, u32>
}
}
@@ -2052,7 +2071,7 @@ impl S {
}
}
-struct Wrap<'a, T>(T);
+struct Wrap<'a, T>(&'a T);
trait Trait<'a> {
type Proj;
}
@@ -2294,10 +2313,10 @@ trait Foo {
}
"#,
expect![[r#"
- 83..86 'bar': Foo::Bar<Self, A, B>
+ 83..86 'bar': <Self as Foo>::Bar<A, B>
105..133 '{ ... }': ()
- 119..120 '_': Foo::Bar<Self, A, B>
- 123..126 'bar': Foo::Bar<Self, A, B>
+ 119..120 '_': <Self as Foo>::Bar<A, B>
+ 123..126 'bar': <Self as Foo>::Bar<A, B>
"#]],
);
}
@@ -2344,8 +2363,8 @@ fn test() {
108..125 '{ ... }': usize
118..119 'N': usize
139..157 '{ ...= N; }': ()
- 149..150 '_': Foo<_>
- 153..154 'N': Foo<_>
+ 149..150 '_': Foo<N>
+ 153..154 'N': Foo<N>
"#]],
);
}
@@ -2383,3 +2402,107 @@ pub trait Destruct {}
"#,
);
}
+
+#[test]
+fn no_duplicated_lang_item_metadata() {
+ check_types(
+ r#"
+//- minicore: pointee
+//- /main.rs crate:main deps:std,core
+use std::AtomicPtr;
+use std::null_mut;
+
+fn main() {
+ let x: AtomicPtr<()> = AtomicPtr::new(null_mut());
+ //^ AtomicPtr<()>
+}
+
+//- /lib.rs crate:r#std deps:core
+#![no_std]
+pub use core::*;
+
+//- /lib.rs crate:r#core
+#![no_core]
+
+#[lang = "pointee_trait"]
+pub trait Pointee {
+ #[lang = "metadata_type"]
+ type Metadata;
+}
+
+pub struct AtomicPtr<T>(T);
+
+impl<T> AtomicPtr<T> {
+ pub fn new(p: *mut T) -> AtomicPtr<T> {
+ loop {}
+ }
+}
+
+#[lang = "pointee_sized"]
+pub trait PointeeSized {}
+#[lang = "meta_sized"]
+pub trait MetaSized: PointeeSized {}
+#[lang = "sized"]
+pub trait Sized: MetaSized {}
+
+pub trait Thin = Pointee<Metadata = ()> + PointeeSized;
+
+pub fn null_mut<T: PointeeSized + Thin>() -> *mut T {
+ loop {}
+}
+"#,
+ );
+}
+
+#[test]
+fn issue_20484() {
+ check_no_mismatches(
+ r#"
+struct Eth;
+
+trait FullBlockBody {
+ type Transaction;
+}
+
+impl FullBlockBody for () {
+ type Transaction = ();
+}
+
+trait NodePrimitives {
+ type BlockBody;
+ type SignedTx;
+}
+
+impl NodePrimitives for () {
+ type BlockBody = ();
+ type SignedTx = ();
+}
+
+impl NodePrimitives for Eth {
+ type BlockBody = ();
+ type SignedTx = ();
+}
+
+trait FullNodePrimitives
+where
+ Self: NodePrimitives<BlockBody: FullBlockBody<Transaction = Self::SignedTx>>,
+{
+}
+
+impl<T> FullNodePrimitives for T where
+ T: NodePrimitives<BlockBody: FullBlockBody<Transaction = Self::SignedTx>>,
+{
+}
+
+fn node<N>(_: N)
+where
+ N: FullNodePrimitives,
+{
+}
+
+fn main() {
+ node(Eth);
+}
+"#,
+ );
+}