diff options
| author | bors <bors@rust-lang.org> | 2018-04-16 23:19:41 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-04-16 23:19:41 +0000 |
| commit | 3809bbf47c8557bd149b3e52ceb47434ca8378d5 (patch) | |
| tree | cb1af67dda415a8c9c9b31ea64100725dafa3221 /src/libstd/sys/windows | |
| parent | 4a3ab8b234cd848b673b64758e4d94bc690f98e0 (diff) | |
| parent | 46d16b66e0b017430eb50b247926ea447c60ef07 (diff) | |
| download | rust-3809bbf47c8557bd149b3e52ceb47434ca8378d5.tar.gz rust-3809bbf47c8557bd149b3e52ceb47434ca8378d5.zip | |
Auto merge of #49488 - alexcrichton:small-wasm-panic, r=sfackler
std: Minimize size of panicking on wasm This commit applies a few code size optimizations for the wasm target to the standard library, namely around panics. We notably know that in most configurations it's impossible for us to print anything in wasm32-unknown-unknown so we can skip larger portions of panicking that are otherwise simply informative. This allows us to get quite a nice size reduction. Finally we can also tweak where the allocation happens for the `Box<Any>` that we panic with. By only allocating once unwinding starts we can reduce the size of a panicking wasm module from 44k to 350 bytes.
Diffstat (limited to 'src/libstd/sys/windows')
| -rw-r--r-- | src/libstd/sys/windows/stdio.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstd/sys/windows/stdio.rs b/src/libstd/sys/windows/stdio.rs index b43df20bddd..81b89da21d3 100644 --- a/src/libstd/sys/windows/stdio.rs +++ b/src/libstd/sys/windows/stdio.rs @@ -227,3 +227,7 @@ pub fn is_ebadf(err: &io::Error) -> bool { // idea is that on windows we use a slightly smaller buffer that's // been seen to be acceptable. pub const STDIN_BUF_SIZE: usize = 8 * 1024; + +pub fn stderr_prints_nothing() -> bool { + false +} |
