rust/src
bors e629dba0ee Auto merge of #28256 - petrochenkov:conv, r=alexcrichton
This patch transforms functions of the form
```
fn f<Generic: AsRef<Concrete>>(arg: Generic) {
	let arg: &Concrete = arg.as_ref();
	// Code using arg
}
```
to the next form:
```
#[inline]
fn f<Generic: AsRef<Concrete>>(arg: Generic) {
	fn f_inner(arg: &Concrete) {
		// Code using arg
	}
	
	f_inner(arg.as_ref());
}
```

Therefore, most of the code is concrete and not duplicated during monomorphisation (unless inlined)
and only the tiny bit of conversion code is duplicated. This method was mentioned by @aturon in the
Conversion Traits RFC (https://github.com/rust-lang/rfcs/blame/master/text/0529-conversion-traits.md#L249) and similar techniques are not uncommon in C++ template libraries.

This patch goes to the extremes and applies the transformation even to smaller functions<sup>1</sup>
for purity of the experiment. *Some of them can be rolled back* if considered too ridiculous.

<sup>1</sup> However who knows how small are these functions are after inlining and everything.

The functions in question are mostly `fs`/`os` functions and not used especially often with variety
of argument types, so the code size reduction is rather small (but consistent). Here are the sizes
of stage2 artifacts before and after the patch:
https://gist.github.com/petrochenkov/e76a6b280f382da13c5d
https://gist.github.com/petrochenkov/6cc28727d5256dbdfed0

Note:
All the `inner` functions are concrete and unavailable for cross-crate inlining, some of them may
need `#[inline]` annotations in the future.

r? @aturon
2015-09-14 22:21:41 +00:00
..
compiler-rt@58ab642c30
compiletest
doc Update musl build in light of llvm 3.7 release 2015-09-13 14:57:54 +01:00
driver
error-index-generator
etc Add a comment to explain the #[inline(never)] annotation 2015-09-12 17:05:29 +02:00
grammar
jemalloc@e24a1a025a
liballoc std: Stabilize/deprecate features for 1.4 2015-09-11 09:48:48 -07:00
liballoc_jemalloc
liballoc_system
libarena std: Internalize almost all of std::rt 2015-09-11 11:19:20 -07:00
libbacktrace
libcollections std: Stabilize/deprecate features for 1.4 2015-09-11 09:48:48 -07:00
libcollectionstest
libcore Auto merge of #28248 - PeterReid:master, r=alexcrichton 2015-09-14 17:10:09 +00:00
libcoretest std: Stabilize/deprecate features for 1.4 2015-09-11 09:48:48 -07:00
libflate
libfmt_macros some code improvements in libfmt_macros 2015-09-11 19:44:06 +03:00
libgetopts
libgraphviz manual fixups 2015-09-11 20:41:09 +12:00
liblibc
liblog Auto merge of #28339 - alexcrichton:stabilize-1.4, r=aturon 2015-09-13 19:45:15 +00:00
librand
librbml
librustc Auto merge of #28396 - arielb1:misplaced-binding, r=eddyb 2015-09-14 06:51:18 +00:00
librustc_back Auto merge of #28256 - petrochenkov:conv, r=alexcrichton 2015-09-14 22:21:41 +00:00
librustc_bitflags
librustc_borrowck Treat loans of 'static data as extending to the end of the enclosing 2015-09-09 16:04:55 -04:00
librustc_data_structures
librustc_driver
librustc_front
librustc_lint
librustc_llvm
librustc_mir
librustc_platform_intrinsics Add a comment to explain the #[inline(never)] annotation 2015-09-12 17:05:29 +02:00
librustc_privacy Add error code for private struct field issue 2015-09-10 14:19:01 +02:00
librustc_resolve std: Stabilize/deprecate features for 1.4 2015-09-11 09:48:48 -07:00
librustc_trans Auto merge of #28358 - dotdash:nounwind, r=alexcrichton 2015-09-14 11:05:34 +00:00
librustc_typeck Auto merge of #28396 - arielb1:misplaced-binding, r=eddyb 2015-09-14 06:51:18 +00:00
librustc_unicode
librustdoc rustdoc: Tweak the main template and CSS for semantic mark-up. 2015-09-09 00:49:23 +09:00
libserialize
libstd Auto merge of #28256 - petrochenkov:conv, r=alexcrichton 2015-09-14 22:21:41 +00:00
libsyntax Auto merge of #28247 - christopherdumas:fix_28243, r=eddyb 2015-09-14 20:37:49 +00:00
libterm
libtest Reverted for-loop, it messes up type inference 2015-09-08 09:02:04 +02:00
llvm@3c88bf78f9 Rwind LLVM 2015-09-12 15:26:50 -07:00
rt
rust-installer@c37d3747da
rustbook
rustllvm Update LLVM to fix nightly build failures 2015-09-11 17:40:37 +02:00
test Auto merge of #28247 - christopherdumas:fix_28243, r=eddyb 2015-09-14 20:37:49 +00:00
snapshots.txt