about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2019-03-09Rollup merge of #58924 - cuviper:more-as_slice, r=dtolnayMazdak Farrokhzad-0/+28
Add as_slice() to slice::IterMut and vec::Drain In bluss/indexmap#88, we found that there was no easy way to implement `Debug` for our `IterMut` and `Drain` iterators. Those are built on `slice::IterMut` and `vec::Drain`, which implement `Debug` themselves, but have no other way to access their data. With a new `as_slice()` method, we can read the data and customize its presentation.
2019-03-09Rollup merge of #58750 - TimDiekmann:master, r=oli-obkMazdak Farrokhzad-3/+5
Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const
2019-03-09Rollup merge of #58660 - RalfJung:maybe-uninit, r=CentrilMazdak Farrokhzad-30/+229
MaybeUninit: add read_initialized, add examples This adds a new `read_initialized` method, similar to suggestions by @Amanieu and @shepmaster. I also added examples to this and other methods.
2019-03-09Auto merge of #57882 - euclio:unused-doc-attributes, r=estebankbors-1/+1
overhaul unused doc comments lint This PR contains a number of improvements to the `unused_doc_comments` lint. - Extends the span to cover the entire comment when using sugared doc comments. - Triggers the lint for all unused doc comments on a node, instead of just the first one. - Triggers the lint on macro expansions, and provides a help note explaining that doc comments must be expanded by the macro. - Adds a label pointing at the node that cannot be documented. Furthermore, this PR fixes any instances in rustc where a macro expansion was erroneously documented.
2019-03-08expand unused doc comment diagnosticAndy Russell-1/+1
Report the diagnostic on macro expansions, and add a label indicating why the comment is unused.
2019-03-06Apply suggestions from code reviewRalf Jung-1/+1
2019-03-06Apply suggestions from code reviewMazdak Farrokhzad-3/+3
Co-Authored-By: RalfJung <post@ralfj.de>
2019-03-05Add a tracking issue for new as_slice methodsJosh Stone-1/+1
2019-03-05Clean up the example on slice::IterMut::as_slice()Josh Stone-6/+2
2019-03-05Apply suggestions from code reviewMazdak Farrokhzad-4/+4
Co-Authored-By: cuviper <cuviper@gmail.com>
2019-03-04Add as_slice() to slice::IterMut and vec::DrainJosh Stone-0/+32
In bluss/indexmap#88, we found that there was no easy way to implement `Debug` for our `IterMut` and `Drain` iterators. Those are built on `slice::IterMut` and `vec::Drain`, which implement `Debug` themselves, but have no other way to access their data. With a new `as_slice()` method, we can read the data and customize its presentation.
2019-03-03Remove stray ` in the documentation for the FromIterator implementation for ↵Alexandra V-1/+1
Option
2019-03-03Auto merge of #58866 - kennytm:rollup, r=kennytmbors-36/+49
Rollup of 14 pull requests Successful merges: - #58730 (Have all methods of Filter and FilterMap use internal iteration) - #58780 (ManuallyDrop != MaybeUninit) - #58782 (Replace `s` with `self` in docs for str methods taking self.) - #58785 (allow specifying attributes for tool lints) - #58802 (Ensure `record_layout_for_printing()` is inlined.) - #58821 (Fixed a syntax error in the pin docs) - #58830 (tidy: deny(rust_2018_idioms)) - #58832 (Revert switching to GCP on AppVeyor) - #58833 (tools/rustbook: deny(rust_2018_idioms)) - #58835 (tools/remote-test-{client,server}: deny(rust_2018_idioms)) - #58838 (Fix typo in Vec#resize_with documentation) - #58842 (Forbid duplicating Cargo as a dependency) - #58852 (Update toolchain to build NetBSD release) - #58865 (Fix C-variadic function printing)
2019-03-02Bootstrap compiler update for 1.35 releaseMark Rousskov-122/+8
2019-03-02Rollup merge of #58821 - alex:patch-1, r=Centrilkennytm-1/+1
Fixed a syntax error in the pin docs
2019-03-02Rollup merge of #58782 - tspiteri:str-escape-self, r=kennytmkennytm-3/+3
Replace `s` with `self` in docs for str methods taking self. Cherry picked from PR #58596 which is blocked on some intra-doc link bugs.
2019-03-02Rollup merge of #58780 - RalfJung:manually-drop, r=nagisakennytm-0/+8
ManuallyDrop != MaybeUninit Cc @Centril
2019-03-02Rollup merge of #58730 - timvermeulen:internal_iteration, r=scottmcmkennytm-32/+37
Have all methods of Filter and FilterMap use internal iteration This PR changes `Filter::{next, next_back, count}` and `FilterMap::{next, next_back}` to all use internal iteration. The `next` and `next_back` methods are changed to directly forward to `try_for_each` and `try_rfold` respectively, using `Result` as the `Try` type. I think that's okay? Alternatively, I could change their implementations to use `LoopState` instead if there's any benefit in doing so. r? @scottmcm
2019-02-28Fixed a syntax error in the pin docsAlex Gaynor-1/+1
2019-02-28Update src/libcore/mem.rsMazdak Farrokhzad-1/+1
Co-Authored-By: RalfJung <post@ralfj.de>
2019-02-28Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` constTim-3/+5
Make `Unique::as_ptr` const without feature attribute as it's unstable Make `NonNull::dangling` and `NonNull::cast` const with `feature = "const_ptr_nonnull"`
2019-02-27improve readabilityRalf Jung-1/+1
2019-02-27Replace `s` with `self` in docs for str methods taking self.Trevor Spiteri-3/+3
2019-02-27ManuallyDrop != MaybeUninitRalf Jung-0/+8
2019-02-27Add trailing newlineTim Vermeulen-1/+1
2019-02-27Improve existing benchmarks to prevent extreme optimizationsTim Vermeulen-2/+2
2019-02-27Add relevant benchmarksTim Vermeulen-0/+28
2019-02-26Clarify `rotate_{left,right}` docsTobias Bucher-6/+8
I wondered what the `<<!` operator is although the exclamation mark was only the end of the sentence.
2019-02-25Auto merge of #57367 - petrochenkov:unrestab, r=Centrilbors-1/+0
Stabilize `unrestricted_attribute_tokens` In accordance with a plan described in https://internals.rust-lang.org/t/unrestricted-attribute-tokens-feature-status/8561/3. Delimited non-macro non-builtin attributes now support the same syntax as macro attributes: ``` PATH PATH `(` TOKEN_STREAM `)` PATH `[` TOKEN_STREAM `]` PATH `{` TOKEN_STREAM `}` ``` Such attributes mostly serve as inert proc macro helpers or tool attributes. To some extent these attributes are de-facto stable due to a hole in feature gate checking (feature gating is done too late - after macro expansion.) So if macro *removes* such helper attributes during expansion (and it must remove them, unless it's a derive macro), then the code will work on stable. Key-value non-macro non-builtin attributes are now restricted to bare minimum required to support what we support on stable - unsuffixed literals (https://github.com/rust-lang/rust/issues/34981). ``` PATH `=` LITERAL ``` (Key-value macro attributes are not supported at all right now.) Crater run in https://github.com/rust-lang/rust/pull/57321 found no regressions for this change. There are multiple possible ways to extend key-value attributes (https://github.com/rust-lang/rust/pull/57321#issuecomment-451574065), but I'd expect an RFC for that and it's not a pressing enough issue to block stabilization of delimited attributes. Built-in attributes are still restricted to the "classic" meta-item syntax, nothing changes here. https://github.com/rust-lang/rust/pull/57321 goes further and adds some additional restrictions (more consistent input checking) to built-in attributes. Closes https://github.com/rust-lang/rust/issues/55208
2019-02-25Auto merge of #58302 - SimonSapin:tryfrom, r=alexcrichtonbors-29/+150
Stabilize TryFrom and TryInto with a convert::Infallible empty enum This is the plan proposed in https://github.com/rust-lang/rust/issues/33417#issuecomment-423073898
2019-02-25Stabilize `unrestricted_attribute_tokens`Vadim Petrochenkov-1/+0
2019-02-25Have all methods of Filter and FilterMap use internal iterationTim Vermeulen-30/+7
2019-02-25heading # Unsafety => # Safety in stdlib docs.Mazdak Farrokhzad-7/+7
2019-02-24prefer into_initialized over read_initialitedRalf Jung-0/+3
2019-02-24show how to set with ptr::writeRalf Jung-4/+5
2019-02-24remark that the rules are unfinishedRalf Jung-0/+4
2019-02-23fix linkRalf Jung-0/+2
2019-02-23expand type nameRalf Jung-17/+17
2019-02-23Apply suggestions from code reviewMazdak Farrokhzad-18/+19
Co-Authored-By: RalfJung <post@ralfj.de>
2019-02-23Rollup merge of #58595 - stjepang:make-duration-consts-associated, r=oli-obkMazdak Farrokhzad-16/+52
Turn duration consts into associated consts As suggested in https://github.com/rust-lang/rust/issues/57391#issuecomment-459658236, I'm moving `Duration` constants (`SECOND`, `MILLISECOND` and so on; currently behind unstable `duration_constants` feature) into the `impl Duration` block. cc @frewsxcv @SimonSapin
2019-02-23Rollup merge of #58122 - matthieu-m:range_incl_perf, r=dtolnayMazdak Farrokhzad-6/+81
RangeInclusive internal iteration performance improvement. Specialize `Iterator::try_fold` and `DoubleEndedIterator::try_rfold` to improve code generation in all internal iteration scenarios. This changes brings the performance of internal iteration with `RangeInclusive` on par with the performance of iteration with `Range`: - Single conditional jump in hot loop, - Unrolling and vectorization, - And even Closed Form substitution. Unfortunately, it only applies to internal iteration. Despite various attempts at stream-lining the implementation of `next` and `next_back`, LLVM has stubbornly refused to optimize external iteration appropriately, leaving me with a choice between: - The current implementation, for which Closed Form substitution is performed, but which uses 2 conditional jumps in the hot loop when optimization fail. - An implementation using a `is_done` boolean, which uses 1 conditional jump in the hot loop when optimization fail, allowing unrolling and vectorization, but for which Closed Form substitution fails. In the absence of any conclusive evidence as to which usecase matters most, and with no assurance that the lack of Closed Form substitution is not indicative of other optimizations being foiled, there is no way to pick one implementation over the other, and thus I defer to the statu quo as far as `next` and `next_back` are concerned.
2019-02-22make MaybeUninit CopyRalf Jung-0/+10
2019-02-22avoid unnecessary use of MaybeUninit::get_ref, and expand comment on the othersRalf Jung-1/+5
2019-02-22examples for MaybeUninit::zeroedRalf Jung-0/+29
2019-02-22examples for as[_mut]_ptrRalf Jung-0/+53
2019-02-22misc tweaksRalf Jung-12/+22
2019-02-22also add examples to MaybeUninit::into_initializedRalf Jung-1/+28
2019-02-22Add MaybeUninit::read_uninitializedRalf Jung-0/+55
Also remove a no-longer accurate comments
2019-02-22Auto merge of #58644 - Centril:rollup, r=Centrilbors-0/+1
Rollup of 17 pull requests Successful merges: - #57656 (Deprecate the unstable Vec::resize_default) - #58059 (deprecate before_exec in favor of unsafe pre_exec) - #58064 (override `VecDeque::try_rfold`, also update iterator) - #58198 (Suggest removing parentheses surrounding lifetimes) - #58431 (fix overlapping references in BTree) - #58555 (Add a note about 2018e if someone uses `try {` in 2015e) - #58588 (remove a bit of dead code) - #58589 (cleanup macro after 2018 transition) - #58591 (Dedup a rustdoc diagnostic construction) - #58600 (fix small documentation typo) - #58601 (Search for target_triple.json only if builtin target not found) - #58606 (Docs: put Future trait into spotlight) - #58607 (Fixes #58586: Make E0505 erronous example fail for the 2018 edition) - #58615 (miri: explain why we use static alignment in ref-to-place conversion) - #58620 (introduce benchmarks of BTreeSet.intersection) - #58621 (Update miri links) - #58632 (Make std feature list sorted) Failed merges: r? @ghost
2019-02-22Rollup merge of #58606 - stjepang:put-future-into-spotlight, r=alexcrichtonMazdak Farrokhzad-0/+1
Docs: put Future trait into spotlight If a function returns a type that implements `Future`, there should be a small "i" symbol next to it indicating the return type implements an important trait.