aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2020-05-29 15:49:52 +0100
committerFlorian Diebold <[email protected]>2020-05-29 15:49:52 +0100
commitab28f6c24909f2424c6f1d85d1518fa4269fbaae (patch)
tree7b9b79c8652b3b2193caf5a7158cfd853925e14b /crates
parent190a0595a478d059fdd95a179fe38d59cb6379be (diff)
Upgrade Chalk
Fixes #4072.
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir_ty/Cargo.toml4
-rw-r--r--crates/ra_hir_ty/src/tests/traits.rs54
2 files changed, 51 insertions, 7 deletions
diff --git a/crates/ra_hir_ty/Cargo.toml b/crates/ra_hir_ty/Cargo.toml
index 6afed58a1..4b8dcdc07 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
28scoped-tls = "1" 28scoped-tls = "1"
29 29
30chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "5a3b871ca17529ab5aa5787594fabad1634936cb" } 30chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "329b7f3fdd2431ed6f6778cde53f22374c7d094c" }
31chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "5a3b871ca17529ab5aa5787594fabad1634936cb" } 31chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "329b7f3fdd2431ed6f6778cde53f22374c7d094c" }
32 32
33[dev-dependencies] 33[dev-dependencies]
34insta = "0.16.0" 34insta = "0.16.0"
diff --git a/crates/ra_hir_ty/src/tests/traits.rs b/crates/ra_hir_ty/src/tests/traits.rs
index 0419bc751..e8778d419 100644
--- a/crates/ra_hir_ty/src/tests/traits.rs
+++ b/crates/ra_hir_ty/src/tests/traits.rs
@@ -2665,7 +2665,6 @@ fn test() {
2665 Enum::Variant.test(); 2665 Enum::Variant.test();
2666} 2666}
2667"#, true), 2667"#, true),
2668 // wrong result, because the built-in Copy impl for fn defs doesn't exist in Chalk yet
2669 @r###" 2668 @r###"
2670 42..44 '{}': () 2669 42..44 '{}': ()
2671 61..62 'T': {unknown} 2670 61..62 'T': {unknown}
@@ -2674,13 +2673,13 @@ fn test() {
2674 146..150 'self': &Self 2673 146..150 'self': &Self
2675 202..282 '{ ...t(); }': () 2674 202..282 '{ ...t(); }': ()
2676 208..211 'foo': fn foo() 2675 208..211 'foo': fn foo()
2677 208..218 'foo.test()': {unknown} 2676 208..218 'foo.test()': bool
2678 224..227 'bar': fn bar<{unknown}>({unknown}) -> {unknown} 2677 224..227 'bar': fn bar<{unknown}>({unknown}) -> {unknown}
2679 224..234 'bar.test()': {unknown} 2678 224..234 'bar.test()': bool
2680 240..246 'Struct': Struct(usize) -> Struct 2679 240..246 'Struct': Struct(usize) -> Struct
2681 240..253 'Struct.test()': {unknown} 2680 240..253 'Struct.test()': bool
2682 259..272 'Enum::Variant': Variant(usize) -> Enum 2681 259..272 'Enum::Variant': Variant(usize) -> Enum
2683 259..279 'Enum::...test()': {unknown} 2682 259..279 'Enum::...test()': bool
2684 "### 2683 "###
2685 ); 2684 );
2686} 2685}
@@ -2754,3 +2753,48 @@ fn test() {
2754 "### 2753 "###
2755 ); 2754 );
2756} 2755}
2756
2757#[test]
2758fn integer_range_iterate() {
2759 let t = type_at(
2760 r#"
2761//- /main.rs crate:main deps:std
2762fn test() {
2763 for x in 0..100 { x<|>; }
2764}
2765
2766//- /std.rs crate:std
2767pub mod ops {
2768 pub struct Range<Idx> {
2769 pub start: Idx,
2770 pub end: Idx,
2771 }
2772}
2773
2774pub mod iter {
2775 pub trait Iterator {
2776 type Item;
2777 }
2778
2779 pub trait IntoIterator {
2780 type Item;
2781 type IntoIter: Iterator<Item = Self::Item>;
2782 }
2783
2784 impl<T> IntoIterator for T where T: Iterator {
2785 type Item = <T as Iterator>::Item;
2786 type IntoIter = Self;
2787 }
2788}
2789
2790trait Step {}
2791impl Step for i32 {}
2792impl Step for i64 {}
2793
2794impl<A: Step> iter::Iterator for ops::Range<A> {
2795 type Item = A;
2796}
2797"#,
2798 );
2799 assert_eq!(t, "i32");
2800}