aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/tests/method_resolution.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-09-16 18:07:05 +0100
committerGitHub <[email protected]>2020-09-16 18:07:05 +0100
commit5df69d903445319bc01a32c93eb4175da5bb94d2 (patch)
treed18c72869b502fae938fa23d00a28ef229c02f89 /crates/hir_ty/src/tests/method_resolution.rs
parentb14bf68ce62bc712ed9ca9f977dd7efbd6fe4fd7 (diff)
parent3fff5aa4d72df9775baca32f54728da8cb6c31ed (diff)
Merge #5993
5993: Update chalk to 0.27 and add support for extern opaque types. r=crlf0710 a=crlf0710 Co-authored-by: Charles Lew <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/tests/method_resolution.rs')
-rw-r--r--crates/hir_ty/src/tests/method_resolution.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/crates/hir_ty/src/tests/method_resolution.rs b/crates/hir_ty/src/tests/method_resolution.rs
index 23b2601e6..0f17ff151 100644
--- a/crates/hir_ty/src/tests/method_resolution.rs
+++ b/crates/hir_ty/src/tests/method_resolution.rs
@@ -1051,3 +1051,39 @@ fn dyn_trait_super_trait_not_in_scope() {
1051 "#]], 1051 "#]],
1052 ); 1052 );
1053} 1053}
1054
1055#[test]
1056fn method_resolution_foreign_opaque_type() {
1057 check_infer(
1058 r#"
1059 extern "C" {
1060 type S;
1061 fn f() -> &'static S;
1062 }
1063
1064 impl S {
1065 fn foo(&self) -> bool {
1066 true
1067 }
1068 }
1069
1070 fn test() {
1071 let s = unsafe { f() };
1072 s.foo();
1073 }
1074 "#,
1075 expect![[r#"
1076 75..79 'self': &S
1077 89..109 '{ ... }': bool
1078 99..103 'true': bool
1079 123..167 '{ ...o(); }': ()
1080 133..134 's': &S
1081 137..151 'unsafe { f() }': &S
1082 144..151 '{ f() }': &S
1083 146..147 'f': fn f() -> &S
1084 146..149 'f()': &S
1085 157..158 's': &S
1086 157..164 's.foo()': bool
1087 "#]],
1088 );
1089}