summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2020-02-28use is_empty() instead of len() == x to determine if structs are empty.Matthias Krüger-1/+1
2020-02-28docs: add mention of async blocks in move keyword docsPulkit Goyal-0/+9
Fixes #69298
2020-02-27don't use .into() to convert types into identical types.Matthias Krüger-3/+1
example: let s: String = format!("hello").into();
2020-02-27use char instead of &str for single char patternsMatthias Krüger-2/+2
2020-02-27Remove spotlight usageGuillaume Gomez-3/+0
2020-02-26Rollup merge of #67637 - Mark-Simulacrum:primitive-mod, r=dtolnayDylan DPC-1/+4
Add primitive module to libcore This re-exports the primitive types from libcore at `core::primitive` to allow macro authors to have a reliable location to use them from. Fixes #44865
2020-02-23Bump core::primitive to 1.43David Tolnay-1/+1
2020-02-23docs: Stdin::read_line: mention the appendingJakub Kądziołka-1/+1
2020-02-23Implement `Copy` for `IoSlice`LeSeulArtichaut-0/+10
2020-02-23Auto merge of #69084 - yaahc:delayed-doc-lint, r=petrochenkovbors-8/+4
Split non macro portion of unused_doc_comment from macro part into two passes/lints ## Motivation This change is motivated by the needs of the [spandoc library](https://github.com/yaahc/spandoc). The specific use case is that my macro is removing doc comments when an attribute is applied to a fn with doc comments, but I would like the lint to still appear when I forget to add the `#[spandoc]` attribute to a fn, so I don't want to have to silence the lint globally. ## Approach This change splits the `unused _doc_comment` lint into two lints, `unused_macro_doc_comment` and `unused_doc_comment`. The non macro portion is moved into an `early_lint_pass` rather than a pre_expansion_pass. This allows proc macros to silence `unused_doc_comment` warnings by either adding an attribute to silence it or by removing the doc comment before the early_pass runs. The `unused_macro_doc_comment` lint however will still be impossible for proc-macros to silence, but the only alternative that I can see is to remove this lint entirely, which I don't think is acceptable / is a decision I'm not comfortable making personally, so instead I opted to split the macro portion of the check into a separate lint so that it can be silenced globally with an attribute if necessary without needing to globally silence the `unused_doc_comment` lint as well, which is still desireable. fixes https://github.com/rust-lang/rust/issues/67838
2020-02-22rustfmt darnitJane Lusby-6/+2
2020-02-22make doc comments regular commentsJane Lusby-2/+2
2020-02-20Rollup merge of #68945 - mjbshaw:once_is_completed, r=LukasKalbertodtDylan DPC-6/+5
Stabilize Once::is_completed Closes #54890 This function has been around for some time. I haven't seen anyone raise any objections to it. I've personally found it useful myself. It would be nice to finally stabilize it and
2020-02-19Reword OpenOptions::{create, create_new} doc.jumbatm-8/+4
2020-02-18Rollup merge of #68767 - kubo39:patch-macos, r=shepmasterYuki Okushi-2/+3
macOS: avoid calling pthread_self() twice
2020-02-16macOS: avoid calling pthread_self() twiceHiroki Noda-2/+3
2020-02-15Rollup merge of #69106 - RReverser:wasi-fs-copy, r=KodrAusDylan DPC-1/+9
Fix std::fs::copy on WASI target Previously `std::fs::copy` on wasm32-wasi would reuse code from the `sys_common` module and would successfully copy contents of the file just to fail right before closing it. This was happening because `sys_common::copy` tries to copy permissions of the file, but permissions are not a thing in WASI (at least yet) and `set_permissions` is implemented as an unconditional runtime error. This change instead adds a custom working implementation of `std::fs::copy` (like Rust already has on some other targets) that doesn't try to call `set_permissions` and is essentially a thin wrapper around `std::io::copy`. Fixes #68560.
2020-02-15Rollup merge of #64069 - ↵Dylan DPC-0/+28
danielhenrymantilla:feature/cstring_from_vec_of_nonzerou8, r=KodrAus Added From<Vec<NonZeroU8>> for CString Added a `From<Vec<NonZeroU8>>` `impl` for `CString` # Rationale - `CString::from_vec_unchecked` is a subtle function, that makes `unsafe` code harder to audit when the generated `Vec`'s creation is non-trivial. This `impl` allows to write safer `unsafe` code thanks to the very explicit semantics of the `Vec<NonZeroU8>` type. - One such situation is when trying to `.read()` a `CString`, see issue #59229. - this lead to a PR: #59314, that was closed for being too specific / narrow (it only targetted being able to `.read()` a `CString`, when this pattern could have been generalized). - the issue suggested another route, based on `From<Vec<NonZeroU8>>`, which is indeed a less general and more concise code pattern. - quoting @shnatsel: - > For me the main thing about making this safe is simplifying auditing - people have spent like an hour looking at just this one unsafe block in libflate because it's not clear what exactly is unchecked, so you have to look it up when auditing anyway. This has distracted us from much more serious memory safety issues the library had. Having this trivial impl in stdlib would turn this into safe code with compiler more or less guaranteeing that it's fine, and save anyone auditing the code a whole lot of time.
2020-02-14Fix tests after rebaseMatthew Jasper-1/+2
2020-02-13keyword docs for else and inkeyword docs for else and in.Giles Cope-5/+56
2020-02-13Add comment to SGX entry codeJethro Beekman-0/+1
2020-02-13Rollup merge of #69068 - Goirad:make-sgx-arg-cleanup-nop, r=jethrogb,nagisaDylan DPC-6/+1
Make the SGX arg cleanup implementation a NOP fixes #64304 cc @jethrogb
2020-02-13Rollup merge of #67642 - Mark-Simulacrum:relax-bounds, r=AmanieuDylan DPC-75/+71
Relax bounds on HashMap/HashSet These APIs changed from the old bound listed to the new bound (possibly empty): K: Hash + Eq -> K * new * with_capacity K: Eq + Hash, S: BuildHasher -> K, S * with_hasher * with_capacity_and_hasher * hasher K: Eq + Hash + Debug -> K: Debug S: BuildHasher -> S HashMap as Debug K: Eq + Hash -> K S: BuildHasher + Default -> S: Default HashMap as Default Resolves #44777.
2020-02-12Fix std::fs::copy on WASI targetIngvar Stepanyan-1/+9
Previously `std::fs::copy` on wasm32-wasi would reuse code from the `sys_common` module and would successfully copy contents of the file just to fail right before closing it. This was happening because `sys_common::copy` tries to copy permissions of the file, but permissions are not a thing in WASI (at least yet) and `set_permissions` is implemented as an unconditional runtime error. This change instead adds a custom working implementation of `std::fs::copy` (like Rust already has on some other targets) that doesn't try to call `set_permissions` and is essentially a thin wrapper around `std::io::copy`. Fixes #68560.
2020-02-12Rollup merge of #69040 - jethrogb:jb/cleanup-sgx-entry, r=nagisaDylan DPC-10/+29
Cleanup SGX entry code cc @aandyl
2020-02-12Rollup merge of #69038 - yaahc:backtrace-debug, r=dtolnayDylan DPC-6/+63
Add initial debug fmt for Backtrace Fixes the first point in https://github.com/rust-lang/rust/issues/65280 related to https://github.com/rust-lang/rust/issues/53487
2020-02-12Add notice about using new consts in new code on float modulesLinus Färnstrand-2/+8
2020-02-12Remove reference from integer docs to their modulesLinus Färnstrand-24/+0
2020-02-12Stabilize assoc_int_constsLinus Färnstrand-1/+0
2020-02-12Rollup merge of #69042 - yaahc:backtrace-header, r=dtolnayDylan DPC-1/+2
Remove backtrace header text Fixes point 3 from https://github.com/rust-lang/rust/issues/65280 related to https://github.com/rust-lang/rust/issues/53487 This should probably be double checked by someone who works on fuschia because theres some extra fuschia specific output in `add_context` that is also removed by this change.
2020-02-12Rollup merge of #67695 - gilescope:truth, r=centrilYuki Okushi-5/+44
Added dyn and true keyword docs r? @Centril
2020-02-11Fix failing backtrace ui testsJane Lusby-0/+1
2020-02-11Keyword docsGiles Cope-5/+44
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com> Co-Authored-By: Tim Robinson <tim.g.robinson@gmail.com> Co-Authored-By: Peter Todd <pete@petertodd.org> Co-Authored-By: Dylan DPC <dylan.dpc@gmail.com>
2020-02-11make the sgx arg cleanup implementation a no opDario Gonzalez-6/+1
2020-02-11remove intentionally failing testJane Lusby-18/+0
2020-02-10backwards again, god damnitJane Lusby-1/+1
2020-02-10rule over the code in libstd with an iron fistJane Lusby-9/+4
2020-02-10maximum alternative consistency!Jane Lusby-2/+9
2020-02-10make symbol printing consistent with backtrace_rsJane Lusby-2/+3
2020-02-10add nice alt fmt for debugJane Lusby-6/+6
2020-02-10use debug_map and skip empty framesJane Lusby-5/+10
2020-02-10remove Some from fn nameJane Lusby-1/+1
2020-02-10final format cleanupsJane Lusby-1/+8
2020-02-10make it compileJane Lusby-1/+1
2020-02-10remove unnecessary Debug impl for BacktraceFrameJane Lusby-6/+0
2020-02-10remove unnecessary derivesJane Lusby-2/+0
2020-02-10less noisy formatJane Lusby-7/+37
2020-02-10Get vaguely working with a test for checking outputJane Lusby-1/+26
2020-02-10Add initial debug fmt for BacktraceJane Lusby-6/+19
2020-02-10Bump version to backtrace without the headerJane Lusby-1/+1