about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2018-09-03Fix a few small things, re-word othersiirelu-6/+5
Mostly addressing notes on ambiguous syntax and spurious newlines.
2018-09-03Add keyword docs on constiirelu-1/+56
Turns out writing docs on keywords that are used in multiple different places in entirely different contexts gets a little harder. I put a footnote on `*const` syntax just to make sure you can find it if need be, but it might need more detail.
2018-09-03Add docs for `as` keywordiirelu-0/+27
It's pretty basic and could do with more details, but it's a good starter until someone else improves it.
2018-09-03Flesh out struct keyword docsiirelu-8/+96
The whole keyword docs thing is pretty new in Rust's history and needs some work before it's a shining gem. Here's hoping I can provide that. I basically shoved in a bunch of the most important information from the reference and the book, along with leaving links to both at the end. I don't think keyword docs need to have complete detail, just all the broad strokes, so if someone's confused about a usage of a keyword they can look at the std documentation for that keyword.
2018-09-02Auto merge of #53725 - tbu-:pr_getrandom_syscalls, r=alexcrichtonbors-40/+26
Reduce number of syscalls in `rand` This skips the initial zero-length `getrandom` call and directly hands the user buffer to the operating system, saving one `getrandom` syscall.
2018-09-02Fix an endless loop when `getrandom` is not availableTobias Bucher-0/+1
2018-09-01Auto merge of #53533 - withoutboats:error-source, r=withoutboatsbors-1/+66
Add Error::source method per RFC 2504. This implements part of RFC 2504. * Adds `Error::source`, a replacement for `Error::cause` with the "right" signature, which will be instantly stable. * Deprecates `Error::cause` in 1.33 (this choice was based on the precedent in #52994, which we haven't finalized). * Redefines `Error::cause` to delegate to `Error::source` (the delegation can only go in this direction, not the other). @rfcbot fcp merge
2018-09-01Auto merge of #53884 - kennytm:rollup, r=kennytmbors-21/+21
Rollup of 9 pull requests Successful merges: - #53076 (set cfg(rustdoc) when rustdoc is running on a crate) - #53622 (cleanup: Add main functions to some UI tests) - #53769 (Also link Clippy repo in the CONTRIBUTING.md file) - #53774 (Add rust-gdbgui script.) - #53781 (bench: libcore: fix build failure of any.rs benchmark (use "dyn Any")) - #53782 (Make Arc cloning mechanics clearer in module docs) - #53790 (Add regression test for issue #52060) - #53801 (Prevent duplicated impl on foreign types) - #53850 (Nuke the `const_to_allocation` query)
2018-09-01Rollup merge of #53076 - QuietMisdreavus:cfg-rustdoc, r=GuillaumeGomezkennytm-21/+21
set cfg(rustdoc) when rustdoc is running on a crate When using `#[doc(cfg)]` to document platform-specific items, it's a little cumbersome to get all the platforms' items to appear all at once. For example, the standard library adds `--cfg dox` to rustdoc's command line whenever it builds docs, and the documentation for `#![feature(doc_cfg)]` suggests using a Cargo feature to approximate the same thing. This is a little awkward, because you always need to remember to set `--features dox` whenever you build documentation. This PR proposes making rustdoc set `#[cfg(rustdoc)]` whenever it runs on a crate, to provide an officially-sanctioned version of this that is set automatically. This way, there's a standardized way to declare that a certain version of an item is specifically when building docs. To try to prevent the spread of this feature from happening too quickly, this PR also restricts the use of this flag to whenever `#![feature(doc_cfg)]` is active. I'm sure there are other uses for this, but right now i'm tying it to this feature. (If it makes more sense to give this its own feature, i can easily do that.)
2018-08-31use cfg(rustdoc) instead of cfg(dox) in std and friendsQuietMisdreavus-21/+21
2018-08-31Make `Condvar::new` and `RWLock::new` min const fn for cloudabiOliver Schneider-6/+10
2018-08-31Libstd only has `min_const_fn` const fnsOliver Schneider-1/+2
2018-08-31Implement the `min_const_fn` feature gateOliver Schneider-28/+30
2018-08-30Rollup merge of #53786 - frewsxcv:frewsxcv-bad-style, r=ManishearthPietro Albini-7/+7
Replace usages of 'bad_style' with 'nonstandard_style'. `bad_style` is being deprecated in favor of `nonstandard_style`: - https://github.com/rust-lang/rust/issues/41646
2018-08-30Rollup merge of #53756 - dmerejkowsky:fix-comment, r=KodrAusPietro Albini-1/+1
Fix typo in comment
2018-08-30Rollup merge of #53743 - oconnor663:target_env, r=kennytmPietro Albini-27/+27
fix a typo: taget_env -> target_env This typo was introduced in https://github.com/rust-lang/rust/pull/47334. A couple tests bitrotted as a result, so we fix those too, and move them to a more sensible place. Is there some lint we could turn on that would've caught this? It's a drag that cfg typos can silently pass through the compiler.
2018-08-30Rollup merge of #53389 - RalfJung:thread-join, r=sfacklerPietro Albini-0/+6
document effect of join on memory ordering Fixes https://github.com/rust-lang/rust/issues/45467
2018-08-29Don't leak the file descriptor in `rand`Tobias Bucher-44/+11
2018-08-29Replace usages of 'bad_style' with 'nonstandard_style'.Corey Farwell-7/+7
`bad_style` is being deprecated in favor of `nonstandard_style`: - https://github.com/rust-lang/rust/issues/41646
2018-08-28Fix typo in commentDimitri Merejkowsky-1/+1
2018-08-28split paragraphRalf Jung-3/+5
2018-08-28Auto merge of #53404 - oconnor663:current_dir_behavior, r=alexcrichtonbors-0/+10
document the platform-specific behavior of Command::current_dir See also https://github.com/rust-lang/rust/issues/37868. Here's my initial wording: > Note that if the program path is relative (e.g. `"./script.sh"`), the interaction between that path and `current_dir` varies across platforms. Windows currently ignores `current_dir` when locating the program, but Unix-like systems interpret the program path relative to `current_dir`. These implementation details aren't considered stable, and it's recommended to call `canonicalize` to get an absolute program path instead of using relative paths and `current_dir` together. I'd like to get feedback on: - _Should_ we consider those details stable? It might be disruptive to change them, regardless of what I can get away with claiming in docs :) - Is `canonicalize` an appropriate recommendation? As discussed in #37868 above, there are reasons it's not called automatically in the `Command` implementation.
2018-08-28Auto merge of #53272 - mark-i-m:anon_param_error_now, r=nikomatsakisbors-1/+8
Warn on anon params in 2015 edition cc #41686 https://github.com/rust-lang/rfcs/pull/2522 cc @Centril @nikomatsakis TODO: - [x] Make sure the tests pass. - [x] Make sure there is rustfix-able suggestion. Current plan is to just suggest `_ : Foo` - [x] Add a rustfix ui test. EDIT: It seems I already did the last two in #48309
2018-08-27Auto merge of #53227 - nivkner:pin_move, r=RalfJungbors-3/+5
move the Pin API into its own module for centralized documentation This implements the change proposed by @withoutboats in #49150, as suggested by @RalfJung in the review of #53104, along with the documentation that was originally in it, that was deemed more appropriate in module-level documentation. r? @RalfJung
2018-08-27fix a typo: taget_env -> target_envJack O'Connor-27/+27
This typo was introduced in https://github.com/rust-lang/rust/pull/47334. A couple tests bitrotted as a result, so we fix those too, and move them to a more sensible place.
2018-08-27Auto merge of #53441 - toidiu:ak-fix53419, r=nikomatsakisbors-0/+1
fix for late-bound regions Fix for https://github.com/rust-lang/rust/issues/53419 r? @nikomatsakis
2018-08-27Fix anon param + make it allow-by-defMark Mansi-1/+8
2018-08-27Auto merge of #53640 - alexcrichton:more-symbol-tweaks, r=michaelwoeristerbors-4/+4
rustc: Continue to tweak "std internal symbols" In investigating [an issue][1] with `panic_implementation` defined in an executable that's optimized I once again got to rethinking a bit about the `rustc_std_internal_symbol` attribute as well as weak lang items. We've sort of been non-stop tweaking these items ever since their inception, and this continues to the trend. The crux of the bug was that in the reachability we have a [different branch][2] for non-library builds which meant that weak lang items (and std internal symbols) weren't considered reachable, causing them to get eliminiated by ThinLTO passes. The fix was to basically tweak that branch to consider these symbols to ensure that they're propagated all the way to the linker. Along the way I've attempted to erode the distinction between std internal symbols and weak lang items by having weak lang items automatically configure fields of `CodegenFnAttrs`. That way most code no longer even considers weak lang items and they're simply considered normal functions with attributes about the ABI. In the end this fixes the final comment of #51342 [1]: https://github.com/rust-lang/rust/issues/51342#issuecomment-414368019 [2]: https://github.com/rust-lang/rust/blob/35bf1ae25799a4e62131159f052e0a3cbd27c960/src/librustc/middle/reachable.rs#L225-L238
2018-08-26rustc: Continue to tweak "std internal symbols"Alex Crichton-4/+4
In investigating [an issue][1] with `panic_implementation` defined in an executable that's optimized I once again got to rethinking a bit about the `rustc_std_internal_symbol` attribute as well as weak lang items. We've sort of been non-stop tweaking these items ever since their inception, and this continues to the trend. The crux of the bug was that in the reachability we have a [different branch][2] for non-library builds which meant that weak lang items (and std internal symbols) weren't considered reachable, causing them to get eliminiated by ThinLTO passes. The fix was to basically tweak that branch to consider these symbols to ensure that they're propagated all the way to the linker. Along the way I've attempted to erode the distinction between std internal symbols and weak lang items by having weak lang items automatically configure fields of `CodegenFnAttrs`. That way most code no longer even considers weak lang items and they're simply considered normal functions with attributes about the ABI. In the end this fixes the final comment of #51342 [1]: https://github.com/rust-lang/rust/issues/51342#issuecomment-414368019 [2]: https://github.com/rust-lang/rust/blob/35bf1ae25799a4e62131159f052e0a3cbd27c960/src/librustc/middle/reachable.rs#L225-L238
2018-08-26Reduce number of syscalls in `rand`Tobias Bucher-39/+57
In case that it is statically known that the OS doesn't support `getrandom` (non-Linux) or becomes clear at runtime that `getrandom` isn't available (`ENOSYS`), the opened fd ("/dev/urandom") isn't closed after the function, so that future calls can reuse it. This saves repeated `open`/`close` system calls at the cost of one permanently open fd. Additionally, this skips the initial zero-length `getrandom` call and directly hands the user buffer to the operating system, saving one `getrandom` syscall.
2018-08-26Rollup merge of #53651 - GuillaumeGomez:struct-keyword, r=QuietMisdreavusGuillaume Gomez-0/+21
Add struct keyword doc Slowly, one keyword at a time. r? @QuietMisdreavus
2018-08-26Auto merge of #53619 - japaric:panic-handler, r=SimonSapinbors-2/+4
add #[panic_handler]; deprecate #[panic_implementation] r? @SimonSapin cc #44489
2018-08-24check that adding infer-outlives requirement to all crates worksNiko Matsakis-0/+1
2018-08-24Auto merge of #53662 - kennytm:rollup, r=kennytmbors-0/+2
Rollup of 16 pull requests Successful merges: - #53311 (Window Mutex: Document that we properly initialize the SRWLock) - #53503 (Discourage overuse of mem::forget) - #53545 (Fix #50865: ICE on impl-trait returning functions reaching private items) - #53559 (add macro check for lint) - #53562 (Lament the invincibility of the Turbofish) - #53563 (use String::new() instead of String::from(""), "".to_string(), "".to_owned() or "".into()) - #53592 (docs: minor stylistic changes to str/string docs) - #53594 (Update RELEASES.md to include clippy-preview) - #53600 (Fix a grammatical mistake in "expected generic arguments" errors) - #53614 (update nomicon and book) - #53617 (tidy: Stop requiring a license header) - #53618 (Add missing fmt examples) - #53636 (Prefer `.nth(n)` over `.skip(n).next()`.) - #53644 (Use SmallVec for SmallCStr) - #53664 (Remove unnecessary closure in rustc_mir/build/mod.rs) - #53666 (Added rustc_codegen_llvm to compiler documentation.)
2018-08-24Rollup merge of #53311 - RalfJung:windows-mutex, r=retep998kennytm-0/+2
Window Mutex: Document that we properly initialize the SRWLock See https://github.com/rust-lang/rust/issues/35836
2018-08-23Stabilize 'attr_literals' feature.Sergio Benitez-1/+0
2018-08-23Add struct keyword docGuillaume Gomez-0/+21
2018-08-23add #[panic_handler]; deprecate #[panic_implementation]Jorge Aparicio-2/+4
2018-08-23move pin module to liballoc and reexport thatNiv Kaminer-97/+2
2018-08-23add top-level documentation to the std pin moduleNiv Kaminer-1/+80
2018-08-23move PinBox into pin module and export through stdNiv Kaminer-0/+2
2018-08-23move PinMut into pin module and export through stdNiv Kaminer-3/+19
2018-08-22Allow panicking with string literal messages inside constantsOliver Schneider-0/+1
2018-08-21Rollup merge of #53329 - frewsxcv:frewsxcv-ptr-add-sub, r=RalfJungkennytm-4/+4
Replace usages of ptr::offset with ptr::{add,sub}. Rust provides these helper methods – so let's use them!
2018-08-21Rollup merge of #53496 - matthiaskrgr:codespell_08_2018, r=varkorkennytm-6/+6
Fix typos found by codespell.
2018-08-21Rollup merge of #53370 - jkozlowski:stabilize-macro_vis_matcher, r=cramertjkennytm-1/+1
Stabilize macro_vis_matcher This PR should stabilize [macro_vis_matcher](https://github.com/rust-lang/rust/issues/41022) feature. - [ ] "reference" book changes: https://github.com/rust-lang-nursery/reference/pull/400 - [ ] "Rust by example" book changes: https://github.com/rust-lang/rust-by-example/pull/1096 - [ ] "clippy" changes: https://github.com/rust-lang-nursery/rust-clippy/pull/3055 r? @cramertj
2018-08-21Correctly parenthesize dyn Error + 'static.Without Boats-1/+1
2018-08-20Fix feature name.Without Boats-1/+1
2018-08-20document the platform-specific behavior of Command::current_dirJack O'Connor-0/+10
2018-08-20Add Error::source method per RFC 2504.Without Boats-1/+66