about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2019-11-27Elaborate on std::ptr::{as_ref,as_mod} and clarify docsCreepySkeleton-14/+24
2019-11-27Update mod.rsDylan DPC-1/+1
2019-11-26Format libcore with rustfmtDavid Tolnay-1294/+1800
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-26Fix spelling typosBrian Wignall-2/+2
2019-11-26Fixes small typo in array docs r? @steveklabnikMark Lodato-1/+1
2019-11-26Add tracking issue number.Mara Bos-2/+2
2019-11-26Add core::{f32,f64}::consts::TAU.Mara Bos-0/+12
2019-11-26follow the same function order in the traitGuanqun Lu-6/+6
This removes several warnings in IDE.
2019-11-26Fixed formatting issuesSOFe-2/+4
2019-11-26Stabilize the `core::panic` moduleSimon Sapin-3/+1
`std::panic` is already stable. `core::panic::PanicInfo` and `core::panic::Location` are stable and can be used through that path because of a bug in stability checking: https://github.com/rust-lang/rust/issues/15702
2019-11-26Fix the tracking issue number for `PanicInfo::message`Simon Sapin-1/+1
#44489 was closed when the `#[panic_handler]` attribute was stabilized.
2019-11-26Improved comments to clarify sasumptions in str::strip_prefixSOFe-5/+7
2019-11-26abort on BoxMeUp misuseRalf Jung-0/+8
2019-11-26Fix unstable attribute accidentally applying to the entire implSimon Sapin-4/+8
Note `#![unstable]` v.s. `#[unstable]`
2019-11-25more panicking commentsRalf Jung-4/+5
2019-11-25Clarify Layout::pad_to_align safety commentChristopher Durham-1/+1
2019-11-25Remove unsafe in Layout::pad_to_alignChristopher Durham-3/+1
2019-11-25added enclosing_scope attr to Try trait and fixed ui tests accordinglyMikhail Babenko-3/+4
2019-11-25Rollup merge of #66694 - RalfJung:panic-comments, r=Dylan-DPCPietro Albini-4/+3
Add some comments to panic runtime
2019-11-25Add str::strip_prefix and str::strip_suffixSOFe-1/+68
2019-11-25better comment and rename BoxMeUp::box_me_up to take_boxRalf Jung-1/+3
2019-11-24make comment compileRalf Jung-2/+1
2019-11-24panicking commentsRalf Jung-3/+3
2019-11-24Auto merge of #66322 - lzutao:consistent-result-map_or_else, r=dtolnaybors-4/+6
Stabilize Result::map_or_else Stabilized this API: ```rust impl<T, E> Result<T, E> { pub fn map_or_else<U, D: FnOnce(E) -> U, F: FnOnce(T) -> U>(self, default: D, f: F) -> U { match self { Ok(t) => f(t), Err(e) => default(e), } } } ``` Closes #53268 r? @SimonSapin
2019-11-24Rollup merge of #66659 - Centril:fix-bench, r=Mark-SimulacrumMazdak Farrokhzad-2/+2
make `./x.py bench` again Fixes #54016
2019-11-24Rollup merge of #66411 - RalfJung:forget, r=sfacklerMazdak Farrokhzad-3/+33
mem::forget docs: mention ManuallyDrop Cc @SimonSapin @Centril
2019-11-23Add as_mut_ptr method to atomic types.Paul Dicker-0/+62
2019-11-23make `./x.py bench` againMazdak Farrokhzad-2/+2
2019-11-23Rollup merge of #66583 - Phlosioneer:patch-2, r=Dylan-DPCMazdak Farrokhzad-2/+6
Clarify Step Documentation While the redesign is in progress (#62886), clarify the purpose of replace_zero and replace_one. First, "returning itself" is technically impossible due to the function signature of &mut self -> Self. A clone or copy operation must be used. So this is now explicitly stated in the documentation. Second, the added docs give some guidance about the actual contract around implementation of replace_zero and replace one. Specifically, the only usage is to create a range with no more steps, by setting start to replace_one and end to replace_zero. So the only property that is actually used is `replace_one > replace_zero`. See https://github.com/rust-lang/rust/issues/42168#issuecomment-489554232 The new documentation does not say that is the *only* contract, and so it should not be considered an api change. It just highlights the most important detail for implementors. The redesign doesn't seem to be landing any time soon, so this is a stopgap measure to reduce confusion in the meantime.
2019-11-23Rollup merge of #65961 - lcnr:typename_of, r=Dylan-DPCMazdak Farrokhzad-1/+40
add fn type_name_of_val This function is often useful during testing and mirrors `align_of_val` and `size_of_val`. # Example Showing the default type of integers. ```rust let x = 7; println!("per default, integers have the type: {}", std::any::type_name_of_val(&x)); ``` To my knowledge this can currently not be done without defining a function similar to `type_name_of_val`.
2019-11-22Rollup merge of #66619 - guanqun:use-third-person-singular-verb, r=CentrilMazdak Farrokhzad-2/+2
follow the convention in this file to use third-person singular verbs
2019-11-22Rollup merge of #66566 - robamler:issue-66476, r=rkruppeMazdak Farrokhzad-14/+18
Document pitfall with `impl PartialEq<B> for A` Fixes #66476 by turning the violating example into an explicit counterexample.
2019-11-22follow the convention in this file to use third-person singular verbsGuanqun Lu-2/+2
2019-11-21Document pitfall with `impl PartialEq<B> for A`Robert Bamler-14/+18
Fixes #66476 by turning the violating example into an explicit counterexample.
2019-11-21Redefine `core::convert::Infallible` as `!`.Mazdak Farrokhzad-99/+8
2019-11-21Stabilize the `never_type`, written `!`.Mazdak Farrokhzad-10/+10
2019-11-20Clarify Step DocumentationPhlosioneer-2/+6
While the redesign is in progress (#62886), clarify the purpose of replace_zero and replace_one.
2019-11-19add fn any::type_name_of_vallcnr/Bastian Kauschke-1/+40
2019-11-18Use `drop_in_place` in `array::IntoIter::drop`Simon Sapin-4/+18
This skips the loop when the element type is known not to have drop glue, even in debug mode.
2019-11-18Auto merge of #65456 - estebank:trait-bound-borrow, r=matthewjasperbors-4/+0
Suggest borrowing when it would satisfy an unmet trait bound 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. Fix #56368.
2019-11-17Rollup merge of #66477 - ALSchwalm:clarify-transmute-copy, r=CentrilYuki Okushi-5/+5
Clarify transmute_copy documentation example Currently the documentation for `transmute_copy` implies that the function accepts a slice due to the variable name chosen in the example. This is misleading as `foo_slice` is actually an array and `transmute_copy` cannot take an unsized type anyway. This PR just clarifies things by renaming the variable used in the example.
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-16Clarify transmute_copy documentation exampleAdam Schwalm-5/+5
2019-11-14mem::forget docs: mention ManuallyDropRalf Jung-3/+33
2019-11-14Centralize panic macro documentationChris Gregory-3/+48
2019-11-13Rollup merge of #66292 - lzutao:result-map_or, r=SimonSapinYuki Okushi-0/+22
add Result::map_or This PR adds this API to make it consistent with `Option::map_or`. ```rust impl<T, E> Result<T, E> { pub fn map_or<U, F: FnOnce(T) -> U>(self, default: U, f: F) -> U { match self { Ok(t) => f(t), Err(_) => default, } } } ``` This API is very small. We already has a similar API for `Option::map_or`.
2019-11-13Rollup merge of #66248 - RalfJung:unsafe_cell_raw_get, r=SimonSapinYuki Okushi-1/+38
add raw ptr variant of UnsafeCell::get This has come up recently in https://github.com/rust-lang/rust/pull/66051 (Cc @Centril @pitdicker) as well as in discussion with @nikomatsakis and in unrelated discussion with @withoutboats.
2019-11-13Rollup merge of #66094 - ArturKovacs:fix-count-doc, r=Dylan-DPCYuki Okushi-3/+4
Fix documentation for `Iterator::count()`. The documentation of std::core::Iterator::count() stated that the number returned is the number of times `next` is called on the iterator. However this is not true as the number of times `next` is called is exactly one plus the number returned by `count()`.
2019-11-13make things uglyRalf Jung-3/+3
2019-11-13expand docsRalf Jung-2/+7