diff options
author | Laurențiu Nicola <[email protected]> | 2020-06-22 12:18:10 +0100 |
---|---|---|
committer | Laurențiu Nicola <[email protected]> | 2020-06-26 11:00:55 +0100 |
commit | 7e104ea4a885c8fd6f348a0d7d30911fe49d91e8 (patch) | |
tree | 8672b65c9308939517f45486a4671449dba3c334 | |
parent | 38cd1b70e8d4b8f57ac2ae0702cf4728764094d9 (diff) |
Bump chalk
-rw-r--r-- | Cargo.lock | 190 | ||||
-rw-r--r-- | crates/ra_hir_ty/Cargo.toml | 4 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/tests/coercion.rs | 42 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/tests/traits.rs | 8 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk.rs | 86 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk/interner.rs | 1 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk/mapping.rs | 9 |
7 files changed, 281 insertions, 59 deletions
diff --git a/Cargo.lock b/Cargo.lock index b2b624212..f22366a36 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -25,6 +25,15 @@ dependencies = [ | |||
25 | ] | 25 | ] |
26 | 26 | ||
27 | [[package]] | 27 | [[package]] |
28 | name = "ansi_term" | ||
29 | version = "0.11.0" | ||
30 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
31 | checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" | ||
32 | dependencies = [ | ||
33 | "winapi 0.3.8", | ||
34 | ] | ||
35 | |||
36 | [[package]] | ||
28 | name = "anyhow" | 37 | name = "anyhow" |
29 | version = "1.0.31" | 38 | version = "1.0.31" |
30 | source = "registry+https://github.com/rust-lang/crates.io-index" | 39 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -95,6 +104,12 @@ dependencies = [ | |||
95 | ] | 104 | ] |
96 | 105 | ||
97 | [[package]] | 106 | [[package]] |
107 | name = "byteorder" | ||
108 | version = "1.3.4" | ||
109 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
110 | checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" | ||
111 | |||
112 | [[package]] | ||
98 | name = "cargo_metadata" | 113 | name = "cargo_metadata" |
99 | version = "0.10.0" | 114 | version = "0.10.0" |
100 | source = "registry+https://github.com/rust-lang/crates.io-index" | 115 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -120,9 +135,8 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" | |||
120 | 135 | ||
121 | [[package]] | 136 | [[package]] |
122 | name = "chalk-derive" | 137 | name = "chalk-derive" |
123 | version = "0.11.0" | 138 | version = "0.15.0-dev.0" |
124 | source = "registry+https://github.com/rust-lang/crates.io-index" | 139 | source = "git+https://github.com/rust-lang/chalk#57037a53f7decc965d25972606c3ea930e9cb39f" |
125 | checksum = "5b9bd01eab87277d973183a1d2e56bace1c11f8242c52c20636fb7dddf343ac9" | ||
126 | dependencies = [ | 140 | dependencies = [ |
127 | "proc-macro2", | 141 | "proc-macro2", |
128 | "quote", | 142 | "quote", |
@@ -132,20 +146,19 @@ dependencies = [ | |||
132 | 146 | ||
133 | [[package]] | 147 | [[package]] |
134 | name = "chalk-engine" | 148 | name = "chalk-engine" |
135 | version = "0.11.0" | 149 | version = "0.15.0-dev.0" |
136 | source = "registry+https://github.com/rust-lang/crates.io-index" | 150 | source = "git+https://github.com/rust-lang/chalk#57037a53f7decc965d25972606c3ea930e9cb39f" |
137 | checksum = "6c7a637c3d17ed555aef16e16952a5d1e127bd55178cc30be22afeb92da90c7d" | ||
138 | dependencies = [ | 151 | dependencies = [ |
139 | "chalk-derive", | 152 | "chalk-derive", |
140 | "chalk-ir", | 153 | "chalk-ir", |
141 | "rustc-hash", | 154 | "rustc-hash", |
155 | "tracing", | ||
142 | ] | 156 | ] |
143 | 157 | ||
144 | [[package]] | 158 | [[package]] |
145 | name = "chalk-ir" | 159 | name = "chalk-ir" |
146 | version = "0.11.0" | 160 | version = "0.15.0-dev.0" |
147 | source = "registry+https://github.com/rust-lang/crates.io-index" | 161 | source = "git+https://github.com/rust-lang/chalk#57037a53f7decc965d25972606c3ea930e9cb39f" |
148 | checksum = "595e5735ded16c3f3dc348f7b15bbb2521a0080b1863cac38ad5271589944670" | ||
149 | dependencies = [ | 162 | dependencies = [ |
150 | "chalk-derive", | 163 | "chalk-derive", |
151 | "lazy_static", | 164 | "lazy_static", |
@@ -153,9 +166,8 @@ dependencies = [ | |||
153 | 166 | ||
154 | [[package]] | 167 | [[package]] |
155 | name = "chalk-solve" | 168 | name = "chalk-solve" |
156 | version = "0.11.0" | 169 | version = "0.15.0-dev.0" |
157 | source = "registry+https://github.com/rust-lang/crates.io-index" | 170 | source = "git+https://github.com/rust-lang/chalk#57037a53f7decc965d25972606c3ea930e9cb39f" |
158 | checksum = "5d9d938139db425867a30cc0cfec0269406d8238d0571d829041eaa7a8455d11" | ||
159 | dependencies = [ | 171 | dependencies = [ |
160 | "chalk-derive", | 172 | "chalk-derive", |
161 | "chalk-engine", | 173 | "chalk-engine", |
@@ -164,6 +176,19 @@ dependencies = [ | |||
164 | "itertools", | 176 | "itertools", |
165 | "petgraph", | 177 | "petgraph", |
166 | "rustc-hash", | 178 | "rustc-hash", |
179 | "tracing", | ||
180 | "tracing-subscriber", | ||
181 | ] | ||
182 | |||
183 | [[package]] | ||
184 | name = "chrono" | ||
185 | version = "0.4.11" | ||
186 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
187 | checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" | ||
188 | dependencies = [ | ||
189 | "num-integer", | ||
190 | "num-traits", | ||
191 | "time", | ||
167 | ] | 192 | ] |
168 | 193 | ||
169 | [[package]] | 194 | [[package]] |
@@ -677,6 +702,15 @@ dependencies = [ | |||
677 | ] | 702 | ] |
678 | 703 | ||
679 | [[package]] | 704 | [[package]] |
705 | name = "matchers" | ||
706 | version = "0.0.1" | ||
707 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
708 | checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" | ||
709 | dependencies = [ | ||
710 | "regex-automata", | ||
711 | ] | ||
712 | |||
713 | [[package]] | ||
680 | name = "matches" | 714 | name = "matches" |
681 | version = "0.1.8" | 715 | version = "0.1.8" |
682 | source = "registry+https://github.com/rust-lang/crates.io-index" | 716 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -797,6 +831,25 @@ dependencies = [ | |||
797 | ] | 831 | ] |
798 | 832 | ||
799 | [[package]] | 833 | [[package]] |
834 | name = "num-integer" | ||
835 | version = "0.1.43" | ||
836 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
837 | checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" | ||
838 | dependencies = [ | ||
839 | "autocfg", | ||
840 | "num-traits", | ||
841 | ] | ||
842 | |||
843 | [[package]] | ||
844 | name = "num-traits" | ||
845 | version = "0.2.12" | ||
846 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
847 | checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" | ||
848 | dependencies = [ | ||
849 | "autocfg", | ||
850 | ] | ||
851 | |||
852 | [[package]] | ||
800 | name = "num_cpus" | 853 | name = "num_cpus" |
801 | version = "1.13.0" | 854 | version = "1.13.0" |
802 | source = "registry+https://github.com/rust-lang/crates.io-index" | 855 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1334,6 +1387,16 @@ dependencies = [ | |||
1334 | ] | 1387 | ] |
1335 | 1388 | ||
1336 | [[package]] | 1389 | [[package]] |
1390 | name = "regex-automata" | ||
1391 | version = "0.1.9" | ||
1392 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1393 | checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" | ||
1394 | dependencies = [ | ||
1395 | "byteorder", | ||
1396 | "regex-syntax", | ||
1397 | ] | ||
1398 | |||
1399 | [[package]] | ||
1337 | name = "regex-syntax" | 1400 | name = "regex-syntax" |
1338 | version = "0.6.18" | 1401 | version = "0.6.18" |
1339 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1402 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1523,18 +1586,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" | |||
1523 | 1586 | ||
1524 | [[package]] | 1587 | [[package]] |
1525 | name = "serde" | 1588 | name = "serde" |
1526 | version = "1.0.113" | 1589 | version = "1.0.114" |
1527 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1590 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1528 | checksum = "6135c78461981c79497158ef777264c51d9d0f4f3fc3a4d22b915900e42dac6a" | 1591 | checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3" |
1529 | dependencies = [ | 1592 | dependencies = [ |
1530 | "serde_derive", | 1593 | "serde_derive", |
1531 | ] | 1594 | ] |
1532 | 1595 | ||
1533 | [[package]] | 1596 | [[package]] |
1534 | name = "serde_derive" | 1597 | name = "serde_derive" |
1535 | version = "1.0.113" | 1598 | version = "1.0.114" |
1536 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1599 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1537 | checksum = "93c5eaa17d0954cb481cdcfffe9d84fcfa7a1a9f2349271e678677be4c26ae31" | 1600 | checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" |
1538 | dependencies = [ | 1601 | dependencies = [ |
1539 | "proc-macro2", | 1602 | "proc-macro2", |
1540 | "quote", | 1603 | "quote", |
@@ -1576,6 +1639,15 @@ dependencies = [ | |||
1576 | ] | 1639 | ] |
1577 | 1640 | ||
1578 | [[package]] | 1641 | [[package]] |
1642 | name = "sharded-slab" | ||
1643 | version = "0.0.9" | ||
1644 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1645 | checksum = "06d5a3f5166fb5b42a5439f2eee8b9de149e235961e3eb21c5808fc3ea17ff3e" | ||
1646 | dependencies = [ | ||
1647 | "lazy_static", | ||
1648 | ] | ||
1649 | |||
1650 | [[package]] | ||
1579 | name = "slab" | 1651 | name = "slab" |
1580 | version = "0.4.2" | 1652 | version = "0.4.2" |
1581 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1653 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1608,9 +1680,9 @@ checksum = "ab16ced94dbd8a46c82fd81e3ed9a8727dac2977ea869d217bcc4ea1f122e81f" | |||
1608 | 1680 | ||
1609 | [[package]] | 1681 | [[package]] |
1610 | name = "syn" | 1682 | name = "syn" |
1611 | version = "1.0.32" | 1683 | version = "1.0.33" |
1612 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1684 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1613 | checksum = "a994520748611c17d163e81b6c4a4b13d11b7f63884362ab2efac3aa9cf16d00" | 1685 | checksum = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd" |
1614 | dependencies = [ | 1686 | dependencies = [ |
1615 | "proc-macro2", | 1687 | "proc-macro2", |
1616 | "quote", | 1688 | "quote", |
@@ -1704,12 +1776,94 @@ dependencies = [ | |||
1704 | ] | 1776 | ] |
1705 | 1777 | ||
1706 | [[package]] | 1778 | [[package]] |
1779 | name = "time" | ||
1780 | version = "0.1.43" | ||
1781 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1782 | checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" | ||
1783 | dependencies = [ | ||
1784 | "libc", | ||
1785 | "winapi 0.3.8", | ||
1786 | ] | ||
1787 | |||
1788 | [[package]] | ||
1707 | name = "tinyvec" | 1789 | name = "tinyvec" |
1708 | version = "0.3.3" | 1790 | version = "0.3.3" |
1709 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1791 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1710 | checksum = "53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed" | 1792 | checksum = "53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed" |
1711 | 1793 | ||
1712 | [[package]] | 1794 | [[package]] |
1795 | name = "tracing" | ||
1796 | version = "0.1.15" | ||
1797 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1798 | checksum = "a41f40ed0e162c911ac6fcb53ecdc8134c46905fdbbae8c50add462a538b495f" | ||
1799 | dependencies = [ | ||
1800 | "cfg-if", | ||
1801 | "tracing-attributes", | ||
1802 | "tracing-core", | ||
1803 | ] | ||
1804 | |||
1805 | [[package]] | ||
1806 | name = "tracing-attributes" | ||
1807 | version = "0.1.8" | ||
1808 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1809 | checksum = "99bbad0de3fd923c9c3232ead88510b783e5a4d16a6154adffa3d53308de984c" | ||
1810 | dependencies = [ | ||
1811 | "proc-macro2", | ||
1812 | "quote", | ||
1813 | "syn", | ||
1814 | ] | ||
1815 | |||
1816 | [[package]] | ||
1817 | name = "tracing-core" | ||
1818 | version = "0.1.10" | ||
1819 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1820 | checksum = "0aa83a9a47081cd522c09c81b31aec2c9273424976f922ad61c053b58350b715" | ||
1821 | dependencies = [ | ||
1822 | "lazy_static", | ||
1823 | ] | ||
1824 | |||
1825 | [[package]] | ||
1826 | name = "tracing-log" | ||
1827 | version = "0.1.1" | ||
1828 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1829 | checksum = "5e0f8c7178e13481ff6765bd169b33e8d554c5d2bbede5e32c356194be02b9b9" | ||
1830 | dependencies = [ | ||
1831 | "lazy_static", | ||
1832 | "log", | ||
1833 | "tracing-core", | ||
1834 | ] | ||
1835 | |||
1836 | [[package]] | ||
1837 | name = "tracing-serde" | ||
1838 | version = "0.1.1" | ||
1839 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1840 | checksum = "b6ccba2f8f16e0ed268fc765d9b7ff22e965e7185d32f8f1ec8294fe17d86e79" | ||
1841 | dependencies = [ | ||
1842 | "serde", | ||
1843 | "tracing-core", | ||
1844 | ] | ||
1845 | |||
1846 | [[package]] | ||
1847 | name = "tracing-subscriber" | ||
1848 | version = "0.2.6" | ||
1849 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1850 | checksum = "04a11b459109e38ff6e1b580bafef4142a11d44889f5d07424cbce2fd2a2a119" | ||
1851 | dependencies = [ | ||
1852 | "ansi_term", | ||
1853 | "chrono", | ||
1854 | "lazy_static", | ||
1855 | "matchers", | ||
1856 | "regex", | ||
1857 | "serde", | ||
1858 | "serde_json", | ||
1859 | "sharded-slab", | ||
1860 | "smallvec", | ||
1861 | "tracing-core", | ||
1862 | "tracing-log", | ||
1863 | "tracing-serde", | ||
1864 | ] | ||
1865 | |||
1866 | [[package]] | ||
1713 | name = "unicode-bidi" | 1867 | name = "unicode-bidi" |
1714 | version = "0.3.4" | 1868 | version = "0.3.4" |
1715 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1869 | source = "registry+https://github.com/rust-lang/crates.io-index" |
diff --git a/crates/ra_hir_ty/Cargo.toml b/crates/ra_hir_ty/Cargo.toml index 112fcd07e..407322dc1 100644 --- a/crates/ra_hir_ty/Cargo.toml +++ b/crates/ra_hir_ty/Cargo.toml | |||
@@ -27,8 +27,8 @@ test_utils = { path = "../test_utils" } | |||
27 | 27 | ||
28 | scoped-tls = "1" | 28 | scoped-tls = "1" |
29 | 29 | ||
30 | chalk-solve = "0.11" | 30 | chalk-solve = { version = "0.15.0-dev.0", git = "https://github.com/rust-lang/chalk" } |
31 | chalk-ir = "0.11" | 31 | chalk-ir = { version = "0.15.0-dev.0", git = "https://github.com/rust-lang/chalk" } |
32 | 32 | ||
33 | [dev-dependencies] | 33 | [dev-dependencies] |
34 | insta = "0.16.0" | 34 | insta = "0.16.0" |
diff --git a/crates/ra_hir_ty/src/tests/coercion.rs b/crates/ra_hir_ty/src/tests/coercion.rs index a2601c68a..5a1c6ccc3 100644 --- a/crates/ra_hir_ty/src/tests/coercion.rs +++ b/crates/ra_hir_ty/src/tests/coercion.rs | |||
@@ -664,6 +664,8 @@ fn test() { | |||
664 | fn coerce_unsize_trait_object() { | 664 | fn coerce_unsize_trait_object() { |
665 | assert_snapshot!( | 665 | assert_snapshot!( |
666 | infer_with_mismatches(r#" | 666 | infer_with_mismatches(r#" |
667 | #[lang = "sized"] | ||
668 | pub trait Sized {} | ||
667 | #[lang = "unsize"] | 669 | #[lang = "unsize"] |
668 | pub trait Unsize<T> {} | 670 | pub trait Unsize<T> {} |
669 | #[lang = "coerce_unsized"] | 671 | #[lang = "coerce_unsized"] |
@@ -689,19 +691,19 @@ fn test() { | |||
689 | } | 691 | } |
690 | "#, true), | 692 | "#, true), |
691 | @r###" | 693 | @r###" |
692 | 387..572 '{ ...bj2; }': () | 694 | 424..609 '{ ...bj2; }': () |
693 | 397..400 'obj': &dyn Baz<i8, i16> | 695 | 434..437 'obj': &dyn Baz<i8, i16> |
694 | 422..424 '&S': &S<i8, i16> | 696 | 459..461 '&S': &S<i8, i16> |
695 | 423..424 'S': S<i8, i16> | 697 | 460..461 'S': S<i8, i16> |
696 | 434..437 'obj': &dyn Bar<usize, i8, i16> | 698 | 471..474 'obj': &dyn Bar<usize, i8, i16> |
697 | 459..462 'obj': &dyn Baz<i8, i16> | 699 | 496..499 'obj': &dyn Baz<i8, i16> |
698 | 472..475 'obj': &dyn Foo<i8, usize> | 700 | 509..512 'obj': &dyn Foo<i8, usize> |
699 | 494..497 'obj': &dyn Bar<usize, i8, i16> | 701 | 531..534 'obj': &dyn Bar<usize, i8, i16> |
700 | 507..511 'obj2': &dyn Baz<i8, i16> | 702 | 544..548 'obj2': &dyn Baz<i8, i16> |
701 | 533..535 '&S': &S<i8, i16> | 703 | 570..572 '&S': &S<i8, i16> |
702 | 534..535 'S': S<i8, i16> | 704 | 571..572 'S': S<i8, i16> |
703 | 545..546 '_': &dyn Foo<i8, usize> | 705 | 582..583 '_': &dyn Foo<i8, usize> |
704 | 565..569 'obj2': &dyn Baz<i8, i16> | 706 | 602..606 'obj2': &dyn Baz<i8, i16> |
705 | "### | 707 | "### |
706 | ); | 708 | ); |
707 | } | 709 | } |
@@ -710,6 +712,8 @@ fn test() { | |||
710 | fn coerce_unsize_super_trait_cycle() { | 712 | fn coerce_unsize_super_trait_cycle() { |
711 | assert_snapshot!( | 713 | assert_snapshot!( |
712 | infer_with_mismatches(r#" | 714 | infer_with_mismatches(r#" |
715 | #[lang = "sized"] | ||
716 | pub trait Sized {} | ||
713 | #[lang = "unsize"] | 717 | #[lang = "unsize"] |
714 | pub trait Unsize<T> {} | 718 | pub trait Unsize<T> {} |
715 | #[lang = "coerce_unsized"] | 719 | #[lang = "coerce_unsized"] |
@@ -734,12 +738,12 @@ fn test() { | |||
734 | } | 738 | } |
735 | "#, true), | 739 | "#, true), |
736 | @r###" | 740 | @r###" |
737 | 291..347 '{ ...obj; }': () | 741 | 328..384 '{ ...obj; }': () |
738 | 301..304 'obj': &dyn D | 742 | 338..341 'obj': &dyn D |
739 | 315..317 '&S': &S | 743 | 352..354 '&S': &S |
740 | 316..317 'S': S | 744 | 353..354 'S': S |
741 | 327..330 'obj': &dyn A | 745 | 364..367 'obj': &dyn A |
742 | 341..344 'obj': &dyn D | 746 | 378..381 'obj': &dyn D |
743 | "### | 747 | "### |
744 | ); | 748 | ); |
745 | } | 749 | } |
diff --git a/crates/ra_hir_ty/src/tests/traits.rs b/crates/ra_hir_ty/src/tests/traits.rs index 646e1715c..71c0c2d27 100644 --- a/crates/ra_hir_ty/src/tests/traits.rs +++ b/crates/ra_hir_ty/src/tests/traits.rs | |||
@@ -1753,11 +1753,11 @@ fn test() { | |||
1753 | 384..500 '{ ...(f); }': () | 1753 | 384..500 '{ ...(f); }': () |
1754 | 394..397 'bar': Bar<fn(u8) -> u32> | 1754 | 394..397 'bar': Bar<fn(u8) -> u32> |
1755 | 423..426 'bar': Bar<fn(u8) -> u32> | 1755 | 423..426 'bar': Bar<fn(u8) -> u32> |
1756 | 423..432 'bar.foo()': {unknown} | 1756 | 423..432 'bar.foo()': (u8, u32) |
1757 | 443..446 'opt': Opt<u8> | 1757 | 443..446 'opt': Opt<u8> |
1758 | 465..466 'f': fn(u8) -> u32 | 1758 | 465..466 'f': fn(u8) -> u32 |
1759 | 487..490 'opt': Opt<u8> | 1759 | 487..490 'opt': Opt<u8> |
1760 | 487..497 'opt.map(f)': Opt<FnOnce::Output<fn(u8) -> u32, (u8,)>> | 1760 | 487..497 'opt.map(f)': Opt<u32> |
1761 | 495..496 'f': fn(u8) -> u32 | 1761 | 495..496 'f': fn(u8) -> u32 |
1762 | "### | 1762 | "### |
1763 | ); | 1763 | ); |
@@ -1830,9 +1830,9 @@ fn test() { | |||
1830 | 634..643 'Lazy::new': fn new<Foo, fn() -> Foo>(fn() -> Foo) -> Lazy<Foo, fn() -> Foo> | 1830 | 634..643 'Lazy::new': fn new<Foo, fn() -> Foo>(fn() -> Foo) -> Lazy<Foo, fn() -> Foo> |
1831 | 634..660 'Lazy::...n_ptr)': Lazy<Foo, fn() -> Foo> | 1831 | 634..660 'Lazy::...n_ptr)': Lazy<Foo, fn() -> Foo> |
1832 | 644..659 'make_foo_fn_ptr': fn() -> Foo | 1832 | 644..659 'make_foo_fn_ptr': fn() -> Foo |
1833 | 670..672 'r2': {unknown} | 1833 | 670..672 'r2': usize |
1834 | 675..680 'lazy2': Lazy<Foo, fn() -> Foo> | 1834 | 675..680 'lazy2': Lazy<Foo, fn() -> Foo> |
1835 | 675..686 'lazy2.foo()': {unknown} | 1835 | 675..686 'lazy2.foo()': usize |
1836 | 549..551 '{}': () | 1836 | 549..551 '{}': () |
1837 | "### | 1837 | "### |
1838 | ); | 1838 | ); |
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs index 2f35d6d49..8ef4941c0 100644 --- a/crates/ra_hir_ty/src/traits/chalk.rs +++ b/crates/ra_hir_ty/src/traits/chalk.rs | |||
@@ -48,6 +48,9 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> { | |||
48 | fn adt_datum(&self, struct_id: AdtId) -> Arc<StructDatum> { | 48 | fn adt_datum(&self, struct_id: AdtId) -> Arc<StructDatum> { |
49 | self.db.struct_datum(self.krate, struct_id) | 49 | self.db.struct_datum(self.krate, struct_id) |
50 | } | 50 | } |
51 | fn adt_repr(&self, _struct_id: AdtId) -> rust_ir::AdtRepr { | ||
52 | unreachable!() | ||
53 | } | ||
51 | fn impl_datum(&self, impl_id: ImplId) -> Arc<ImplDatum> { | 54 | fn impl_datum(&self, impl_id: ImplId) -> Arc<ImplDatum> { |
52 | self.db.impl_datum(self.krate, impl_id) | 55 | self.db.impl_datum(self.krate, impl_id) |
53 | } | 56 | } |
@@ -128,8 +131,7 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> { | |||
128 | well_known_trait: rust_ir::WellKnownTrait, | 131 | well_known_trait: rust_ir::WellKnownTrait, |
129 | ) -> Option<chalk_ir::TraitId<Interner>> { | 132 | ) -> Option<chalk_ir::TraitId<Interner>> { |
130 | let lang_attr = lang_attr_from_well_known_trait(well_known_trait); | 133 | let lang_attr = lang_attr_from_well_known_trait(well_known_trait); |
131 | let lang_items = self.db.crate_lang_items(self.krate); | 134 | let trait_ = match self.db.lang_item(self.krate, lang_attr.into()) { |
132 | let trait_ = match lang_items.target(lang_attr) { | ||
133 | Some(LangItemTarget::TraitId(trait_)) => trait_, | 135 | Some(LangItemTarget::TraitId(trait_)) => trait_, |
134 | _ => return None, | 136 | _ => return None, |
135 | }; | 137 | }; |
@@ -186,6 +188,39 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> { | |||
186 | // FIXME: implement actual object safety | 188 | // FIXME: implement actual object safety |
187 | true | 189 | true |
188 | } | 190 | } |
191 | |||
192 | fn closure_kind( | ||
193 | &self, | ||
194 | _closure_id: chalk_ir::ClosureId<Interner>, | ||
195 | _substs: &chalk_ir::Substitution<Interner>, | ||
196 | ) -> rust_ir::ClosureKind { | ||
197 | // FIXME: implement closure support | ||
198 | unimplemented!() | ||
199 | } | ||
200 | fn closure_inputs_and_output( | ||
201 | &self, | ||
202 | _closure_id: chalk_ir::ClosureId<Interner>, | ||
203 | _substs: &chalk_ir::Substitution<Interner>, | ||
204 | ) -> chalk_ir::Binders<rust_ir::FnDefInputsAndOutputDatum<Interner>> { | ||
205 | // FIXME: implement closure support | ||
206 | unimplemented!() | ||
207 | } | ||
208 | fn closure_upvars( | ||
209 | &self, | ||
210 | _closure_id: chalk_ir::ClosureId<Interner>, | ||
211 | _substs: &chalk_ir::Substitution<Interner>, | ||
212 | ) -> chalk_ir::Binders<chalk_ir::Ty<Interner>> { | ||
213 | // FIXME: implement closure support | ||
214 | unimplemented!() | ||
215 | } | ||
216 | fn closure_fn_substitution( | ||
217 | &self, | ||
218 | _closure_id: chalk_ir::ClosureId<Interner>, | ||
219 | _substs: &chalk_ir::Substitution<Interner>, | ||
220 | ) -> chalk_ir::Substitution<Interner> { | ||
221 | // FIXME: implement closure support | ||
222 | unimplemented!() | ||
223 | } | ||
189 | } | 224 | } |
190 | 225 | ||
191 | pub(crate) fn program_clauses_for_chalk_env_query( | 226 | pub(crate) fn program_clauses_for_chalk_env_query( |
@@ -250,7 +285,7 @@ pub(crate) fn trait_datum_query( | |||
250 | upstream: trait_.lookup(db.upcast()).container.module(db.upcast()).krate != krate, | 285 | upstream: trait_.lookup(db.upcast()).container.module(db.upcast()).krate != krate, |
251 | non_enumerable: true, | 286 | non_enumerable: true, |
252 | coinductive: false, // only relevant for Chalk testing | 287 | coinductive: false, // only relevant for Chalk testing |
253 | // FIXME set these flags correctly | 288 | // FIXME: set these flags correctly |
254 | marker: false, | 289 | marker: false, |
255 | fundamental: false, | 290 | fundamental: false, |
256 | }; | 291 | }; |
@@ -272,20 +307,28 @@ pub(crate) fn trait_datum_query( | |||
272 | 307 | ||
273 | fn well_known_trait_from_lang_attr(name: &str) -> Option<WellKnownTrait> { | 308 | fn well_known_trait_from_lang_attr(name: &str) -> Option<WellKnownTrait> { |
274 | Some(match name { | 309 | Some(match name { |
275 | "sized" => WellKnownTrait::SizedTrait, | 310 | "sized" => WellKnownTrait::Sized, |
276 | "copy" => WellKnownTrait::CopyTrait, | 311 | "copy" => WellKnownTrait::Copy, |
277 | "clone" => WellKnownTrait::CloneTrait, | 312 | "clone" => WellKnownTrait::Clone, |
278 | "drop" => WellKnownTrait::DropTrait, | 313 | "drop" => WellKnownTrait::Drop, |
314 | "fn_once" => WellKnownTrait::FnOnce, | ||
315 | "fn_mut" => WellKnownTrait::FnMut, | ||
316 | "fn" => WellKnownTrait::Fn, | ||
317 | "unsize" => WellKnownTrait::Unsize, | ||
279 | _ => return None, | 318 | _ => return None, |
280 | }) | 319 | }) |
281 | } | 320 | } |
282 | 321 | ||
283 | fn lang_attr_from_well_known_trait(attr: WellKnownTrait) -> &'static str { | 322 | fn lang_attr_from_well_known_trait(attr: WellKnownTrait) -> &'static str { |
284 | match attr { | 323 | match attr { |
285 | WellKnownTrait::SizedTrait => "sized", | 324 | WellKnownTrait::Sized => "sized", |
286 | WellKnownTrait::CopyTrait => "copy", | 325 | WellKnownTrait::Copy => "copy", |
287 | WellKnownTrait::CloneTrait => "clone", | 326 | WellKnownTrait::Clone => "clone", |
288 | WellKnownTrait::DropTrait => "drop", | 327 | WellKnownTrait::Drop => "drop", |
328 | WellKnownTrait::FnOnce => "fn_once", | ||
329 | WellKnownTrait::FnMut => "fn_mut", | ||
330 | WellKnownTrait::Fn => "fn", | ||
331 | WellKnownTrait::Unsize => "unsize", | ||
289 | } | 332 | } |
290 | } | 333 | } |
291 | 334 | ||
@@ -309,8 +352,9 @@ pub(crate) fn struct_datum_query( | |||
309 | .unwrap_or_else(Vec::new); | 352 | .unwrap_or_else(Vec::new); |
310 | let flags = rust_ir::AdtFlags { | 353 | let flags = rust_ir::AdtFlags { |
311 | upstream, | 354 | upstream, |
312 | // FIXME set fundamental flag correctly | 355 | // FIXME set fundamental and phantom_data flags correctly |
313 | fundamental: false, | 356 | fundamental: false, |
357 | phantom_data: false, | ||
314 | }; | 358 | }; |
315 | let struct_datum_bound = rust_ir::AdtDatumBound { | 359 | let struct_datum_bound = rust_ir::AdtDatumBound { |
316 | fields: Vec::new(), // FIXME add fields (only relevant for auto traits) | 360 | fields: Vec::new(), // FIXME add fields (only relevant for auto traits) |
@@ -448,11 +492,23 @@ pub(crate) fn fn_def_datum_query( | |||
448 | let where_clauses = convert_where_clauses(db, callable_def.into(), &bound_vars); | 492 | let where_clauses = convert_where_clauses(db, callable_def.into(), &bound_vars); |
449 | let bound = rust_ir::FnDefDatumBound { | 493 | let bound = rust_ir::FnDefDatumBound { |
450 | // Note: Chalk doesn't actually use this information yet as far as I am aware, but we provide it anyway | 494 | // Note: Chalk doesn't actually use this information yet as far as I am aware, but we provide it anyway |
451 | argument_types: sig.value.params().iter().map(|ty| ty.clone().to_chalk(db)).collect(), | 495 | inputs_and_output: make_binders( |
452 | return_type: sig.value.ret().clone().to_chalk(db), | 496 | rust_ir::FnDefInputsAndOutputDatum { |
497 | argument_types: sig | ||
498 | .value | ||
499 | .params() | ||
500 | .iter() | ||
501 | .map(|ty| ty.clone().to_chalk(db)) | ||
502 | .collect(), | ||
503 | return_type: sig.value.ret().clone().to_chalk(db), | ||
504 | } | ||
505 | .shifted_in(&Interner), | ||
506 | 0, | ||
507 | ), | ||
453 | where_clauses, | 508 | where_clauses, |
454 | }; | 509 | }; |
455 | let datum = FnDefDatum { id: fn_def_id, binders: make_binders(bound, sig.num_binders) }; | 510 | let datum = |
511 | FnDefDatum { id: fn_def_id, binders: make_binders(bound, sig.num_binders), abi: () }; | ||
456 | Arc::new(datum) | 512 | Arc::new(datum) |
457 | } | 513 | } |
458 | 514 | ||
diff --git a/crates/ra_hir_ty/src/traits/chalk/interner.rs b/crates/ra_hir_ty/src/traits/chalk/interner.rs index 56aab640c..15426b022 100644 --- a/crates/ra_hir_ty/src/traits/chalk/interner.rs +++ b/crates/ra_hir_ty/src/traits/chalk/interner.rs | |||
@@ -42,6 +42,7 @@ impl chalk_ir::interner::Interner for Interner { | |||
42 | type DefId = InternId; | 42 | type DefId = InternId; |
43 | type InternedAdtId = crate::TypeCtorId; | 43 | type InternedAdtId = crate::TypeCtorId; |
44 | type Identifier = TypeAliasId; | 44 | type Identifier = TypeAliasId; |
45 | type FnAbi = (); | ||
45 | 46 | ||
46 | fn debug_adt_id(type_kind_id: AdtId, fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> { | 47 | fn debug_adt_id(type_kind_id: AdtId, fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> { |
47 | tls::with_current_program(|prog| Some(prog?.debug_struct_id(type_kind_id, fmt))) | 48 | tls::with_current_program(|prog| Some(prog?.debug_struct_id(type_kind_id, fmt))) |
diff --git a/crates/ra_hir_ty/src/traits/chalk/mapping.rs b/crates/ra_hir_ty/src/traits/chalk/mapping.rs index 18e5c9c16..ac82ea831 100644 --- a/crates/ra_hir_ty/src/traits/chalk/mapping.rs +++ b/crates/ra_hir_ty/src/traits/chalk/mapping.rs | |||
@@ -65,7 +65,10 @@ impl ToChalk for Ty { | |||
65 | &Interner, | 65 | &Interner, |
66 | predicates.iter().filter(|p| !p.is_error()).cloned().map(|p| p.to_chalk(db)), | 66 | predicates.iter().filter(|p| !p.is_error()).cloned().map(|p| p.to_chalk(db)), |
67 | ); | 67 | ); |
68 | let bounded_ty = chalk_ir::DynTy { bounds: make_binders(where_clauses, 1) }; | 68 | let bounded_ty = chalk_ir::DynTy { |
69 | bounds: make_binders(where_clauses, 1), | ||
70 | lifetime: LIFETIME_PLACEHOLDER.to_lifetime(&Interner), | ||
71 | }; | ||
69 | chalk_ir::TyData::Dyn(bounded_ty).intern(&Interner) | 72 | chalk_ir::TyData::Dyn(bounded_ty).intern(&Interner) |
70 | } | 73 | } |
71 | Ty::Opaque(opaque_ty) => { | 74 | Ty::Opaque(opaque_ty) => { |
@@ -319,6 +322,10 @@ impl ToChalk for TypeCtor { | |||
319 | // this should not be reached, since we don't represent TypeName::Error with TypeCtor | 322 | // this should not be reached, since we don't represent TypeName::Error with TypeCtor |
320 | unreachable!() | 323 | unreachable!() |
321 | } | 324 | } |
325 | TypeName::Closure(_) => { | ||
326 | // FIXME: implement closure support | ||
327 | unreachable!() | ||
328 | } | ||
322 | } | 329 | } |
323 | } | 330 | } |
324 | } | 331 | } |