Skip to content

Commit

Permalink
Upgrade Chalk
Browse files Browse the repository at this point in the history
Fixes #4072.
  • Loading branch information
flodiebold committed May 29, 2020
1 parent 190a059 commit ab28f6c
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 22 deletions.
20 changes: 5 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/ra_hir_ty/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ test_utils = { path = "../test_utils" }

scoped-tls = "1"

chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "5a3b871ca17529ab5aa5787594fabad1634936cb" }
chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "5a3b871ca17529ab5aa5787594fabad1634936cb" }
chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "329b7f3fdd2431ed6f6778cde53f22374c7d094c" }
chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "329b7f3fdd2431ed6f6778cde53f22374c7d094c" }

[dev-dependencies]
insta = "0.16.0"
54 changes: 49 additions & 5 deletions crates/ra_hir_ty/src/tests/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2665,7 +2665,6 @@ fn test() {
Enum::Variant.test();
}
"#, true),
// wrong result, because the built-in Copy impl for fn defs doesn't exist in Chalk yet
@r###"
42..44 '{}': ()
61..62 'T': {unknown}
Expand All @@ -2674,13 +2673,13 @@ fn test() {
146..150 'self': &Self
202..282 '{ ...t(); }': ()
208..211 'foo': fn foo()
208..218 'foo.test()': {unknown}
208..218 'foo.test()': bool
224..227 'bar': fn bar<{unknown}>({unknown}) -> {unknown}
224..234 'bar.test()': {unknown}
224..234 'bar.test()': bool
240..246 'Struct': Struct(usize) -> Struct
240..253 'Struct.test()': {unknown}
240..253 'Struct.test()': bool
259..272 'Enum::Variant': Variant(usize) -> Enum
259..279 'Enum::...test()': {unknown}
259..279 'Enum::...test()': bool
"###
);
}
Expand Down Expand Up @@ -2754,3 +2753,48 @@ fn test() {
"###
);
}

#[test]
fn integer_range_iterate() {
let t = type_at(
r#"
//- /main.rs crate:main deps:std
fn test() {
for x in 0..100 { x<|>; }
}
//- /std.rs crate:std
pub mod ops {
pub struct Range<Idx> {
pub start: Idx,
pub end: Idx,
}
}
pub mod iter {
pub trait Iterator {
type Item;
}
pub trait IntoIterator {
type Item;
type IntoIter: Iterator<Item = Self::Item>;
}
impl<T> IntoIterator for T where T: Iterator {
type Item = <T as Iterator>::Item;
type IntoIter = Self;
}
}
trait Step {}
impl Step for i32 {}
impl Step for i64 {}
impl<A: Step> iter::Iterator for ops::Range<A> {
type Item = A;
}
"#,
);
assert_eq!(t, "i32");
}

0 comments on commit ab28f6c

Please sign in to comment.