File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
branches/dist-snap/src/rustc/middle Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9
9
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10
- refs/heads/dist-snap: 8d4928f7808813de62fefcb89139bfb7382b250b
10
+ refs/heads/dist-snap: 53abb5edbd2079fdcc1c2887cf0a89aad75d6ea1
11
11
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
12
12
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -1090,12 +1090,22 @@ pure fn mach_sty(cfg: @session::config, t: t) -> sty {
1090
1090
}
1091
1091
1092
1092
fn default_arg_mode_for_ty ( tcx : ctxt , ty : ty:: t ) -> ast:: rmode {
1093
- if ty:: type_is_immediate ( ty) {
1093
+ return if ty:: type_is_immediate ( ty) {
1094
1094
ast:: by_val
1095
- } else if tcx. legacy_modes {
1095
+ } else if tcx. legacy_modes || type_is_fn ( ty) {
1096
+ // ^^^^^^^^^^^^^^
1097
+ // FIXME(#2202) --- We retain by-ref by default to workaround a memory
1098
+ // leak that otherwise results when @fn is upcast to &fn.
1096
1099
ast:: by_ref
1097
1100
} else {
1098
1101
ast:: by_copy
1102
+ } ;
1103
+
1104
+ fn type_is_fn ( ty : t ) -> bool {
1105
+ match get ( ty) . sty {
1106
+ ty_fn( * ) => true ,
1107
+ _ => false
1108
+ }
1099
1109
}
1100
1110
}
1101
1111
You can’t perform that action at this time.
0 commit comments