summary refs log tree commit diff
path: root/src/libcore/ops
AgeCommit message (Collapse)AuthorLines
2019-12-26Convert collapsed to shortcut reference linksMatthew Kraai-4/+4
2019-12-23Document that calling Drop, even after it panics, is UBMark Rousskov-0/+6
2019-12-22Rollup merge of #67480 - rossmacarthur:fix-41260-avoid-issue-0-part-2, r=CentrilMazdak Farrokhzad-10/+10
Require issue = "none" over issue = "0" in unstable attributes These changes make the use of `issue = "none"` required in unstable attributes throughout the compiler. Notes: - #66299 is now in beta so `issue = "none"` is accepted. - The `tidy` tool now fails on `issue = "0"`. - Tests that used `issue = "0"` were changed to use `issue = "none"`, except for _one_ that asserts `issue = "0"` can still be used. - The compiler still allows `issue = "0"` because some submodules require it, this could be disallowed once these are updated. Resolves #41260 r? @varkor
2019-12-21Document privacy of RangeInclusive fieldsMark Rousskov-0/+5
2019-12-21Require issue = "none" over issue = "0" in unstable attributesRoss MacArthur-10/+10
2019-12-18Propagate cfg bootstrapMark Rousskov-28/+19
2019-12-13Require stable/unstable annotations for the constness of all stable ↵Oliver Scherer-0/+9
functions with a `const` modifier
2019-12-06Format libcore with rustfmt (including tests and benches)David Tolnay-14/+22
2019-12-03Rollup merge of #66651 - Areredify:on-unimplemented-scope, r=davidtwcoMazdak Farrokhzad-3/+4
Add `enclosing scope` parameter to `rustc_on_unimplemented` Adds a new parameter to `#[rustc_on_unimplemented]`, `enclosing scope`, which highlights the function or closure scope with a message. The wip part refers to adding this annotation to `Try` trait to improve ergonomics (which I don't know how to do since I change both std and librustc) Closes #61709.
2019-11-26Format libcore with rustfmtDavid Tolnay-136/+180
This commit applies rustfmt with default settings to files in src/libcore *that are not involved in any currently open PR* to minimize merge conflicts. The list of files involved in open PRs was determined by querying GitHub's GraphQL API with this script: https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8 With the list of files from the script in `outstanding_files`, the relevant commands were: $ find src/libcore -name '*.rs' | xargs rustfmt --edition=2018 $ rg libcore outstanding_files | xargs git checkout -- Repeating this process several months apart should get us coverage of most of the rest of libcore.
2019-11-25added enclosing_scope attr to Try trait and fixed ui tests accordinglyMikhail Babenko-3/+4
2019-11-16Suggest borrowing when it would satisfy an unmet trait boundEsteban Küber-4/+0
When there are multiple implementors for the same trait that is present in an unmet binding, modify the E0277 error to refer to the parent obligation and verify whether borrowing the argument being passed in would satisfy the unmet bound. If it would, suggest it.
2019-11-12Snap cfgsMark Rousskov-15/+2
2019-11-01Rollup merge of #65902 - gilescope:issue62570, r=estebankTyler Mandry-2/+15
Make ItemContext available for better diagnositcs Fix #62570
2019-10-30Make ItemContext available for better diagnositcs.Giles Cope-2/+15
2019-10-20Remove leading :: from paths in doc examplesMikko Rantanen-1/+1
2019-08-24Added an extra line to make the formatting conform to the rest of the document.Christian-0/+1
2019-08-24Removed the confusing FnOnce example. closes #47091Christian-9/+0
2019-07-25Add note suggesting to borrow a String argument to findEsteban Küber-0/+4
2019-07-11hygiene: Fix wording of desugaring descriptionsVadim Petrochenkov-2/+2
Use variant names rather than descriptions for identifying desugarings in `#[rustc_on_unimplemented]`. Both are highly unstable, but variant name is at least a single identifier.
2019-07-01Remove needless lifetimesJeremy Stucki-2/+2
2019-06-15Remove the default type of `Rem::Output`Jonas Schievink-1/+1
2019-06-06Rollup merge of #61376 - czipperz:bound-cloned, r=sfacklerMazdak Farrokhzad-0/+23
Add Bound::cloned() Suggested by #61356
2019-06-05Remove dereferenceChris Gregory-1/+1
Co-Authored-By: Steven Fackler <sfackler@gmail.com>
2019-06-05Take self by value (Self is Copy here)Chris Gregory-1/+1
2019-06-05Aggregation of drive-by cosmetic changes.Alexander Regueiro-1/+1
2019-06-01Enable feature bound_cloned for testsChris Gregory-0/+1
2019-05-31Make Bound::cloned publicChris Gregory-1/+1
2019-05-30Fix compilation errorsChris Gregory-2/+2
2019-05-30Add Bound::cloned()Chris Gregory-0/+22
2019-05-30Fix links in Deref documentationGuillaume Gomez-6/+6
2019-04-22Remove double trailing newlinesvarkor-1/+0
2019-04-19libcore: deny more...Mazdak Farrokhzad-6/+6
2019-04-18libcore => 2018Taiki Endo-5/+5
2019-04-09std::ops::Div examples: correct nominator to numeratorAnders Kaseorg-14/+14
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-04-04Rollup merge of #59596 - LukasKalbertodt:fix-range-fmt, r=KimundiMazdak Farrokhzad-5/+17
Forward formatter settings to bounds of `Range<T>` in `fmt::Debug` impl Before this change, formatter settings were lost when printing a `Range`. For example, printing a `Range<f32>` with `{:.2?}` would not apply the precision modifier when printing the floats. Now the `Debug` impls look a bit more verbose, but modifier are not lost. --- I assume the exact output of `Debug` impls in `std` cannot be relied on by users and thus can change, right?
2019-04-02Rollup merge of #59529 - DevQps:improve-rem-docs, r=cuviperMazdak Farrokhzad-0/+15
Added documentation on the remainder (Rem) operator for floating points. # Description As has been explained in #57738 the remainder operator on floating points is not clear. This PR requests adds some information on how the `Rem` / remainder operator on floating points works. Note also that this description is for both `Rem<f32> for f32` and `Rem<f64> for f64` implementations. Ps. I wasn't really sure on how to formulate things. So please suggest changes if you have better idea's! closes #57738
2019-04-01Improved the example with numbers that can be exactly represented as floats ↵Christian-2/+3
and added a comment with the solution.
2019-04-01Forward formatter settings to bounds of `Range<T>` in `fmt::Debug` implLukas Kalbertodt-5/+17
Before this change, formatter settings were lost when printing a `Range`. For example, printing a `Range<f32>` with `{:.2?}` would not apply the precision modifier when printing the floats. Now the `Debug` impls look a bit more verbose, but modifier are not lost.
2019-03-30Added an example that shows how the remainder function on floating point ↵Christian-1/+11
values is computed internally.
2019-03-29Added documentation on the remainder (Rem) operator for floating points.Christian-0/+4
2019-03-22Rollup merge of #59190 - greg-kargin:master, r=sanxiynMazdak Farrokhzad-50/+50
consistent naming for Rhs type parameter in libcore/ops Rename RHS type parameter occurrences RHS->Rhs to make it consistent throughout files and follow naming conventions.
2019-03-18Replaced self-reflective explicit types with clearer `Self` or `Self::…` ↵Vincent Esche-34/+34
in stdlib docs
2019-03-16Rollup merge of #59152 - smmalis37:range_contains, r=SimonSapinkennytm-30/+19
Stabilize Range*::contains. Closes https://github.com/rust-lang/rust/issues/32311. There's also a bit of rustfmt on range.rs thrown in for good measure (I forgot to turn off format-on-save in VSCode).
2019-03-15consistent naming for Rhs type parameter in libcore/opsGrigorii Kargin-50/+50
2019-03-12Stabilize Range*::contains.Steven Malis-30/+19
2019-03-11Fix RangeBounds documentation to include inclusive operationsChris Gregory-1/+1
2019-03-11Standardize `Range*` documentationChris Gregory-26/+42
This updates the final example in the documentation for the types `Range`, `RangeFrom`, `RangeFull`, `RangeInclusive`, `RangeTo`, `RangeToInclusive`.
2019-02-23Rollup merge of #58122 - matthieu-m:range_incl_perf, r=dtolnayMazdak Farrokhzad-0/+2
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-12Auto merge of #58341 - alexreg:cosmetic-2-doc-comments, r=steveklabnikbors-6/+6
Cosmetic improvements to doc comments This has been factored out from https://github.com/rust-lang/rust/pull/58036 to only include changes to documentation comments (throughout the rustc codebase). r? @steveklabnik Once you're happy with this, maybe we could get it through with r=1, so it doesn't constantly get invalidated? (I'm not sure this will be an issue, but just in case...) Anyway, thanks for your advice so far!