summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2019-06-30fix the same typo in doctestlcolaholicl-2/+2
2019-06-30Fix a typolcolaholicl-1/+1
Fix a typo in `libcore/char/methods.rs`
2019-06-29Rollup merge of #62204 - Hywan:patch-2, r=rkruppeMazdak Farrokhzad-1/+1
doc(libcore) Fix CS A small PR to fix a small CS typo in `iter/traits/collect.rs`.
2019-06-29Rollup merge of #61199 - ollie27:rustdoc_cfg_test, r=QuietMisdreavusMazdak Farrokhzad-6/+9
Revert "Set test flag when rustdoc is running with --test option" Reverts https://github.com/rust-lang/rust/pull/59940. It caused doctests in this repository to no longer be tested including all of the core crate.
2019-06-28doc(libcore) Fix CSIvan Enderlin-1/+1
A small PR to fix a small CS typo in `iter/traits/collect.rs`.
2019-06-27Rollup merge of #62067 - doctorn:await_diagnostic, r=matthewjasperMazdak Farrokhzad-0/+1
Add suggestion for missing `.await` keyword This commit adds a suggestion diagnostic for missing `.await`. In order to do this, the trait `Future` is promoted to a lang item. Compiling code of the form: ```rust #![feature(async_await)] fn take_u32(x: u32) {} async fn make_u32() -> u32 { 22 } async fn foo() { let x = make_u32(); take_u32(x) } fn main() {} ``` Will now result in the suggestion: ``` error[E0308]: mismatched types --> src/main.rs:11:18 | 11 | take_u32(x) | ^ | | | expected u32, found opaque type | help: consider using `.await` here: `x.await` | = note: expected type `u32` found type `impl std::future::Future` ``` This commit does not cover chained expressions and therefore only covers the case originally pointed out in #61076. Cases I can think of that still need to be covered: - [ ] Return places for functions - [ ] Field access - [ ] Method invocation I'm planning to submit PRs for each of these separately as and when I have figured them out.
2019-06-27Rollup merge of #61878 - RalfJung:pin, r=Dylan-DPCMazdak Farrokhzad-41/+130
improve pinning projection docs This tries to improve the explanation of structural pinning and pinning projections based on [this URLO thread](https://users.rust-lang.org/t/when-is-it-safe-to-move-a-member-value-out-of-a-pinned-future/28182). Fixes https://github.com/rust-lang/rust/issues/61272.
2019-06-27Add suggestion for missing `.await` keywordNathan Corbyn-0/+1
2019-06-23Rollup merge of #62068 - ia0:fix_meta_var, r=petrochenkovMazdak Farrokhzad-18/+18
Fix meta-variable binding errors in macros The errors are either: - The meta-variable used in the right-hand side is not bound (or defined) in the left-hand side. - The meta-variable used in the right-hand side does not repeat with the same kleene operator as its binder in the left-hand side. Either it does not repeat enough, or it uses a different operator somewhere. This change should have no semantic impact. Found by https://github.com/rust-lang/rust/pull/62008
2019-06-23Rollup merge of #62049 - crlf0710:patch-2, r=jonas-schievinkMazdak Farrokhzad-1/+1
Fix one missing `dyn`. It's in the documentation of `Unsize`.
2019-06-23Fix meta-variable binding errors in macrosJulien Cretin-18/+18
The errors are either: - The meta-variable used in the right-hand side is not bound (or defined) in the left-hand side. - The meta-variable used in the right-hand side does not repeat with the same kleene operator as its binder in the left-hand side. Either it does not repeat enough, or it uses a different operator somewhere. This change should have no semantic impact.
2019-06-22Auto merge of #61874 - jonas-schievink:remove-rem-output-default, r=Centrilbors-2/+1
Remove the default type of `Rem::Output` Associated type defaults are not yet stable, and `Rem` is the only trait that specifies a default. Let's see what breaks when it's removed. cc https://github.com/rust-lang/rust/pull/61812#issuecomment-502394566 cc @Centril @bors try
2019-06-22Fix one missing `dyn`.CrLF0710-1/+1
It's in the documentation of `Unsize`.
2019-06-20Auto merge of #61929 - 95th:master, r=GuillaumeGomezbors-13/+13
Fix Into trait docs links https://doc.rust-lang.org/std/convert/trait.Into.html
2019-06-20Fix Into trait linksGurwinder Singh-13/+13
2019-06-20Rollup merge of #60772 - timvermeulen:slice_iter_nth_back, r=scottmcmMazdak Farrokhzad-21/+68
Implement nth_back for slice::{Iter, IterMut} Part of #54054. I implemented `nth_back` as straightforwardly as I could, and then slightly changed `nth` to match `nth_back`. I believe I did so correctly, but please double-check 🙂 I also added the helper methods `zst_shrink`, `next_unchecked`, and `next_back_unchecked` to get rid of some duplicated code. These changes hopefully make this code easier to understand for new contributors like me. I noticed the `is_empty!` and `len!` macros which sole purpose seems to be inlining, according to the comment right above them, but the `is_empty` and `len` methods are already marked with `#[inline(always)]`. Does that mean we could replace these macros with method calls, without affecting anything? I'd love to get rid of them.
2019-06-20Rollup merge of #60454 - acrrd:issues/54054_skip, r=scottmcmMazdak Farrokhzad-0/+48
Add custom nth_back to Skip Implementation of nth_back for Skip. Part of #54054
2019-06-19Rollup merge of #60667 - oli-obk:raw_from_raw_parts, r=sfacklerMazdak Farrokhzad-16/+50
Add functions for building raw slices to libcore implement https://github.com/rust-lang/rust/issues/36925
2019-06-19nitsRalf Jung-2/+4
2019-06-19Apply suggestions from code reviewRalf Jung-4/+4
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-06-19Add functions to build raw slicesOliver Scherer-16/+50
2019-06-19Auto merge of #61945 - Centril:rollup-xdqo2mn, r=Centrilbors-1/+16
Rollup of 11 pull requests Successful merges: - #61505 (Only show methods that appear in `impl` blocks in the Implementors sections of trait doc pages) - #61701 (move stray run-pass const tests into const/ folder) - #61748 (Tweak transparent enums and unions diagnostic spans) - #61802 (Make MaybeUninit #[repr(transparent)]) - #61839 (ci: Add a script for generating CPU usage graphs) - #61842 (Remove unnecessary lift calls) - #61843 (Turn down the myriad-closures test) - #61896 (rustc_typeck: correctly compute `Substs` for `Res::SelfCtor`.) - #61898 (syntax: Factor out common fields from `SyntaxExtension` variants) - #61938 (create an issue for miri even in status test-fail) - #61941 (Preserve generator and yield source for error messages) Failed merges: r? @ghost
2019-06-19Rollup merge of #61802 - mjbshaw:maybe-uninit-transparent, r=cramertjMazdak Farrokhzad-1/+16
Make MaybeUninit #[repr(transparent)] Tracking issue: #60405
2019-06-18Auto merge of #59625 - immunant:copy_variadics_typealias, r=eddybbors-44/+187
Refactor C FFI variadics to more closely match their C counterparts, and add Clone implementation We had to make some changes to expose `va_copy` and `va_end` directly to users (mainly for C2Rust, but not exclusively): - redefine the Rust variadic structures to more closely correspond to C: `VaList` now matches `va_list`, and `VaListImpl` matches `__va_list_tag` - add `Clone` for `VaListImpl` - add explicit `as_va_list()` conversion function from `VaListImpl` to `VaList` - add deref coercion from `VaList` to `VaListImpl` - add support for the `asmjs` target All these changes were needed for use cases like: ```Rust let mut ap2 = va_copy(ap); vprintf(fmt, ap2); va_end(&mut ap2); ```
2019-06-18Make MaybeUninit #[repr(transparent)]Michael Bradshaw-1/+16
Tracking issue: #60405
2019-06-17Expose `VaListImpl` as the Rust equivalent of `__va_list_tag` and implement ↵Andrei Homescu-44/+187
Clone for it.
2019-06-17Rollup merge of #61885 - scottmcm:slice-iter-len-opt, r=rkruppe,RalfJungMazdak Farrokhzad-4/+23
Help LLVM better optimize slice::Iter(Mut)::len r? @RalfJung I've included a codegen test that fails without this change as a demonstration of usefulness.
2019-06-16make example code typecheck at leastRalf Jung-3/+11
2019-06-16keep links in local crate where possibleRalf Jung-9/+9
2019-06-15Help LLVM better optimize slice::Iter(Mut)::lenScott McMurray-4/+23
2019-06-16minor editsRalf Jung-9/+9
2019-06-15mention that overwrite-without-drop also violates the drop guarantee, and ↵Ralf Jung-8/+14
link some more stuff
2019-06-15explain better that structural pinning is a per-field choiceRalf Jung-29/+102
2019-06-15Remove the default type of `Rem::Output`Jonas Schievink-2/+1
2019-06-15Rollup merge of #61844 - AaronKutch:master, r=CentrilMazdak Farrokhzad-39/+39
Change `...` to `..=` where applicable This is mainly to fix #61816, but I decided to manually check a few thousand `...` throughout the code base to check for any other cases. I think I found a documentation bug in `src\libsyntax\ast.rs` where both `1..` and `1...` where mentioned. If there is internal support for both `1..` and `1..=` (that can exist before error handling gets to it), then I can add that back. There were some other cases that look like `// struct Closure<'l0...'li, T0...Tj, CK, CS, U0...Uk> {`, `// <P0 as Trait<P1...Pn>>::Foo: 'a`, and `assert!(min <= max, "discriminant range is {}...{}", min, max);`, but I am not sure if I should change those. There are a bunch of cases in the `/test/` directory that could be changed, but I presume I should just leave those be.
2019-06-15Rollup merge of #61785 - RalfJung:as-ref, r=rkruppeMazdak Farrokhzad-3/+35
note some safety concerns of raw-ptr-to-ref casts
2019-06-14Change `...` to `..=` where applicableAaron Kutch-39/+39
2019-06-14note some safety concerns of raw-ptr-to-ref castsRalf Jung-3/+35
2019-06-13Rollup merge of #61720 - alexcrichton:libstd-cfg-if-dep, r=sfacklerMazdak Farrokhzad-106/+25
std: Remove internal definitions of `cfg_if!` macro This is duplicated in a few locations throughout the sysroot to work around issues with not exporting a macro in libstd but still wanting it available to sysroot crates to define blocks. Nowadays though we can simply depend on the `cfg-if` crate on crates.io, allowing us to use it from there!
2019-06-13Rollup merge of #61629 - petrochenkov:stdmac, r=alexcrichtonMazdak Farrokhzad-11/+11
Hygienize macros in the standard library Same as https://github.com/rust-lang/rust/pull/55597, but for all macros in the standard library. Nested macro calls will now call what they are intended to call rather than whatever is in the closest scope at call site. Technically this is a breaking change, so crater run would probably be useful. --- One exception that is not hygienized is calls to `panic!(...)`. Macros defined in libcore do not want to call `core::panic`. What they really want to call is either `std::panic` or `core::panic` depending on `no_std` settings. EDIT: After some thought, recursive calls to `panic` from `panic` itself probably do want to use `$crate` (UPDATE: done). Calling `std::panic` from macros defined in std and "whatever `panic` is in scope" from macros defined in libcore is probably even worse than always calling "whatever `panic` is in scope", so I kept the existing code. The only way to do the std/core switch correctly that I'm aware of is to define a built-in panic macro that would dispatch to `std::panic` or `core::panic` using compiler magic. Then standard library macros could delegate to this built-in macro. The macro could be named `panic` too, that would fix https://github.com/rust-lang/rust/issues/61567. (This PR doesn't do that.) --- cc https://github.com/rust-lang/rust/issues/56389 cc https://github.com/rust-lang/rust/issues/61567 Fixes https://github.com/rust-lang/rust/issues/61699 r? @alexcrichton
2019-06-13Rollup merge of #61398 - kennytm:stabilize-copy-within, r=SimonSapinMazdak Farrokhzad-5/+17
Stabilize copy_within Closes #54236.
2019-06-13Rollup merge of #60376 - lzutao:stabilize-option_xor, r=SimonSapinMazdak Farrokhzad-3/+1
Stabilize Option::xor FCP done in https://github.com/rust-lang/rust/issues/50512#issuecomment-469527554 . Closes #50512 .
2019-06-12Hygienize macros in the standard libraryVadim Petrochenkov-11/+11
2019-06-12Rollup merge of #61671 - koalatux:nth-back-range, r=KodrAusMazdak Farrokhzad-0/+78
implement nth_back for Range(Inclusive) This is part of #54054.
2019-06-12Rollup merge of #61348 - dronesforwork-forks:clone-from, r=KodrAusMazdak Farrokhzad-2/+42
Implement Clone::clone_from for Option and Result See https://github.com/rust-lang/rust/issues/28481
2019-06-11Rollup merge of #61726 - cuviper:partition-for_each, r=scottmcmMazdak Farrokhzad-2/+2
Use `for_each` in `Iterator::partition` We already use this for `unzip`, but `partition` is not much different.
2019-06-11Rollup merge of #61724 - aschampion:128-bit-memcmp, r=sfacklerMazdak Farrokhzad-1/+1
core: use memcmp optimization for 128 bit integer slices All other sized integer slices do this. From #61665.
2019-06-11Rollup merge of #61715 - RalfJung:test-ascii-lowercase, r=varkorMazdak Farrokhzad-2/+2
make sure make_ascii_lowercase actually leaves upper-case non-ASCII characters alone Cc https://github.com/rust-lang/rust/pull/61677 @napen123
2019-06-10Use `for_each` in `Iterator::partition`Josh Stone-2/+2
We already use this for `unzip`, but `partition` is not much different.
2019-06-10std: Remove internal definitions of `cfg_if!` macroAlex Crichton-106/+25
This is duplicated in a few locations throughout the sysroot to work around issues with not exporting a macro in libstd but still wanting it available to sysroot crates to define blocks. Nowadays though we can simply depend on the `cfg-if` crate on crates.io, allowing us to use it from there!