summary refs log tree commit diff
path: root/src/libstd/sys/windows
AgeCommit message (Collapse)AuthorLines
2018-04-24Rollup merge of #49829 - ecstatic-morse:os-docs, r=steveklabnikkennytm-11/+21
Add doc links to `std::os` extension traits Addresses a small subset of #29367. This adds documentation links to the original type for various OS-specific extension traits, and uses a common sentence for introducing such traits (which now consistently ends in a period).
2018-04-16Auto merge of #49488 - alexcrichton:small-wasm-panic, r=sfacklerbors-0/+4
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.
2018-04-17Rollup merge of #49646 - glandium:uninitialized-box, r=alexcrichtonkennytm-1/+1
Use box syntax instead of Box::new in Mutex::remutex on Windows The Box::new(mem::uninitialized()) pattern actually actively copies uninitialized bytes from the stack into the box, which is a waste of time. Using the box syntax instead avoids the useless copy.
2018-04-14Prefer unprefixed paths for well known structsDylan MacKenzie-8/+8
2018-04-14Add doc links to `std::os` extension traitsDylan MacKenzie-13/+23
Add documentation links to the original type for various OS-specific extension traits and normalize the language for introducing such traits. Also, remove some outdated comments around the extension trait definitions.
2018-04-13std: Minimize size of panicking on wasmAlex Crichton-0/+4
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.
2018-04-12Import the `alloc` crate as `alloc_crate` in stdSimon Sapin-2/+2
… to make the name `alloc` available.
2018-04-07Rollup merge of #49702 - alexcrichton:inline-methods, r=Mark-Simulacrumkennytm-0/+1
std: Inline some Termination-related methods These were showing up in tests and in binaries but are trivially optimize-able away, so add `#[inline]` attributes so LLVM has an opportunity to optimize them out.
2018-04-05Rollup merge of #49686 - memoryleak47:typo, r=alexcrichtonAlex Crichton-1/+1
typos
2018-04-05std: Inline some Termination-related methodsAlex Crichton-0/+1
These were showing up in tests and in binaries but are trivially optimize-able away, so add `#[inline]` attributes so LLVM has an opportunity to optimize them out.
2018-04-05typosmemoryleak47-1/+1
2018-04-04Use box syntax instead of Box::new in Mutex::remutex on WindowsMike Hommey-1/+1
The Box::new(mem::uninitialized()) pattern actually actively copies uninitialized bytes from the stack into the box, which is a waste of time. Using the box syntax instead avoids the useless copy.
2018-04-04Auto merge of #48575 - ishitatsuyuki:unix-no-thread, r=alexcrichtonbors-0/+1
rustc_driver: get rid of the extra thread **Do not rollup** We can alter the stack size afterwards on Unix. Having a separate thread causes poor debugging experience when interrupting with signals. I have to get the backtrace of the all thread, as the main thread is waiting to join doing nothing else. This patch allows me to just run `bt` to get the desired backtrace.
2018-03-28Auto merge of #49460 - kennytm:rollup, r=kennytmbors-0/+5
Rollup of 12 pull requests - Successful merges: #49243, #49329, #49364, #49400, #49405, #49427, #49428, #49429, #49439, #49442, #49444, #49452 - Failed merges:
2018-03-28Auto merge of #49357 - frewsxcv:frewsxcv-termination-doc-examples, ↵bors-49/+49
r=GuillaumeGomez Remove hidden `foo` functions from doc examples; use `Termination` trait. Fixes https://github.com/rust-lang/rust/issues/49233. Easier to review with the white-space ignoring `?w=1` feature: https://github.com/rust-lang/rust/pull/49357/files?w=1
2018-03-28Remove hidden `foo` functions from doc examples; use `Termination` trait.Corey Farwell-49/+49
Fixes https://github.com/rust-lang/rust/issues/49233.
2018-03-27Implement `shrink_to` method on collectionsDiggory Blake-0/+5
2018-03-24Fix build on non-Unix platformsTatsuyuki Ishi-0/+1
2018-03-21Deprecate the AsciiExt trait in favor of inherent methodsSimon Sapin-1/+0
The trait and some of its methods are stable and will remain. Some of the newer methods are unstable and can be removed later. Fixes https://github.com/rust-lang/rust/issues/39658
2018-03-03Move process::ExitCode internals to sysScott McMurray-1/+13
Now begins the saga of fixing compilation errors on other platforms...
2018-02-17Auto merge of #47956 - retep998:is-nibbles, r=BurntSushibors-21/+44
This is the ideal FileType on Windows. You may not like it, but this is what peak performance looks like. Theoretically this would fix https://github.com/rust-lang/rust/issues/46484 The current iteration of this PR should not cause existing code to break, but instead merely improves handling around reparse points. Specifically... * Reparse points are considered to be symbolic links if they have the name surrogate bit set. Name surrogates are reparse points that effectively act like symbolic links, redirecting you to a different directory/file. By checking for this bit instead of specific tags, we become much more general in our handling of reparse points, including those added by third parties. * If something is a reparse point but does not have the name surrogate bit set, then we ignore the fact that it is a reparse point because it is actually a file or directory directly there, despite having additional handling by drivers due to the reparse point. * For everything which is not a symbolic link (including non-surrogate reparse points) we report whether it is a directory or a file based on the presence of the directory attribute bit. * Notably this still preserves invariant that when `is_symlink` returns `true`, both `is_dir` and `is_file` will return `false`. The potential for breakage was far too high. * Adds an unstable `FileTypeExt` to allow users to determine whether a symbolic link is a directory or a file, since `FileType` by design is incapable of reporting this information.
2018-02-11Add an unstable FileTypeExt extension trait for WindowsPeter Atashian-0/+21
2018-02-03Somehow this function got flipped aroundPeter Atashian-3/+3
Unflip it
2018-02-03Go back to files directories and symlinks being mutually exclusivePeter Atashian-13/+17
Be smarter about what a symlink is however
2018-02-01This internal only method is no longer needed.Peter Atashian-3/+0
2018-02-01Rewrite remove_dir_all to be correctPeter Atashian-3/+5
The fact that this had to be rewritten does not bode well
2018-02-01This is what FileType on Windows should ideally be.Peter Atashian-20/+19
2018-01-31Use a range to identify SIGSEGV in stack guardsJosh Stone-2/+3
Previously, the `guard::init()` and `guard::current()` functions were returning a `usize` address representing the top of the stack guard, respectively for the main thread and for spawned threads. The `SIGSEGV` handler on `unix` targets checked if a fault was within one page below that address, if so reporting it as a stack overflow. Now `unix` targets report a `Range<usize>` representing the guard memory, so it can cover arbitrary guard sizes. Non-`unix` targets which always return `None` for guards now do so with `Option<!>`, so they don't pay any overhead. For `linux-gnu` in particular, the previous guard upper-bound was `stackaddr + guardsize`, as the protected memory was *inside* the stack. This was a glibc bug, and starting from 2.27 they are moving the guard *past* the end of the stack. However, there's no simple way for us to know where the guard page actually lies, so now we declare it as the whole range of `stackaddr ± guardsize`, and any fault therein will be called a stack overflow. This fixes #47863.
2018-01-26Print inlined functions on WindowsJohn Kåre Alsaker-37/+52
2018-01-07Replace empty array hack with repr(align)Robin Kruppe-11/+3
As a side effect, this fixes the warning about repr(C, simd) that has been reported during x86_64 windows builds since #47111 (see also: #47103)
2017-12-31Auto merge of #46713 - Manishearth:memchr, r=blussbors-1/+1
Use memchr to speed up [u8]::contains 3x None
2017-12-25Auto merge of #46914 - mikeyhew:raw_pointer_self, r=arielb1bors-1/+1
Convert warning about `*const _` to a future-compat lint #46664 was merged before I could convert the soft warning about method lookup on `*const _` into a future-compatibility lint. This PR makes that change. fixes #46837 tracking issue for the future-compatibility lint: #46906 r? @arielb1
2017-12-24Auto merge of #46789 - Diggsey:command-env-capture, r=dtolnaybors-47/+59
Capture `Command` environment at spawn Fixes #28975 This tracks a set of changes to the environment and then replays them at spawn time.
2017-12-24Capture environment at spawnDiggory Blake-47/+59
2017-12-23Annotate raw pointer target typesChristopher Durham-1/+1
cc https://github.com/rust-lang/rust/issues/46906 cc https://github.com/rust-lang/rust/pull/46914
2017-12-19Add Hash impl for SystemTime and InstantVitaly _Vi Shukela-1/+8
Closes #46670.
2017-12-13Move rust memchr impl to libcoreManish Goregaokar-1/+1
2017-11-25Implement `Rc`/`Arc` conversions for string-like typesMurarth-0/+24
Provides the following conversion implementations: * `From<`{`CString`,`&CStr`}`>` for {`Arc`,`Rc`}`<CStr>` * `From<`{`OsString`,`&OsStr`}`>` for {`Arc`,`Rc`}`<OsStr>` * `From<`{`PathBuf`,`&Path`}`>` for {`Arc`,`Rc`}`<Path>`
2017-11-24std: Flag Windows TLS dtor symbol as #[used]Alex Crichton-1/+2
Turns out ThinLTO was internalizing this symbol and eliminating it. Worse yet if you compiled with LTO turns out no TLS destructors would run on Windows! The `#[used]` annotation should be a more bulletproof implementation (in the face of LTO) of preserving this symbol all the way through in LLVM and ensuring it makes it all the way to the linker which will take care of it.
2017-11-09std: Avoid use of `libc` in portable modulesAlex Crichton-6/+7
This commit removes usage of the `libc` crate in "portable" modules like those at the top level and `sys_common`. Instead common types like `*mut u8` or `u32` are used instead of `*mut c_void` or `c_int` as well as switching to platform-specific functions like `sys::strlen` instead of `libc::strlen`.
2017-11-08std: Move the `cmath` module into the `sys` moduleAlex Crichton-0/+104
This commit moves the `f32::cmath` and `f64::cmath` modules into the `sys` module. Note that these are not publicly exported modules, simply implementation details. These modules are already platform-specific with shims on MSVC and this is mostly just a reflection of that reality. This should also help cut down on `#[cfg]` traffic if platforms are brought on which don't directly support these functions.
2017-11-08std: Change how EBADF is handled in `sys`Alex Crichton-1/+4
This commit removes the reexport of `EBADF_ERR` as a constant from libstd's portability facade, instead opting for a platform-specific function that specifically queries an `io::Error`. Not all platforms may have a constant for this, so it makes the intent a little more clear that a code need not be supplied, just an answer to a query.
2017-11-08std: Remove `rand` crate and moduleAlex Crichton-39/+27
This commit removes the `rand` crate from the standard library facade as well as the `__rand` module in the standard library. Neither of these were used in any meaningful way in the standard library itself. The only need for randomness in libstd is to initialize the thread-local keys of a `HashMap`, and that unconditionally used `OsRng` defined in the standard library anyway. The cruft of the `rand` crate and the extra `rand` support in the standard library makes libstd slightly more difficult to port to new platforms, namely WebAssembly which doesn't have any randomness at all (without interfacing with JS). The purpose of this commit is to clarify and streamline randomness in libstd, focusing on how it's only required in one location, hashmap seeds. Note that the `rand` crate out of tree has almost always been a drop-in replacement for the `rand` crate in-tree, so any usage (accidental or purposeful) of the crate in-tree should switch to the `rand` crate on crates.io. This then also has the further benefit of avoiding duplication (mostly) between the two crates!
2017-11-05Auto merge of #44042 - LukasKalbertodt:ascii-methods-on-instrinsics, ↵bors-3/+1
r=alexcrichton Copy all `AsciiExt` methods to the primitive types directly in order to deprecate it later **EDIT:** [this PR is ready now](https://github.com/rust-lang/rust/pull/44042#issuecomment-333883548). I edited this post to reflect the current status of discussion, which is (apart from code review) pretty much settled. --- This is my current progress in order to prepare stabilization of #39658. As discussed there (and in #39659), the idea is to deprecated `AsciiExt` and copy all methods to the type directly. Apparently there isn't really a reason to have those methods in an extension trait¹. ~~This is **work in progress**: copy&pasting code while slightly modifying the documentation isn't the most exciting thing to do. Therefore I wanted to already open this WIP PR after doing basically 1/4 of the job (copying methods to `&[u8]`, `char` and `&str` is still missing) to get some feedback before I continue. Some questions possibly worth discussing:~~ 1. ~~Does everyone agree that deprecating `AsciiExt` is a good idea? Does everyone agree with the goal of this PR?~~ => apparently yes 2. ~~Are my changes OK so far? Did I do something wrong?~~ 3. ~~The issue of the unstable-attribute is currently set to 0. I would wait until you say "Ok" to the whole thing, then create a tracking issue and then insert the correct issue id. Is that ok?~~ 4. ~~I tweaked `eq_ignore_ascii_case()`: it now takes the argument `other: u8` instead of `other: &u8`. The latter was enforced by the trait. Since we're not bound to a trait anymore, we can drop the reference, ok?~~ => I reverted this, because the interface has to match the `AsciiExt` interface exactly. ¹ ~~Could it be that we can't write `impl [u8] {}`? This might be the reason for `AsciiExt`. If that is the case: is there a good reason we can't write such an impl block? What can we do instead?~~ => we couldn't at the time this PR was opened, but Simon made it possible. /cc @SimonSapin @zackw
2017-11-04Remove import of now unused AsciiExtLukas Kalbertodt-3/+1
I also replaced a wildcard import with a specific one, while I was at it.
2017-11-03Fix std compile error for windows-gnu targets without `backtrace` featureRolf Karp-2/+2
2017-10-26Rollup merge of #45059 - tmccombs:pid, r=alexcrichtonkennytm-0/+4
Add current_pid function Fixes #44971
2017-10-21Rollup merge of #45419 - steveklabnik:fix-commonmark-renderings, ↵Corey Farwell-1/+1
r=QuietMisdreavus Fix most rendering warnings from switching to CommonMark There's one big one lift, I'm filing a bug for it soon. r? @rust-lang/docs
2017-10-20Fix most rendering warnings from switching to CommonMarksteveklabnik-1/+1
2017-10-18std: Update randomness implementation on WindowsAlex Crichton-46/+10
This commit updates the OS random number generator on Windows to match the upstream implementation in the `rand` crate. First proposed in rust-lang-nursery/rand#111 this implementation uses a "private" API of `RtlGenRandom`. Despite the [documentation][dox] indicating this is a private function its widespread use in Chromium and Firefox as well as [comments] from Microsoft internally indicates that it's highly unlikely to break. Another motivation for switching this is to also attempt to make progress on #44911. It may be the case that this function succeeds while the previous implementation may fail in "weird" scenarios. [dox]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa387694(v=vs.85).aspx [comments]: https://github.com/rust-lang-nursery/rand/issues/111#issuecomment-316140155