about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2015-07-14Auto merge of #27024 - bluss:io-drain, r=alexcrichtonbors-8/+2
Use Vec::drain in BufWriter I happened past a comment that asked for functionality that we now have.
2015-07-14Use Vec::drain in BufWriterUlrik Sverdrup-8/+2
I happened past a comment that asked for functionality that we now have.
2015-07-13Auto merge of #26241 - SimonSapin:derefmut-for-string, r=alexcrichtonbors-8/+60
See https://github.com/rust-lang/rfcs/issues/1157
2015-07-13Implement IndexMut for String and str.Simon Sapin-0/+4
... matching the existing Index impls. There is no reason not to if String implement DerefMut. The code removed in `src/librustc/middle/effect.rs` was added in #9750 to prevent things like `s[0] = 0x80` where `s: String`, but I belive became unnecessary when the Index(Mut) traits were introduced.
2015-07-13Add more tests for AsciiExt::is_asciiSimon Sapin-8/+11
2015-07-13Add tests for AsciiExt::make_ascii_*case, including on String.Simon Sapin-0/+45
2015-07-12Auto merge of #26958 - alexcrichton:down-with-thread-dtors, r=brsonbors-2/+19
TLS tests have been deadlocking on the OSX bots for quite some time now and this commit is the result of the investigation into what's going on. It turns out that a value in TLS which is being destroyed (e.g. the destructor is run) can be reset back to the initial state **while the destructor is running** if TLS is re-accessed. To fix this we stop calling drop_in_place on OSX and instead move the data to a temporary location on the stack.
2015-07-12std: Fix a TLS destructor bug on OSXAlex Crichton-2/+19
TLS tests have been deadlocking on the OSX bots for quite some time now and this commit is the result of the investigation into what's going on. It turns out that a value in TLS which is being destroyed (e.g. the destructor is run) can be reset back to the initial state **while the destructor is running** if TLS is re-accessed. To fix this we stop calling drop_in_place on OSX and instead move the data to a temporary location on the stack.
2015-07-12Auto merge of #26957 - wesleywiser:rename_connect_to_join, r=alexcrichtonbors-1/+1
Fixes #26900
2015-07-12Auto merge of #26965 - bluss:cstring-debug, r=alexcrichtonbors-4/+16
Use escaped byte string representation for CString Debug Faithfully represent the contents of the CString and CStr in their Debug impl, by treating them as byte strings with our default escaping to ascii representation. Add impl Debug for CStr. Fixes #26964.
2015-07-12Rollup merge of #26979 - tshepang:trim, r=GankroManish Goregaokar-4/+0
- It is clear that what follows are re-exports - There aren't so many re-exports that examples should be given
2015-07-12Auto merge of #26972 - jethrogb:patch-1, r=alexcrichtonbors-2/+6
The File object needs to be writable for the set_len to succeed.
2015-07-12Auto merge of #26959 - dhuseby:i686-unknown-freebsd, r=alexcrichtonbors-7/+9
this adds support for i686-unknown-freebsd target.
2015-07-12doc: remove redundant infoTshepang Lekhonkhobe-4/+0
- It is clear that what follows are re-exports - There aren't so many re-exports that examples should be given
2015-07-11Change std::fs::File.set_len example and documentationjethrogb-2/+6
The File object needs to be writable for the truncate to succeed.
2015-07-11Use escaped byte string representation for CString DebugUlrik Sverdrup-4/+16
Faithfully represent the contents of the CString and CStr in their Debug impl, by treating them as byte strings with our default escaping to ascii representation. Add impl Debug for Cstr. Fixes #26964.
2015-07-11fixing trailing whitespaceDave Huseby-1/+1
2015-07-11Rollup merge of #26936 - bluss:doc-array, r=steveklabnikManish Goregaokar-4/+4
Small tweaks for the documentation of the primitive type array Follow up to PR #26923, fix a few small details.
2015-07-11adding support for i686-unknown-freebsd targetDave Huseby-7/+9
2015-07-11Auto merge of #26903 - steveklabnik:io_function_docs, r=alexcricthonbors-19/+158
This round: io::Result and the free functions.
2015-07-11Auto merge of #26945 - steveklabnik:doc_io_bufreader, r=alexcrichtonbors-4/+77
Mostly just adding basic examples, what's there seems mostly good. r? @alexcrichton
2015-07-11Auto merge of #26929 - alexcrichton:windows-dir-junction, r=brsonbors-35/+225
Previously on Windows a directory junction would return false from `is_dir`, causing various odd behavior, specifically calls to `create_dir_all` might fail when they would otherwise continue to succeed. Closes #26716
2015-07-11Auto merge of #26941 - fhartwig:osx-file-debug, r=alexcrichtonbors-3/+15
This makes `Debug` for `File` show the file path and access mode of the file on OS X, just like on Linux. I'd be happy about any feedback how to make this code better. In particular, I'm not sure how to handle the buffer passed to `fnctl`. This way works, but it feels a bit cumbersome. `fcntl` unfortunately doesn't return the length of the path.
2015-07-10Change some instances of .connect() to .join()Wesley Wiser-1/+1
2015-07-10More docs for std::io::BufReaderSteve Klabnik-4/+77
2015-07-10Auto merge of #26896 - tbu-:pr_getcwd, r=alexcrichtonbors-20/+26
(On Windows, it works already.)
2015-07-10std: Consider directory junctions as directoriesAlex Crichton-35/+225
Previously on Windows a directory junction would return false from `is_dir`, causing various odd behavior, specifically calls to `create_dir_all` might fail when they would otherwise continue to succeed. Closes #26716
2015-07-10Auto merge of #26928 - reem:cstr-is-a-cow, r=Gankrobors-2/+40
This allows CString and CStr to be used with the Cow type, which is extremely useful when interfacing with C libraries that make extensive use of C-style strings.
2015-07-10Add more std::io documentation.Steve Klabnik-19/+158
This round: io::Result and the free functions.
2015-07-10Show file name and access mode in Debug instance for File on OS XFlorian Hartwig-3/+15
2015-07-10Small tweaks for the documentation of the primitive type arrayUlrik Sverdrup-4/+4
2015-07-10Auto merge of #26751 - retep998:copy-that-floppy, r=alexcrichtonbors-16/+93
Using the OS mechanism for copying files allows the OS to optimize the transfer using stuff such as [Offloaded Data Transfers (ODX)](https://msdn.microsoft.com/en-us/library/windows/desktop/hh848056%28v=vs.85%29.aspx). Also preserves a lot more information, including NTFS [File Streams](https://msdn.microsoft.com/en-us/library/windows/desktop/aa364404%28v=vs.85%29.aspx), which the manual implementation threw away. In addition, it is an atomic operation, unlike the manual implementation which has extra calls for copying over permissions. r? @alexcrichton
2015-07-10Remove the generic `fill_bytes_buf` functionTobias Bucher-31/+13
2015-07-10Use CopyFileEx for fs::copy on WindowsPeter Atashian-16/+93
Adds a couple more tests for fs::copy Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-07-09Test that CStr and CString have equivalent hashes.Jonathan Reem-1/+16
2015-07-09Implement Borrow<CStr> for CString and ToOwned for CStrJonathan Reem-1/+24
This allows CString and CStr to be used with the Cow type, which is extremely useful when interfacing with C libraries that make extensive use of C-style strings.
2015-07-09Expand documentation for the primitive type arrayUlrik Sverdrup-6/+35
2015-07-09Auto merge of #26766 - jespino:add-more-filetypes, r=alexcrichtonbors-2/+28
I find that isn't supported on the current API and I think is necesary. It is my first PR to rust (I'm not a rust expert and I'm not sure if this is the better way to propose this thinks), of course any suggestion of change will be welcome. I'm almost sure that in windows aren't supported this filetypes, then, i put in the api of win::fs the functions with a fixed false in the response, I hope this is correct.
2015-07-09Auto merge of #26814 - tshepang:array-examples, r=blussbors-0/+13
2015-07-09Address some comments on the pull requestTobias Bucher-40/+25
2015-07-09Auto merge of #26904 - bluss:no-repeat, r=alexcrichtonbors-7/+7
In a followup to PR #26849, improve one more location for I/O where we can use `Vec::resize` to ensure better performance when zeroing buffers. Use the `vec![elt; n]` macro everywhere we can in the tree. It replaces `repeat(elt).take(n).collect()` which is more verbose, requires type hints, and right now produces worse code. `vec![]` is preferable for vector initialization. The `vec![]` replacement touches upon one I/O path too, Stdin::read for windows, and that should be a small improvement. r? @alexcrichton
2015-07-09Use vec![elt; n] where possibleUlrik Sverdrup-5/+4
The common pattern `iter::repeat(elt).take(n).collect::<Vec<_>>()` is exactly equivalent to `vec![elt; n]`, do this replacement in the whole tree. (Actually, vec![] is smart enough to only call clone n - 1 times, while the former solution would call clone n times, and this fact is virtually irrelevant in practice.)
2015-07-09Add FileTypeUnix trait to add unix special file typesJesús Espino-2/+28
2015-07-09io: Use Vec::resize in Cursor<Vec<u8>> for more efficient zero fillUlrik Sverdrup-2/+3
Vec::resize compiles to better code than .extend(repeat(0).take(n)) does right now.
2015-07-08Auto merge of #26849 - bluss:read-to-end-memset, r=alexcrichtonbors-6/+12
Improve zerofill in Vec::resize and Read::read_to_end We needed a more efficient way to zerofill the vector in read_to_end. This to reduce the memory intialization overhead to a minimum. Use the implementation of `std::vec::from_elem` (used for the vec![] macro) for Vec::resize as well. For simple element types like u8, this compiles to memset, so it makes Vec::resize much more efficient.
2015-07-08Make `std::env::current_dir` work for path names longer than 2048 bytes on ↵Tobias Bucher-10/+49
non-Windows
2015-07-08io: Simplify BufReader::with_capacityUlrik Sverdrup-4/+1
Use the vec![] macro directly to create a sized, zeroed vector. This should result in a big speedup when creating BufReader, because vec![0; cap] compiles to a memset call, while the previous extend code currently did not.
2015-07-08Improve Vec::resize so that it can be used in Read::read_to_endUlrik Sverdrup-2/+11
We needed a more efficient way to zerofill the vector in read_to_end. This to reduce the memory intialization overhead to a minimum. Use the implementation of `std::vec::from_elem` (used for the vec![] macro) for Vec::resize as well. For simple element types like u8, this compiles to memset, so it makes Vec::resize much more efficient.
2015-07-08Rollup merge of #26784 - birkenfeld:patch-2, r=steveklabnikSteve Klabnik-8/+8
* fix probable copy-paste error in BufWriter.get_mut() * more consistent punctuation
2015-07-06Auto merge of #26741 - alexcrichton:noinline-destructors, r=brsonbors-8/+20
This PR was originally going to be a "let's start running tests on MSVC" PR, but it didn't quite get to that point. It instead gets us ~80% of the way there! The steps taken in this PR are: * Landing pads are turned on by default for 64-bit MSVC. The LLVM support is "good enough" with the caveat the destructor glue is now marked noinline. This was recommended [on the associated bug](https://llvm.org/bugs/show_bug.cgi?id=23884) as a stopgap until LLVM has a better representation for exception handling in MSVC. The consequence of this is that MSVC will have a bit of a perf hit, but there are possible routes we can take if this workaround sticks around for too long. * The linker (`link.exe`) is now looked up in the Windows Registry if it's not otherwise available in the environment. This improves using the compiler outside of a VS shell (e.g. in a MSYS shell or in a vanilla cmd.exe shell). This also makes cross compiles via Cargo "just work" when crossing between 32 and 64 bit! * TLS destructors were fixed to start running on MSVC (they previously weren't running at all) * A few assorted `run-pass` tests were fixed. * The dependency on the `rust_builtin` library was removed entirely for MSVC to try to prevent any `cl.exe` compiled objects get into the standard library. This should help us later remove any dependence on the CRT by the standard library. * I re-added `rust_try_msvc_32.ll` for 32-bit MSVC and ensured that landing pads were turned off by default there as well. Despite landing pads being enabled, there are still *many* failing tests on MSVC. The two major classes I've identified so far are: * Spurious aborts. It appears that when optimizations are enabled that landing pads aren't always lined up properly, and sometimes an exception being thrown can't find the catch block down the stack, causing the program to abort. I've been working to reduce this test case but haven't been met with great success just yet. * Parallel codegen does not work on MSVC. Our current strategy is to take the N object files emitted by the N codegen threads and use `ld -r` to assemble them into *one* object file. The MSVC linker, however, does not have this ability, and this will need to be rearchitected to work on MSVC. I will fix parallel codegen in a future PR, and I'll also be watching LLVM closely to see if the aborts... disappear!