Commit 2f1a4b3
authored
Rollup merge of rust-lang#66305 - elichai:2019-11-array_ffi, r=eddyb
Add by-value arrays to `improper_ctypes` lint
Hi,
C doesn't have a notion of passing arrays by value, only by reference/pointer.
Rust currently will pass it correctly by reference by it looks very misleading, and can confuse the borrow checker to think a move had occurred.
Fixes rust-lang#58905 and fixes rust-lang#24578.
We could also improve the borrow checker here but I think it's kinda a waste of work if we instead just tell the user it's an invalid FFI call.
(My first PR to `rustc` so if I missed some test or formatting guideline please tell me :) )File tree
3 files changed
+62
-6
lines changed- src
- librustc_lint
- test/ui/lint
3 files changed
+62
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
591 | 591 | | |
592 | 592 | | |
593 | 593 | | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
594 | 611 | | |
595 | 612 | | |
596 | 613 | | |
| |||
825 | 842 | | |
826 | 843 | | |
827 | 844 | | |
828 | | - | |
| 845 | + | |
829 | 846 | | |
830 | 847 | | |
831 | 848 | | |
| |||
937 | 954 | | |
938 | 955 | | |
939 | 956 | | |
940 | | - | |
| 957 | + | |
941 | 958 | | |
942 | 959 | | |
943 | 960 | | |
| |||
948 | 965 | | |
949 | 966 | | |
950 | 967 | | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
951 | 975 | | |
952 | 976 | | |
953 | 977 | | |
| |||
966 | 990 | | |
967 | 991 | | |
968 | 992 | | |
969 | | - | |
| 993 | + | |
970 | 994 | | |
971 | 995 | | |
972 | 996 | | |
973 | 997 | | |
974 | 998 | | |
975 | | - | |
| 999 | + | |
976 | 1000 | | |
977 | 1001 | | |
978 | 1002 | | |
979 | 1003 | | |
980 | 1004 | | |
981 | 1005 | | |
982 | 1006 | | |
983 | | - | |
| 1007 | + | |
984 | 1008 | | |
985 | 1009 | | |
986 | 1010 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
68 | 72 | | |
69 | 73 | | |
70 | 74 | | |
| |||
83 | 87 | | |
84 | 88 | | |
85 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
86 | 93 | | |
87 | 94 | | |
88 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
201 | 226 | | |
0 commit comments