| Age | Commit message (Collapse) | Author | Lines | |
|---|---|---|---|---|
| 2022-12-01 | Auto merge of #104160 - Ayush1325:windows-args, r=m-ou-se | bors | -52/+62 | |
| Extract WStrUnits to sys_common::wstr This commit extracts WStrUnits from sys::windows::args to sys_common::wstr. This allows using the same structure for other targets which use wtf8 (example UEFI). This was originally a part of https://github.com/rust-lang/rust/pull/100316 Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com> | ||||
| 2022-11-30 | Add test for regression for FileType equality | Arthur Carcano | -0/+16 | |
| Cf: https://github.com/rust-lang/rust/issues/104900 | ||||
| 2022-11-30 | Add missing intra-doc link | Jacob Pratt | -2/+3 | |
| 2022-11-30 | Rollup merge of #104811 - haraldh:feat/wasm32_wasi_shutdown, r=joshtriplett | Matthias Krüger | -2/+8 | |
| feat: implement TcpStream shutdown for wasm32-wasi Signed-off-by: Harald Hoyer <harald@profian.com> | ||||
| 2022-11-29 | Add in the comment that solaris lacks also the 'linkat' | Daniel Laügt | -1/+1 | |
| 2022-11-29 | Rollup merge of #105049 - mkroening:hermit-fixes, r=jyn514 | Matthias Krüger | -4/+3 | |
| Hermit: Minor build fixes These changes are necessary to build for the hermit targets. CC: ``@stlankes`` | ||||
| 2022-11-29 | Adjust inlining attributes around panic_immediate_abort | Ben Kimock | -2/+2 | |
| 2022-11-29 | hermit: Remove unused exports | Martin Kröning | -3/+1 | |
| 2022-11-29 | hermit: Fix fuzzy_provenance_casts | Martin Kröning | -1/+2 | |
| 2022-11-28 | Add `as_mut_os_string` to `&mut PathBuf` and `as_mut_os_str` to `&mut Path` | Andres Suarez | -0/+46 | |
| Implements rust-lang/libs-team#140 | ||||
| 2022-11-28 | Implement DerefMut for PathBuf | Andres Suarez | -0/+14 | |
| 2022-11-28 | Extract WStrUnits to sys_common::wstr | Ayush Singh | -52/+62 | |
| This commit extracts WStrUnits from sys::windows::args to sys_common::wstr. This allows using the same structure for other targets which use wtf8 (example UEFI). This was originally a part of https://github.com/rust-lang/rust/pull/100316 Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com> | ||||
| 2022-11-28 | linkat() not available in the system headers of Solaris 10 | Daniel Laügt | -1/+1 | |
| 2022-11-26 | Remove redundant `all` in cfg | Chris Denton | -6/+6 | |
| 2022-11-25 | Implement masking in FileType comparison on Unix | Arthur Carcano | -1/+10 | |
| Fixes: https://github.com/rust-lang/rust/issues/104900 | ||||
| 2022-11-24 | Revert "Forbid inlining `thread_local!`'s `__getit` function on Windows" | Thom Chiovoloni | -16/+9 | |
| This reverts commit 3099dfdd9fc1a331eb9c53200b310fa1a06e1573. | ||||
| 2022-11-24 | feat: implement TcpStream shutdown for wasm32-wasi | Harald Hoyer | -2/+8 | |
| Signed-off-by: Harald Hoyer <harald@profian.com> | ||||
| 2022-11-22 | Rollup merge of #104647 - RalfJung:alloc-strict-provenance, r=thomcc | Manish Goregaokar | -4/+8 | |
| enable fuzzy_provenance_casts lint in liballoc and libstd r? ````@thomcc```` | ||||
| 2022-11-23 | Rollup merge of #101368 - thomcc:wintls-noinline, r=ChrisDenton | Yuki Okushi | -9/+16 | |
| Forbid inlining `thread_local!`'s `__getit` function on Windows Sadly, this will make things slower to avoid UB in an edge case, but it seems hard to avoid... and really whenever I look at this code I can't help but think we're asking for trouble. It's pretty dodgy for us to leave this as a normal function rather than `#[inline(never)]`, given that if it *does* get inlined into a dynamically linked component, it's extremely unsafe (you get some other thread local, or if you're lucky, crash). Given that it's pretty rare for people to use dylibs on Windows, the fact that we haven't gotten bug reports about it isn't really that convincing. Ideally we'd come up with some kind of compiler solution (that avoids paying for this cost when static linking, or *at least* for use within the same crate...), but it's not clear what that looks like. Oh, and because all this is only needed when we're implementing `thread_local!` with `#[thread_local]`, this patch adjusts the `cfg_attr` to be `all(windows, target_thread_local)` as well. r? ``@ChrisDenton`` See also #84933, which is about improving the situation. | ||||
| 2022-11-22 | disable strict-provenance-violating doctests in Miri | Ralf Jung | -0/+2 | |
| 2022-11-22 | Forbid inlining `thread_local!`'s `__getit` function on Windows | Thom Chiovoloni | -9/+16 | |
| 2022-11-22 | rustdoc: Fix backoff doc to match implementation | Jonas Spinner | -1/+1 | |
| 2022-11-22 | Rollup merge of #103193 - krasimirgg:sysonce, r=Amanieu | Manish Goregaokar | -0/+1 | |
| mark sys_common::once::generic::Once::new const-stable Attempt to address https://github.com/rust-lang/rust/issues/103191 by marking the impl const-stable. Picked the declaration from the callsite: https://github.com/rust-lang/rust/blob/21b246587c2687935bd6004ffa5dcc4f4dd6600d/library/std/src/sync/once.rs#L67 This is similar to https://github.com/rust-lang/rust/pull/98457. With this in, `python3 x.py build library/std --target x86_64-unknown-none` succeeds. | ||||
| 2022-11-22 | Rollup merge of #83608 - Kimundi:index_many, r=Mark-Simulacrum | Manish Goregaokar | -0/+1 | |
| Add slice methods for indexing via an array of indices. Disclaimer: It's been a while since I contributed to the main Rust repo, apologies in advance if this is large enough already that it should've been an RFC. --- # Update: - Based on feedback, removed the `&[T]` variant of this API, and removed the requirements for the indices to be sorted. # Description This adds the following slice methods to `core`: ```rust impl<T> [T] { pub unsafe fn get_many_unchecked_mut<const N: usize>(&mut self, indices: [usize; N]) -> [&mut T; N]; pub fn get_many_mut<const N: usize>(&mut self, indices: [usize; N]) -> Option<[&mut T; N]>; } ``` This allows creating multiple mutable references to disjunct positions in a slice, which previously required writing some awkward code with `split_at_mut()` or `iter_mut()`. For the bound-checked variant, the indices are checked against each other and against the bounds of the slice, which requires `N * (N + 1) / 2` comparison operations. This has a proof-of-concept standalone implementation here: https://crates.io/crates/index_many Care has been taken that the implementation passes miri borrow checks, and generates straight-forward assembly (though this was only checked on x86_64). # Example ```rust let v = &mut [1, 2, 3, 4]; let [a, b] = v.get_many_mut([0, 2]).unwrap(); std::mem::swap(a, b); *v += 100; assert_eq!(v, &[3, 2, 101, 4]); ``` # Codegen Examples <details> <summary>Click to expand!</summary> Disclaimer: Taken from local tests with the standalone implementation. ## Unchecked Indexing: ```rust pub unsafe fn example_unchecked(slice: &mut [usize], indices: [usize; 3]) -> [&mut usize; 3] { slice.get_many_unchecked_mut(indices) } ``` ```nasm example_unchecked: mov rcx, qword, ptr, [r9] mov r8, qword, ptr, [r9, +, 8] mov r9, qword, ptr, [r9, +, 16] lea rcx, [rdx, +, 8*rcx] lea r8, [rdx, +, 8*r8] lea rdx, [rdx, +, 8*r9] mov qword, ptr, [rax], rcx mov qword, ptr, [rax, +, 8], r8 mov qword, ptr, [rax, +, 16], rdx ret ``` ## Checked Indexing (Option): ```rust pub unsafe fn example_option(slice: &mut [usize], indices: [usize; 3]) -> Option<[&mut usize; 3]> { slice.get_many_mut(indices) } ``` ```nasm mov r10, qword, ptr, [r9, +, 8] mov rcx, qword, ptr, [r9, +, 16] cmp rcx, r10 je .LBB0_7 mov r9, qword, ptr, [r9] cmp rcx, r9 je .LBB0_7 cmp rcx, r8 jae .LBB0_7 cmp r10, r9 je .LBB0_7 cmp r9, r8 jae .LBB0_7 cmp r10, r8 jae .LBB0_7 lea r8, [rdx, +, 8*r9] lea r9, [rdx, +, 8*r10] lea rcx, [rdx, +, 8*rcx] mov qword, ptr, [rax], r8 mov qword, ptr, [rax, +, 8], r9 mov qword, ptr, [rax, +, 16], rcx ret .LBB0_7: mov qword, ptr, [rax], 0 ret ``` ## Checked Indexing (Panic): ```rust pub fn example_panic(slice: &mut [usize], indices: [usize; 3]) -> [&mut usize; 3] { let len = slice.len(); match slice.get_many_mut(indices) { Some(s) => s, None => { let tmp = indices; index_many::sorted_bound_check_failed(&tmp, len) } } } ``` ```nasm example_panic: sub rsp, 56 mov rax, qword, ptr, [r9] mov r10, qword, ptr, [r9, +, 8] mov r9, qword, ptr, [r9, +, 16] cmp r9, r10 je .LBB0_6 cmp r9, rax je .LBB0_6 cmp r9, r8 jae .LBB0_6 cmp r10, rax je .LBB0_6 cmp rax, r8 jae .LBB0_6 cmp r10, r8 jae .LBB0_6 lea rax, [rdx, +, 8*rax] lea r8, [rdx, +, 8*r10] lea rdx, [rdx, +, 8*r9] mov qword, ptr, [rcx], rax mov qword, ptr, [rcx, +, 8], r8 mov qword, ptr, [rcx, +, 16], rdx mov rax, rcx add rsp, 56 ret .LBB0_6: mov qword, ptr, [rsp, +, 32], rax mov qword, ptr, [rsp, +, 40], r10 mov qword, ptr, [rsp, +, 48], r9 lea rcx, [rsp, +, 32] mov edx, 3 call index_many::bound_check_failed ud2 ``` </details> # Extensions There are multiple optional extensions to this. ## Indexing With Ranges This could easily be expanded to allow indexing with `[I; N]` where `I: SliceIndex<Self>`. I wanted to keep the initial implementation simple, so I didn't include it yet. ## Panicking Variant We could also add this method: ```rust impl<T> [T] { fn index_many_mut<const N: usize>(&mut self, indices: [usize; N]) -> [&mut T; N]; } ``` This would work similar to the regular index operator and panic with out-of-bound indices. The advantage would be that we could more easily ensure good codegen with a useful panic message, which is non-trivial with the `Option` variant. This is implemented in the standalone implementation, and used as basis for the codegen examples here and there. | ||||
| 2022-11-21 | dont attempt strict provenance in SGX | Ralf Jung | -0/+1 | |
| 2022-11-21 | reflow the stack size story | Tshepang Mbambo | -2/+4 | |
| 2022-11-20 | enable fuzzy_provenance_casts lint in libstd | Ralf Jung | -4/+7 | |
| 2022-11-20 | Rollup merge of #104558 - thomcc:unalign-diriter, r=ChrisDenton | Matthias Krüger | -10/+23 | |
| Don't assume `FILE_ID_BOTH_DIR_INFO` will be aligned Fixes #104530. See that issue for info. r? `@ChrisDenton` | ||||
| 2022-11-20 | Rollup merge of #104537 - HintringerFabian:docs_default_min_stack_size, ↵ | Matthias Krüger | -3/+2 | |
| r=the8472 fix std::thread docs are unclear regarding stack sizes Improves the documentation about the default stack size of a spawned thread Fixes #102671 | ||||
| 2022-11-20 | Add get_many_mut methods to slice | Marvin Löbel | -0/+1 | |
| 2022-11-20 | cfg(miri) no longer needed in sys/unix/time.rs | Ralf Jung | -2/+2 | |
| 2022-11-20 | Improve documentation of Stack size | Fabian Hintringer | -3/+2 | |
| 2022-11-19 | Add unstable `type_ascribe` macro | Nilstrieb | -0/+8 | |
| This macro serves as a placeholder for future type ascription syntax to make sure that the semantic implementation keeps working. | ||||
| 2022-11-19 | Rollup merge of #104553 - mwillsey:asinh-acosh-accuracy, r=thomcc | Dylan DPC | -4/+32 | |
| Improve accuracy of asinh and acosh This PR addresses the inaccuracy of `asinh` and `acosh` identified by the [Herbie](http://herbie.uwplse.org/) tool, `@pavpanchekha,` `@finnbear` in #104548. It also adds a couple tests that failed in the existing implementations and now pass. Closes #104548 r? rust-lang/libs | ||||
| 2022-11-19 | Rollup merge of #104528 - WaffleLapkin:lazy_lock_docfix, r=matklad | Dylan DPC | -3/+7 | |
| Properly link `{Once,Lazy}{Cell,Lock}` in docs See https://github.com/rust-lang/rust/issues/74465#issuecomment-1317947443 | ||||
| 2022-11-18 | Rollup merge of #103594 - maniwani:fix-issue-91417, r=thomcc | Matthias Krüger | -9/+24 | |
| Fix non-associativity of `Instant` math on `aarch64-apple-darwin` targets This is a duplicate of #94100 (since the original author is unresponsive), which resolves #91417. On `aarch64-apple-darwin` targets, the internal resolution of `Instant` is lower than that of `Duration`, so math between them becomes non-associative with small-enough durations. This PR makes this target use the standard Unix implementation (where `Instant` has 1ns resolution), but with `CLOCK_UPTIME_RAW` so it still returns the same values as `mach_absolute_time`[^1]. (Edit: I need someone to confirm that this still works, I do not have access to an M1 device.) [^1]: https://www.manpagez.com/man/3/clock_gettime/ | ||||
| 2022-11-18 | Handle the case that even the filename array is unaligned. | Thom Chiovoloni | -5/+14 | |
| 2022-11-17 | Don't assume `FILE_ID_BOTH_DIR_INFO` will be aligned | Thom Chiovoloni | -5/+9 | |
| 2022-11-17 | Improve accuracy of asinh and acosh | Max Willsey | -4/+32 | |
| 2022-11-17 | Properly link `{Once,Lazy}{Cell,Lock}` in docs | Maybe Waffle | -3/+7 | |
| 2022-11-16 | available_parallelism: Handle 0 cfs_period_us | Adam Casey | -2/+2 | |
| There seem to be some scenarios where `cpu.cfs_period_us` can contain `0` This causes a panic when calling `std::thread::available_parallelism()` as is done so from binaries built by `cargo test`, which was how the issue was discovered. I don't feel like `0` is a good value for `cpu.cfs_period_us`, but I also don't think applications should panic if this value is seen. This case is handled by other projects which read this information: - num_cpus: https://github.com/seanmonstar/num_cpus/blob/e437b9d9083d717692e35d917de8674a7987dd06/src/linux.rs#L207-L210 - ninja: https://github.com/ninja-build/ninja/pull/2174/files - dotnet: https://github.com/dotnet/runtime/blob/c4341d45acca3ea662cd8d71e7d71094450dd045/src/coreclr/pal/src/misc/cgroup.cpp#L481-L483 Before this change, this panic could be seen in environments setup as described above: ``` $ RUST_BACKTRACE=1 cargo test Finished test [unoptimized + debuginfo] target(s) in 3.55s Running unittests src/main.rs (target/debug/deps/x-9a42e145aca2934d) thread 'main' panicked at 'attempt to divide by zero', library/std/src/sys/unix/thread.rs:546:70 stack backtrace: 0: rust_begin_unwind 1: core::panicking::panic_fmt 2: core::panicking::panic 3: std::sys::unix::thread::cgroups::quota 4: std::sys::unix::thread::available_parallelism 5: std::thread::available_parallelism 6: test::helpers::concurrency::get_concurrency 7: test::console::run_tests_console 8: test::test_main 9: test::test_main_static 10: x::main at ./src/main.rs:1:1 11: core::ops::function::FnOnce::call_once at /tmp/rust-1.64-1.64.0-1/library/core/src/ops/function.rs:248:5 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. error: test failed, to rerun pass '--bin local-rabmq-amqpprox' ``` I've tested this change in an environment which has the bad setup and rebuilding the test executable against a fixed std library fixes the panic. | ||||
| 2022-11-16 | Rollup merge of #104401 - RalfJung:mpsc-leak, r=Amanieu | Matthias Krüger | -2/+3 | |
| avoid memory leak in mpsc test r? ```@Amanieu``` | ||||
| 2022-11-15 | Rollup merge of #103734 - Mark-Simulacrum:fix-version-stabilized, r=JohnTitor | Matthias Krüger | -2/+2 | |
| Adjust stabilization version to 1.65.0 for wasi fds See https://github.com/rust-lang/rust/pull/103308#issuecomment-1292277645 for this ask. Backport of that PR to beta (1.65.0) will include a similar patch. | ||||
| 2022-11-15 | Auto merge of #104428 - matthiaskrgr:rollup-jo3078i, r=matthiaskrgr | bors | -2/+0 | |
| Rollup of 13 pull requests Successful merges: - #103842 (Adding Fuchsia compiler testing script, docs) - #104354 (Remove leading newlines from `NonZero*` doc examples) - #104372 (Update compiler-builtins) - #104380 (rustdoc: remove unused CSS `code { opacity: 1 }`) - #104381 (Remove dead NoneError diagnostic handling) - #104383 (Remove unused symbols and diagnostic items) - #104391 (Deriving cleanups) - #104403 (Specify language of code comment to generate document) - #104404 (Fix missing minification for static files) - #104413 ([llvm-wrapper] adapt for LLVM API change) - #104415 (rustdoc: fix corner case in search keyboard commands) - #104422 (Fix suggest associated call syntax) - #104426 (Add test for #102154) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup | ||||
| 2022-11-15 | Rollup merge of #104383 - WaffleLapkin:rustc_undiagnostic_item, ↵ | Matthias Krüger | -2/+0 | |
| r=compiler-errors Remove unused symbols and diagnostic items As the title suggests, this removes unused symbols from `sym::` and `#[rustc_diagnostic_item]` annotations that weren't mentioned anywhere. Originally I tried to use grep, to find symbols and item names that are never mentioned via `sym::name`, however this produced a lot of false positives (?), for example clippy matching on `Symbol::as_str` or macros "implicitly" adding `sym::`. I ended up fixing all these false positives (?) by hand, but tbh I'm not sure if it was worth it... | ||||
| 2022-11-14 | Rollup merge of #101967 - jmillikin:linux-abstract-socket-addr, r=joshtriplett | Matthias Krüger | -95/+140 | |
| Move `unix_socket_abstract` feature API to `SocketAddrExt`. The pre-stabilized API for abstract socket addresses exposes methods on `SocketAddr` that are only enabled for `cfg(any(target_os = "android", target_os = "linux"))`. Per discussion in <https://github.com/rust-lang/rust/issues/85410>, moving these methods to an OS-specific extension trait is required before stabilization can be considered. This PR makes four changes: 1. The internal module `std::os::net` contains logic for the unstable feature `tcp_quickack` (https://github.com/rust-lang/rust/issues/96256). I moved that code into `linux_ext/tcp.rs` and tried to adjust the module tree so it could accommodate a second unstable feature there. 2. Moves the public API out of `impl SocketAddr`, into `impl SocketAddrExt for SocketAddr` (the headline change). 3. The existing function names and docs for `unix_socket_abstract` refer to addresses as being created from abstract namespaces, but a more accurate description is that they create sockets in *the* abstract namespace. I adjusted the function signatures correspondingly and tried to update the docs to be clearer. 4. I also tweaked `from_abstract_name` so it takes an `AsRef<[u8]>` instead of `&[u8]`, allowing `b""` literals to be passed directly. Issues: 1. The public module `std::os::linux::net` is marked as part of `tcp_quickack`. I couldn't figure out how to mark a module as being part of two unstable features, so I just left the existing attributes in place. My hope is that this will be fixed as a side-effect of stabilizing either feature. | ||||
| 2022-11-14 | macos, aarch64, and not(miri) | Cameron | -2/+2 | |
| 2022-11-14 | std: move `ReentrantMutex` to `sync` | joboet | -4/+5 | |
| 2022-11-14 | avoid memory leak in mpsc test | Ralf Jung | -2/+3 | |
| 2022-11-14 | Auto merge of #104387 - Manishearth:rollup-9e551p5, r=Manishearth | bors | -1/+12 | |
| Rollup of 9 pull requests Successful merges: - #103709 (ci: Upgrade dist-x86_64-netbsd to NetBSD 9.0) - #103744 (Upgrade cc for working is_flag_supported on cross-compiles) - #104105 (llvm: dwo only emitted when object code emitted) - #104158 (Return .efi extension for EFI executable) - #104181 (Add a few known-bug tests) - #104266 (Regression test for coercion of mut-ref to dyn-star) - #104300 (Document `Path::parent` behavior around relative paths) - #104304 (Enable profiler in dist-s390x-linux) - #104362 (Add `delay_span_bug` to `AttrWrapper::take_for_recovery`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup | ||||
