about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2018-11-30Add libstd and libcore Cargo features "panic_immediate_abort"Vitaly _Vi Shukela-2/+18
It stop asserts and panics from libstd to automatically include string output and formatting code. Use case: developing static executables smaller than 50 kilobytes, where usual formatting code is excessive while keeping debuggability in debug mode. May resolve #54981.
2018-11-29Auto merge of #49878 - dlrobertson:va_list_pt0, r=eddybbors-0/+8
libcore: Add VaList and variadic arg handling intrinsics ## Summary - Add intrinsics for `va_start`, `va_end`, `va_copy`, and `va_arg`. - Add `core::va_list::VaList` to `libcore`. Part 1 of (at least) 3 for #44930 Comments and critiques are very much welcomed šŸ˜„
2018-11-29Rollup merge of #56319 - RalfJung:async-mutable-ref, r=cramertjGuillaume Gomez-2/+2
fix futures creating aliasing mutable and shared ref Fixes the problem described in https://github.com/solson/miri/issues/532#issuecomment-442552764: `set_task_waker` takes a shared reference and puts a copy into the TLS (in a `NonNull`), but `get_task_waker` gets it back out as a mutable reference. That violates "mutable references must not alias anything"!
2018-11-29Rollup merge of #56294 - polyfloyd:fix-typo-ffi-doc, r=sfacklerGuillaume Gomez-2/+2
Fix a typo in the documentation of std::ffi
2018-11-29Rollup merge of #56289 - marius:patch-1, r=cramertjGuillaume Gomez-1/+1
Fix small typo in comment of thread::stack_size
2018-11-29Rollup merge of #56149 - ariasuni:improve-amctime-doc, r=TimNNGuillaume Gomez-12/+24
Make std::os::unix/linux::fs::MetadataExt::a/m/ctime* documentation clearer I was confused by this API so I clarified what they are doing. I was wondering if I should try to unify more documentation and examples between `unix` and `linux` (e.g. ā€œof the fileā€ is used in `unix` to refer to the file these metadata is for, ā€œof this fileā€ in `linux`, ā€œof the underlying fileā€ in `std::fs::File`).
2018-11-29Rollup merge of #56124 - antoine-de:fix_read_to_end_doc_mistake, r=TimNNGuillaume Gomez-1/+1
Fix small doc mistake on std::io::read::read_to_end The std::io::read main documentation can lead to error because the buffer is prefilled with 10 zeros that will pad the response. Using an empty vector is better. The `read_to_end` documentation is already correct though. This is my first rust PR, don't hesitate to tell me if I did something wrong.
2018-11-28fix futures aliasing mutable and shared refRalf Jung-2/+2
2018-11-28get_ref -> get_mutRalf Jung-8/+8
2018-11-28fix buildRalf Jung-5/+13
2018-11-28put the MaybeUninit inside the UnsafeCellRalf Jung-10/+7
2018-11-27Fix a typo in the documentation of std::ffipolyfloyd-2/+2
2018-11-27Fix small typo in commentMarius Nuennerich-1/+1
2018-11-27add comments explaining our uses of get_ref/get_mut for MaybeUninitRalf Jung-0/+3
2018-11-27add missing featureRalf Jung-0/+1
2018-11-27fix buildRalf Jung-1/+1
2018-11-27use MaybeUninit instead of mem::uninitialized for Windows MutexRalf Jung-9/+9
2018-11-26libcore: Add va_list lang item and intrinsicsDan Robertson-0/+8
- Add the llvm intrinsics used to manipulate a va_list. - Add the va_list lang item in order to allow implementing VaList in libcore.
2018-11-25Auto merge of #55527 - sgeisler:time-checked-add, r=sfacklerbors-22/+78
Implement checked_add_duration for SystemTime [Original discussion on the rust user forum](https://users.rust-lang.org/t/std-systemtime-misses-a-checked-add-function/21785) Since `SystemTime` is opaque there is no way to check if the result of an addition will be in bounds. That makes the `Add<Duration>` trait completely unusable with untrusted data. This is a big problem because adding a `Duration` to `UNIX_EPOCH` is the standard way of constructing a `SystemTime` from a unix timestamp. This PR implements `checked_add_duration(&self, &Duration) -> Option<SystemTime>` for `std::time::SystemTime` and as a prerequisite also for all platform specific time structs. This also led to the refactoring of many `add_duration(&self, &Duration) -> SystemTime` functions to avoid redundancy (they now unwrap the result of `checked_add_duration`). Some basic unit tests for the newly introduced function were added too. I wasn't sure which stabilization attribute to add to the newly introduced function, so I just chose `#[stable(feature = "time_checked_add", since = "1.32.0")]` for now to make it compile. Please let me know how I should change it or if I violated any other conventions. P.S.: I could only test on Linux so far, so I don't necessarily expect it to compile for all platforms.
2018-11-25Rollup merge of #56151 - alexcrichton:move-out-flaky-test, r=nagisaPietro Albini-36/+0
Move a flaky process test out of libstd This test ensures that everything in `env::vars()` is inherited but that's not actually true because other tests may add env vars after we spawn the process, causing the test to be flaky! This commit moves the test to a run-pass test where it can execute in isolation. Along the way this removes a lot of the platform specificity of the test, using iteslf to print the environment instead of a foreign process.
2018-11-25Rollup merge of #56101 - frewsxcv:frewsxcv-dyn, r=steveklabnikPietro Albini-2/+2
Incorporate `dyn` into more comments and docs. r? @rust-lang/docs
2018-11-23Merge branch 'master' into frewsxcv-dynCorey Farwell-22/+20
2018-11-23make park/unpark example more realisticRalf Jung-4/+15
2018-11-22Fix the tracking issue for hash_raw_entrySteven Fackler-38/+38
It used to point to the implementation PR.
2018-11-22expand thread::park explanationRalf Jung-1/+6
2018-11-22Rollup merge of #55784 - meltinglava:master, r=KodrAusGuillaume Gomez-8/+8
Clarifying documentation for collections::hash_map::Entry::or_insert Previous version does not show that or_insert does not insert the passed value, as the passed value was the same value as what was already in the map.
2018-11-21Move a flaky process test out of libstdAlex Crichton-36/+0
This test ensures that everything in `env::vars()` is inherited but that's not actually true because other tests may add env vars after we spawn the process, causing the test to be flaky! This commit moves the test to a run-pass test where it can execute in isolation. Along the way this removes a lot of the platform specificity of the test, using iteslf to print the environment instead of a foreign process.
2018-11-22Make std::os::unix/linux::fs::MetadataExt::a/m/ctime* documentation clearerariasuni-12/+24
2018-11-21OsStr: clarify `len()` method documentationLyndon Brown-6/+11
2018-11-21OsString: mention storage form in discussionLyndon Brown-0/+7
Helps users to understand capacity related values, which may surpise on Windows. Also is a step towards clarifying understanding of `OsStr`'s len() return value.
2018-11-21Remove trailing whitespaceBastian Gruber-1/+1
2018-11-21Adjust doc commentsBastian Gruber-21/+10
2018-11-21update various stdlib docsSteve Klabnik-11/+9
2018-11-21fix small doc mistakeantoine-de-1/+1
The std::io::read main documentation can lead to error because the buffer is prefilled with 10 zeros that will pad the response. Using an empty vector is better. The `read_to_end` documentation is already correct though. This is my first rust PR, don't hesitate to tell me if I did something wrong.
2018-11-21Update style of commentsBastian Gruber-14/+26
2018-11-21Update commentsBastian Gruber-4/+2
2018-11-21Remove 'unsafe' commentsBastian Gruber-3/+0
2018-11-21Document `From` implementationsBastian Gruber-0/+24
2018-11-20fix more linksSteve Klabnik-5/+5
2018-11-20Incorporate `dyn` into more comments and docs.Corey Farwell-2/+2
2018-11-19Rollup merge of #56059 - alexcrichton:fix-tests, r=sfacklerkennytm-1/+1
Increase `Duration` approximate equal threshold to 1us Previously this threshold when testing was 100ns, but the Windows documentation states: > which is a high resolution (<1us) time stamp which presumably means that we could have up to 1us resolution, which means that 100ns doesn't capture "equivalent" time intervals due to various bits of rounding here and there. It's hoped that this.. Closes #56034
2018-11-19Rollup merge of #56011 - CBenoit:master, r=QuietMisdreavusPietro Albini-1/+1
Replace data.clone() by Arc::clone(&data) in mutex doc. Arc::clone(&from) is considered as more idiomatic because it conveys more explicitly the meaning of the code. Since this clone is visible in the official documentation, I thought it could be better to use the more idiomatic version.
2018-11-18Increase `Duration` approximate equal threshold to 1usAlex Crichton-1/+1
Previously this threshold when testing was 100ns, but the Windows documentation states: > which is a high resolution (<1us) time stamp which presumably means that we could have up to 1us resolution, which means that 100ns doesn't capture "equivalent" time intervals due to various bits of rounding here and there. It's hoped that this.. Closes #56034
2018-11-17std: Add debugging for a failing test on appveyorAlex Crichton-1/+5
I'm not sure why this is failing, so let's hopefully get some more information to help investigation!
2018-11-16Replace data.clone() by Arc::clone(&data) in mutex doc.BenoƮt C-1/+1
Arc::clone(&from) is considered as more idiomatic because it conveys more explicitly the meaning of the code.
2018-11-15use ? operator instead of matchSebastian Geisler-20/+6
2018-11-15Rename checked_add_duration to checked_add and make it take the duration by ↵Sebastian Geisler-5/+5
value
2018-11-15Implement checked_add_duration for SystemTimeSebastian Geisler-22/+92
Since SystemTime is opaque there is no way to check if the result of an addition will be in bounds. That makes the Add<Duration> trait completely unusable with untrusted data. This is a big problem because adding a Duration to UNIX_EPOCH is the standard way of constructing a SystemTime from a unix timestamp. This commit implements checked_add_duration(&self, &Duration) -> Option<SystemTime> for std::time::SystemTime and as a prerequisite also for all platform specific time structs. This also led to the refactoring of many add_duration(&self, &Duration) -> SystemTime functions to avoid redundancy (they now unwrap the result of checked_add_duration). Some basic unit tests for the newly introduced function were added too.
2018-11-15Rollup merge of #55901 - euclio:speling, r=petrochenkovPietro Albini-11/+11
fix various typos in doc comments
2018-11-15Rollup merge of #55865 - RalfJung:unix-rwlock, r=alexcrichtonPietro Albini-3/+3
Unix RwLock: avoid racy access to write_locked We should only access `write_locked` if we really got the lock.