about summary refs log tree commit diff
path: root/library/std
AgeCommit message (Collapse)AuthorLines
2024-03-27Auto merge of #116016 - jhpratt:kill-rustc-serialize, r=ehussbors-12/+23
Soft-destabilize `RustcEncodable` & `RustcDecodable`, remove from prelude in next edition cc rust-lang/libs-team#272 Any use of `RustcEncodable` and `RustcDecodable` now triggers a deny-by-default lint. The derives have been removed from the 2024 prelude. I specifically chose **not** to document this in the module-level documentation, as the presence in existing preludes is not documented (which I presume is intentional). This does not implement the proposed change for `rustfix`, which I will be looking into shortly. With regard to the items in the preludes being stable, this should not be an issue because #15702 has been resolved. r? libs-api
2024-03-27Rollup merge of #123118 - tgross35:rwlock-docs, r=workingjubileeMatthias Krüger-6/+7
Update `RwLock` deadlock example to not use shadowing Tweak variable names in the deadlock example to remove any potential confusion that the behavior is somehow shadowing-related.
2024-03-27Rollup merge of #123084 - a1phyr:unixstream_read_buf, r=workingjubileeMatthias Krüger-0/+8
`UnixStream`: override `read_buf` Split from #122441 r? ``@workingjubilee``
2024-03-27Rollup merge of #123038 - he32:netbsd-ilp32-fix, r=workingjubileeMatthias Krüger-1/+1
std library thread.rs: fix NetBSD code for ILP32 CPUs.
2024-03-27Rollup merge of #122880 - a1phyr:preadv_more_platform, r=workingjubileeMatthias Krüger-6/+22
Unix: Support more platforms with `preadv` and `pwritev` - `aix`, `dragonfly` and `openbsd` with direct call - `watchos` with weak linkage cc #89517
2024-03-26Update `RwLock` deadlock example to not use shadowingTrevor Gross-6/+7
Tweak variable names in the deadlock example to remove any potential confusion that the behavior is somehow shadowing-related.
2024-03-26Rollup merge of #123057 - sthibaul:systemtime, r=jhprattMatthias Krüger-2/+2
unix fs: Make hurd using explicit new rather than From 408c0ea2162b ("unix time module now return result") dropped the From impl for SystemTime, breaking the hurd build (and probably the horizon build) Fixes #123032
2024-03-26unix fs: Make hurd and horizon using explicit new rather than FromSamuel Thibault-2/+2
408c0ea2162b ("unix time module now return result") dropped the From impl for SystemTime, breaking the hurd and horizon builds. Fixes #123032
2024-03-26Unix: Support more platforms with `preadv` and `pwritev`Benoît du Garreau-6/+22
2024-03-26`UnixStream`: override `read_buf`Benoît du Garreau-0/+8
2024-03-26Fix link to BufWriterding-young-1/+1
2024-03-26std library unix/thread.rs: fix NetBSD code for ILP32 CPUs.Havard Eidnes-1/+1
2024-03-25lib: fix some unnecessary_cast clippy lintklensy-2/+2
warning: casting raw pointers to the same type and constness is unnecessary (`*mut V` -> `*mut V`) --> library\alloc\src\collections\btree\map\entry.rs:357:31 | 357 | let val_ptr = root.borrow_mut().push(self.key, value) as *mut V; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `root.borrow_mut().push (self.key, value)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast warning: casting to the same type is unnecessary (`usize` -> `usize`) --> library\alloc\src\ffi\c_str.rs:411:56 | 411 | let slice = slice::from_raw_parts_mut(ptr, len as usize); | ^^^^^^^^^^^^ help: try: `len` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast warning: casting raw pointers to the same type and constness is unnecessary (`*mut T` -> `*mut T`) --> library\alloc\src\slice.rs:516:25 | 516 | (buf.as_mut_ptr() as *mut T).add(buf.len()), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `buf.as_mut_ptr()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast warning: casting raw pointers to the same type and constness is unnecessary (`*mut T` -> `*mut T`) --> library\alloc\src\slice.rs:537:21 | 537 | (buf.as_mut_ptr() as *mut T).add(buf.len()), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `buf.as_mut_ptr()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast warning: casting raw pointers to the same type and constness is unnecessary (`*const ()` -> `*const ()`) --> library\alloc\src\task.rs:151:13 | 151 | waker as *const (), | ^^^^^^^^^^^^^^^^^^ help: try: `waker` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast warning: casting raw pointers to the same type and constness is unnecessary (`*const ()` -> `*const ()`) --> library\alloc\src\task.rs:323:13 | 323 | waker as *const (), | ^^^^^^^^^^^^^^^^^^ help: try: `waker` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast warning: casting to the same type is unnecessary (`usize` -> `usize`) --> library\std\src\sys_common\net.rs:110:21 | 110 | assert!(len as usize >= mem::size_of::<c::sockaddr_in>()); | ^^^^^^^^^^^^ help: try: `len` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast warning: casting to the same type is unnecessary (`usize` -> `usize`) --> library\std\src\sys_common\net.rs:116:21 | 116 | assert!(len as usize >= mem::size_of::<c::sockaddr_in6>()); | ^^^^^^^^^^^^ help: try: `len` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
2024-03-24Rollup merge of #122992 - devnexen:available_parallelism_sol_upd, r=AmanieuMatthias Krüger-2/+6
std::thread: refine available_parallelism for solaris/illumos. Rather than the system-wide available cpus fallback solution, we fetch the cpus bound to the current process.
2024-03-24Rollup merge of #122984 - RalfJung:panic-in-hook, r=AmanieuMatthias Krüger-5/+10
panic-in-panic-hook: formatting a message that's just a string is risk-free This slightly improves the output in the 'panic while processing panic' case if the panic message does not involve any formatting. Follow-up to https://github.com/rust-lang/rust/pull/122930. r? ``@Amanieu``
2024-03-24Rollup merge of #122983 - taiki-e:bsd, r=workingjubileeMatthias Krüger-1/+1
Fix build failure on ARM/AArch64/PowerPC/RISC-V FreeBSD/NetBSD Fixes https://github.com/rust-lang/rust/pull/121881#discussion_r1536764650 Checked targets: aarch64-unknown-freebsd, powerpc64-unknown-freebsd, armv7-unknown-freebsd, riscv64gc-unknown-freebsd, aarch64-unknown-netbsd. r? ``@Amanieu`` cc ``@devnexen``
2024-03-24fix build.David Carlier-5/+3
2024-03-24std::thread: refine available_parallelism for solaris/illumos.David Carlier-0/+6
Rather than the system-wide available cpus fallback solution, we fetch the cpus bound to the current process.
2024-03-24panic-in-panic-hook: formatting a message that's just a string is risk-freeRalf Jung-5/+10
2024-03-24Fix build failure on ARM/AArch64/PowerPC/RISC-V FreeBSD/NetBSDTaiki Endo-1/+1
2024-03-23Rollup merge of #120419 - Ayush1325:uefi-sys-os, r=nicholasbishop,workingjubileeJubilee-10/+81
Expand sys/os for UEFI - Implement current_exe() and getcwd()
2024-03-23Fixed builds with modified libcAdam Gastineau-0/+3
2024-03-23Rollup merge of #122930 - RalfJung:panic-in-panic-fmt, r=AmanieuMatthias Krüger-1/+7
add panic location to 'panicked while processing panic' Fixes https://github.com/rust-lang/rust/issues/97181 r? `@Amanieu`
2024-03-23Rollup merge of #122916 - MultisampledNight:docs-sync-typo, r=jhprattMatthias Krüger-2/+2
docs(sync): normalize dot in fn summaries All other functions in e.g. [`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html) have a dot at the end of their first doc line, except for the newly stabilized [`Mutex::clear_poison`](https://doc.rust-lang.org/std/sync/struct.Mutex.html#method.clear_poison) (and its friend [`RwLock::clear_poison`](https://doc.rust-lang.org/std/sync/struct.RwLock.html#method.clear_poison)). This PR remedies that by adding a normalizing dot.
2024-03-23rename ptr::from_exposed_addr -> ptr::with_exposed_provenanceRalf Jung-7/+7
2024-03-23add panic location to 'panicked while processing panic'Ralf Jung-1/+7
2024-03-23Auto merge of #119552 - krtab:dead_code_priv_mod_pub_field, r=cjgillot,saethlinbors-1/+7
Replace visibility test with reachability test in dead code detection Fixes https://github.com/rust-lang/rust/issues/119545 Also included is a fix for an error now flagged by the lint
2024-03-22docs(sync): normalize dot in fn summariesMultisampledNight-2/+2
2024-03-22Remove RustcEncodable/Decodable from 2024 preludeJacob Pratt-17/+23
2024-03-22Soft-destabilize `RustcEncodable`/`RustcDecodable`Jacob Pratt-1/+6
2024-03-22Avoid a panic in `set_output_capture` in the default panic handlerJohn Kåre Alsaker-9/+29
2024-03-22Rollup merge of #121881 - devnexen:bsd_acceptfilter, r=AmanieuMatthias Krüger-0/+83
std::net: adding acceptfilter feature for netbsd/freebsd. similar to linux's ext deferaccept, to filter incoming connections before accept.
2024-03-21Implement macro-based deref!() syntax for deref patternsMichael Goulet-0/+9
Stop using `box PAT` syntax for deref patterns, as it's misleading and also causes their semantics being tangled up.
2024-03-20Rollup merge of #122729 - m-ou-se:relax, r=AmanieuJacob Pratt-49/+63
Relax SeqCst ordering in standard library. Every single SeqCst in the standard library is unnecessary. In all cases, Relaxed or Release+Acquire was sufficient. As I [wrote](https://marabos.nl/atomics/memory-ordering.html#common-misconceptions) in my book on atomics: > [..] when reading code, SeqCst basically tells the reader: "this operation depends on the total order of every single SeqCst operation in the program," which is an incredibly far-reaching claim. The same code would likely be easier to review and verify if it used weaker memory ordering instead, if possible. For example, Release effectively tells the reader: "this relates to an acquire operation on the same variable," which involves far fewer considerations when forming an understanding of the code. > > It is advisable to see SeqCst as a warning sign. Seeing it in the wild often means that either something complicated is going on, or simply that the author did not take the time to analyze their memory ordering related assumptions, both of which are reasons for extra scrutiny. r? ````@Amanieu```` ````@joboet````
2024-03-20std::net: adding acceptfilter feature for netbsd/freebsd.David Carlier-0/+83
similar to linux's ext deferaccept, to filter incoming connections before accept.
2024-03-20SeqCst->Relaxed in condvar test.Mara Bos-2/+2
Relaxed is enough here. Synchronization is done by the mutex.
2024-03-20SeqCst->Relaxed in thread local test.Mara Bos-8/+11
Relaxed memory ordering is fine because spawn()/join() already provides all the synchronization we need.
2024-03-20SeqCst->Relaxed in std::net::test.Mara Bos-2/+2
Relaxed is enough to have fetch_add(1) return each value only once (until it wraps around).
2024-03-20Use less restricted memory ordering in xous::thread_local_key.Mara Bos-5/+5
SeqCst isn't necessary in any of these cases.
2024-03-20Auto merge of #122754 - Mark-Simulacrum:bootstrap-bump, r=albertlarsan68bors-8/+5
Bump to 1.78 bootstrap compiler https://forge.rust-lang.org/release/process.html#master-bootstrap-update-t-2-day-tuesday
2024-03-20step cfgsMark Rousskov-5/+2
2024-03-20Rollup merge of #122739 - Sky9x:insert-put, r=jhprattMatthias Krüger-2/+2
Add "put" as a confusable for insert on hash map/set Already a confusable on btree map/set. Java's `Map` calls the insert method `put`: https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Map.html#put(K,V)
2024-03-20Rollup merge of #122730 - ferrocene:hoverbear/qnx-ucred-cfgs, r=AmanieuMatthias Krüger-3/+6
Expose `ucred::peer_cred` on QNX targets to enable dist builds After following https://doc.rust-lang.org/rustc/platform-support/nto-qnx.html I attempted to run the following `x.py` command: ```bash export build_env=' CC_aarch64-unknown-nto-qnx710=qcc CFLAGS_aarch64-unknown-nto-qnx710=-Vgcc_ntoaarch64le_cxx CXX_aarch64-unknown-nto-qnx710=qcc AR_aarch64_unknown_nto_qnx710=ntoaarch64-ar CC_x86_64-pc-nto-qnx710=qcc CFLAGS_x86_64-pc-nto-qnx710=-Vgcc_ntox86_64_cxx CXX_x86_64-pc-nto-qnx710=qcc AR_x86_64_pc_nto_qnx710=ntox86_64-ar' env $build_env ./x.py --stage 2 dist rust-std --target aarch64-unknown-nto-qnx710,x86_64-pc-nto-qnx710,x86_64-unknown-linux-gnu ``` The result was the following error: ``` Compiling object v0.32.2 Compiling std_detect v0.1.5 (/home/ana/git/rust-lang/rust/library/stdarch/crates/std_detect) Compiling addr2line v0.21.0 error: function `peer_cred` is never used --> library/std/src/os/unix/net/ucred.rs:89:12 | 89 | pub fn peer_cred(socket: &UnixStream) -> io::Result<UCred> { | ^^^^^^^^^ | = note: `-D dead-code` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(dead_code)]` error: could not compile `std` (lib) due to 1 previous error Build completed unsuccessfully in 0:06:25 ``` I contacted `@flba-eb` and `@gh-tr` over email and we confirmed that `peer_cred` here should be flagged on `nto` targets. This should enable the clean `x.py --stage 2 dist rust-std` command on these platforms.
2024-03-19branch 1.78: replace-version-placeholderMark Rousskov-3/+3
2024-03-20resolve clippy errorsonur-ozkan-4/+3
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-03-19Add "put" as a confusable for insert on hash map/setSky-2/+2
2024-03-19Expose ucred::peer_cred on QNX targets to enable dist buildsAna Hobden-3/+6
2024-03-19SeqCst->Relaxed for xous set_nonblocking.Mara Bos-1/+1
The SeqCst wasn't synchronizing with anything. Relaxed is enough.
2024-03-19SeqCst->{Release,Acquire} for xous DropLock.Mara Bos-3/+6
SeqCst is unnecessary. Release+Acquire is the right ordering for a mutex.
2024-03-19SeqCst->Relaxed in pal::windows::pipe.Mara Bos-4/+4
Relaxed is enough to ensure fetch_add(1) returns each integer exactly once.