about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2020-06-18Rollup merge of #73361 - estebank:non-primitive-cast, r=davidtwcoManish Goregaokar-0/+1
Tweak "non-primitive cast" error - Suggest borrowing expression if it would allow cast to work. - Suggest using `<Type>::from(<expr>)` when appropriate. - Minor tweak to `;` typo suggestion. Partily address #47136.
2020-06-18Rollup merge of #72628 - MikailBag:array-default-tests, r=shepmasterManish Goregaokar-0/+49
Add tests for 'impl Default for [T; N]' Related: #71690. This pull request adds two tests: - Even it T::default() panics, no leaks occur. - [T; 0] is Default even if T is not. I believe at some moment `Default` impl for arrays will be rewritten to use const generics instead of macros, and these tests will help to prevent behavior changes.
2020-06-18Rollup merge of #72279 - RalfJung:raw-ref-macros, r=nikomatsakisManish Goregaokar-0/+67
add raw_ref macros In https://github.com/rust-lang/rust/issues/64490, various people were in favor of exposing `&raw` as a macro first before making the actual syntax stable. So this PR (unstably) introduces those macros. I'll create the tracking issue if we're okay moving forward with this.
2020-06-18Disable core benches on wasm (benches not supported).Eric Huss-0/+2
2020-06-18Ensure std benchmarks get tested.Eric Huss-0/+1
2020-06-18Improve document for `Result::as_deref(_mut)`Lzu Tao-16/+40
2020-06-17Remove duplicate sentence fragment from mem::zeroed docDavid Tolnay-4/+4
2020-06-17Update src/libcore/intrinsics.rsRich Kadel-1/+1
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2020-06-17Don't imply function pointers are referencesPoliorcetics-2/+2
Co-authored-by: David Tolnay <dtolnay@gmail.com>
2020-06-16Mention functions pointers in the documentationAlexis Bourget-5/+7
2020-06-16Added some more documentations to unsafety blocks in slice/sort.rsHanif Bin Ariffin-11/+39
2020-06-16memory access sanity checks: abort instead of panicRalf Jung-12/+33
2020-06-16Rollup merge of #73381 - ratijas:fix-typo-std-mem, r=jonas-schievinkDylan DPC-1/+1
Fix typo in docs of std::mem
2020-06-16Rollup merge of #73373 - lzutao:bug-trackcaller, r=AmanieuDylan DPC-8/+4
Use track caller for bug! macro
2020-06-16libcore tests: use min_specializationRalf Jung-1/+1
2020-06-16add tracking issueRalf Jung-2/+2
2020-06-15Update src/libcore/intrinsics.rsRich Kadel-1/+1
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2020-06-15Add case for count_code_region() extern lang_itemRich Kadel-15/+6
As suggested in PR feedback: https://github.com/rust-lang/rust/pull/73011#discussion_r435728923 This allows count_code_region() to be handled like a normal intrinsic so the InstanceDef::InjectedCode variant is no longer needed.
2020-06-15removed experiments for cleaner github PRRich Kadel-8/+9
2020-06-15explained lang_item function body (count_code_region)Rich Kadel-0/+6
2020-06-15[WIP] injects llvm intrinsic instrprof.increment for coverage reportsRich Kadel-0/+9
This initial version only injects counters at the top of each function. Rust Coverage will require injecting additional counters at each conditional code branch.
2020-06-15Fix typo in docs of std::memivan tkachenko-1/+1
2020-06-15Tweak "non-primitive cast" errorEsteban Küber-0/+1
- Suggest borrowing expression if it would allow cast to work. - Suggest using `<Type>::from(<expr>)` when appropriate. - Minor tweak to `;` typo suggestion. Partily address #47136.
2020-06-15Join mutiple lines if it is more readableLzu Tao-8/+4
2020-06-15Auto merge of #73369 - RalfJung:rollup-hl8g9zf, r=RalfJungbors-4/+5
Rollup of 10 pull requests Successful merges: - #72707 (Use min_specialization in the remaining rustc crates) - #72740 (On recursive ADT, provide indirection structured suggestion) - #72879 (Miri: avoid tracking current location three times) - #72938 (Stabilize Option::zip) - #73086 (Rename "cyclone" to "apple-a7" per changes in upstream LLVM) - #73104 (Example about explicit mutex dropping) - #73139 (Add methods to go from a nul-terminated Vec<u8> to a CString) - #73296 (Remove vestigial CI job msvc-aux.) - #73304 (Revert heterogeneous SocketAddr PartialEq impls) - #73331 (extend network support for HermitCore) Failed merges: r? @ghost
2020-06-15Rollup merge of #72938 - lzutao:stabilize_option_zip, r=dtolnayRalf Jung-4/+5
Stabilize Option::zip This PR stabilizes the following API: ```rust impl<T> Option<T> { pub fn zip<U>(self, other: Option<U>) -> Option<(T, U)>; } ``` This API has real world usage as seen in <https://grep.app/search?q=-%3E%20Option%3C%5C%28T%2C%5Cs%3FU%5C%29%3E&regexp=true&filter[lang][0]=Rust>. The `zip_with` method is left unstably as this API is kinda niche and it hasn't received much usage in Rust repositories on GitHub. cc #70086
2020-06-15Rollup merge of #73342 - schteve:master, r=jonas-schievinkRalf Jung-2/+2
Fix iterator copied() documentation example code The documentation for copied() gives example code with variable v_cloned instead of v_copied. This seems like a copy/paste error from cloned() and it would be clearer to use v_copied.
2020-06-15Rollup merge of #73336 - lzutao:pattern-group, r=sfacklerRalf Jung-10/+10
Group `Pattern::strip_*` method together
2020-06-15Rollup merge of #72598 - Aaron1011:feature/fnmut-capture-span, r=nikomatsakisRalf Jung-0/+1
Display information about captured variable in `FnMut` error Fixes #69446 When we encounter a region error involving an `FnMut` closure, we display a specialized error message. However, we currently do not tell the user which upvar was captured. This makes it difficult to determine the cause of the error, especially when the closure is large. This commit records marks constraints involving closure upvars with `ConstraintCategory::ClosureUpvar`. When we decide to 'blame' a `ConstraintCategory::Return`, we additionall store the captured upvar if we found a `ConstraintCategory::ClosureUpvar` in the path. When generating an error message, we point to relevant spans if we have closure upvar information available. We further customize the message if an `async` closure is being returned, to make it clear that the captured variable is being returned indirectly.
2020-06-14Fix iterator copied() documentation example codeSteve Heindel-2/+2
2020-06-14Group Pattern::strip_* method togetherLzu Tao-10/+10
2020-06-13Added some unsafety documentation to partition_equalHanif Bin Ariffin-4/+8
2020-06-13Added unsafety documentation with partition and partition equalHanif Bin Ariffin-2/+7
These are simply indexing safety.
2020-06-13Document unsafety in partial_insertion_sortHanif Bin Ariffin-0/+2
We already implicitly (or explicitly??) do the bound checking for the indexing.
2020-06-13Added unsafety documentation to shift_tailHanif Bin Ariffin-0/+14
This is just the reverse of shift_head.
2020-06-13Added unsafety documentation to shift_headHanif Bin Ariffin-1/+15
2020-06-13Rollup merge of #73302 - JakobDegen:should-panic-documentation, ↵Dylan DPC-71/+28
r=Mark-Simulacrum Adjusted some doctests in libcore to use `should_panic`. Fixes #73196 . I grepped libstd and libcore for all the instances of this pattern that I could find, but its possible that I missed some of course. If anyone knows of any more, please let me know and I will add them to the PR.
2020-06-13Rollup merge of #72932 - poliorcetics:pattern-contains-behaviour, r=hanna-kruppeDylan DPC-0/+37
Clarify the behaviour of Pattern when used with methods like str::contains Fixes #45507. I used the previous work by @Emerentius (thanks !), added a paragraph and checked the links (they work for me but I'm not against someone else checking them too).
2020-06-13Adjusted some doctests in libcore to use `should_panic`.Jake Degen-71/+28
Previously, some doctests were spawning new threads and joining them to indicate that a particular call should panic; this hurt readability, so the tests have been adjusted to simply call the method and use the `should_panic` marker.
2020-06-13Stabilize Option::zipLzu Tao-4/+5
2020-06-12Fixing broken link for the Eq traitAlexis Bourget-2/+1
2020-06-12add raw_ref macrosRalf Jung-0/+67
2020-06-12Rollup merge of #72906 - lzutao:migrate-numeric-assoc-consts, r=dtolnayDylan DPC-85/+80
Migrate to numeric associated consts The deprecation PR is #72885 cc #68490 cc rust-lang/rfcs#2700
2020-06-12Auto merge of #69478 - avr-rust:avr-support-upstream, r=jonas-schievinkbors-2/+12
Enable AVR as a Tier 3 target upstream Tracking issue: #44052. Things intentionally left out of the initial upstream: * The `target_cpu` flag I have made the cleanup suggestions by @jplatte and @jplatte in https://github.com/avr-rust/rust/commit/043550d9db0582add42e5837f636f61acb26b915. Anybody feel free to give the branch a test and see how it fares, or make suggestions on the code patch itself.
2020-06-12Rollup merge of #73036 - alexcrichton:update-wasm-fence, r=Mark-SimulacrumDylan DPC-8/+0
std: Enable atomic.fence emission on wasm32 This commit removes the `#[cfg]` guards in `atomic::fence` on wasm targets. Since these guards were originally added the upstream wasm specification for threads gained an `atomic.fence` instruction, so LLVM no longer panics on these intrinsics. Although there aren't a ton of tests in-repo for this right now I've tested locally and all of these fences generate `atomic.fence` instructions in wasm. Closes #65687 Closes #72997
2020-06-11Update src/libcore/num/mod.rsAmanieu d'Antras-2/+2
Co-authored-by: lzutao <taolzu@gmail.com>
2020-06-10Fix doctest templateMihail Malo-1/+2
`saturating_add` example was not parameterized, but passed because the `u8` would saturate successfully
2020-06-09Impl Default for rangesCaio-6/+6
2020-06-10Migrate to numeric associated constsLzu Tao-85/+80
2020-06-10Rollup merge of #73148 - DarkEld3r:patch-1, r=jonas-schievinkDylan DPC-2/+2
Fix a typo (size of the size)