File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -1051,3 +1051,41 @@ fn dyn_trait_super_trait_not_in_scope() {
10511051 "# ] ] ,
10521052 ) ;
10531053}
1054+
1055+ #[ test]
1056+ fn 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+ // FIXME: 's.foo()' should be `bool`.
1076+ expect ! [ [ r#"
1077+ 75..79 'self': &S
1078+ 89..109 '{ ... }': bool
1079+ 99..103 'true': bool
1080+ 123..167 '{ ...o(); }': ()
1081+ 133..134 's': &S
1082+ 137..151 'unsafe { f() }': &S
1083+ 144..151 '{ f() }': &S
1084+ 146..147 'f': fn f() -> &S
1085+ 146..149 'f()': &S
1086+ 157..158 's': &S
1087+ 157..164 's.foo()': {unknown}
1088+ "# ] ] ,
1089+ ) ;
1090+ }
1091+
You can’t perform that action at this time.
0 commit comments