aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/tests.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-05-05 13:42:12 +0100
committerFlorian Diebold <[email protected]>2019-05-11 15:21:20 +0100
commit58b68966bf0e0d5ae5c56e2da1d6def5e0ec0925 (patch)
tree2d92dbadd7f6cbf756766040eec8685688415241 /crates/ra_hir/src/ty/tests.rs
parent50bbf9eb09dc34781cc34e10bfba5f154e833123 (diff)
Handle resolution errors in where clauses
This is slightly hacky, but maybe more elegant than alternative solutions: We just use a hardcoded Chalk trait ID which we special-case to have no impls.
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r--crates/ra_hir/src/ty/tests.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index c3edf42b1..3c55a093f 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -2502,6 +2502,21 @@ fn test() { (&S).foo()<|>; }
2502} 2502}
2503 2503
2504#[test] 2504#[test]
2505fn method_resolution_where_clause_for_unknown_trait() {
2506 // The blanket impl shouldn't apply because we can't even resolve UnknownTrait
2507 let t = type_at(
2508 r#"
2509//- /main.rs
2510trait Trait { fn foo(self) -> u128; }
2511struct S;
2512impl<T> Trait for T where T: UnknownTrait {}
2513fn test() { (&S).foo()<|>; }
2514"#,
2515 );
2516 assert_eq!(t, "{unknown}");
2517}
2518
2519#[test]
2505fn method_resolution_where_clause_not_met() { 2520fn method_resolution_where_clause_not_met() {
2506 // The blanket impl shouldn't apply because we can't prove S: Clone 2521 // The blanket impl shouldn't apply because we can't prove S: Clone
2507 let t = type_at( 2522 let t = type_at(