Commit Graph

6163 Commits

Author SHA1 Message Date
B I Mohammed Abbas
0ea5694c7c Add chroot unsupported implementation for VxWorks 2024-07-24 09:59:04 +05:30
B I Mohammed Abbas
786ad3d3ae Update process vxworks, set default stack size of 256 Kib for vxworks. User can set the stack size using RUST_MIN_STACK, with min size of libc::PTHREAD_STACK_MIN(4kib) 2024-07-23 16:58:00 +05:30
B I Mohammed Abbas
5c9f3762d0 Cfg disable on_broken_pipe_flag_used() for vxworks 2024-07-23 10:55:54 +05:30
B I Mohammed Abbas
a598ca0f86 Disable dirfd for vxworks, Return unsupported error from set_times and lchown for vxworks 2024-07-23 10:52:53 +05:30
B I Mohammed Abbas
2561d91983 Allow unused unsafe for vxworks in read_at and write at 2024-07-23 10:47:01 +05:30
B I Mohammed Abbas
6519c143a7 Reset sigpipe not supported for vxworks 2024-07-08 10:56:13 +05:30
Matthias Krüger
b564c510c1
Rollup merge of #127447 - RalfJung:once_lock_miri, r=joboet
once_lock: make test not take as long in Miri

Allocating 1000 list elements takes a while (`@zachs18` reported >5min), so let's reduce the iteration count when running in Miri. Unfortunately due to this clever `while let i @ 0..LEN =` thing, the count needs to be a constants, and constants cannot be shadowed, so we need to use another trick to hide the `cfg!(miri)` from the docs. (I think this loop condition may be a bit too clever, it took me a bit to decipher. Ideally this would be `while let i = ... && i < LEN`, but that is not stable yet.)
2024-07-07 14:22:03 +02:00
Matthias Krüger
56557c4555
Rollup merge of #127297 - the8472:path-new-hash, r=Nilstrieb
Improve std::Path's Hash quality by avoiding prefix collisions

This adds a bit rotation to the already existing state so that the same sequence of characters chunked at different offsets into separate path components results in different hashes.

The tests are from #127255

Closes #127254
2024-07-07 14:22:00 +02:00
Ralf Jung
bee9120458 once_lock: make test not take as long in Miri 2024-07-07 09:19:32 +02:00
Michael Goulet
f20307851e
Rollup merge of #123600 - tisonkun:path_with_extension, r=dtolnay
impl PathBuf::add_extension and Path::with_added_extension

See the ACP for motivation and discussions - https://github.com/rust-lang/libs-team/issues/368
2024-07-05 20:49:31 -04:00
tison
3aa2abdd3d
add unit tests for extra extension feature
Signed-off-by: tison <wander4096@gmail.com>
2024-07-05 10:44:15 -07:00
tison
a0f4114ba9
update comments
Signed-off-by: tison <wander4096@gmail.com>
2024-07-05 10:29:35 -07:00
Guillaume Gomez
80a9717091
Rollup merge of #127320 - ChrisDenton:win-sys, r=Mark-Simulacrum
Update windows-bindgen to 0.58.0

This also switches from the bespoke `std` generated bindings to the normal `sys` ones everyone else uses.

This has almost no difference except that the  `sys` bindings use the `windows_targets::links!` macro for FFI imports, which we implement manually. This does cause the diff to look much larger than it really is but the bulk of the changes are mostly contained to the generated code.
2024-07-05 11:33:16 +02:00
Chris Denton
14f4ed2ba3
Add comments to windows_targets.rs 2024-07-04 13:27:24 +00:00
Chris Denton
34860a56f0
Update windows-bindgen to 0.58.0 2024-07-04 12:18:38 +00:00
Jacob Pratt
5712539a62
Rollup merge of #127195 - biabbas:vxworks_cleanup, r=jhpratt
Remove unqualified form import of io::Error in process_vxworks.rs and fallback on remove_dir_impl for vxworks

Hi all,
This is to address issue #127084. On inspections it was found that io::Error refrences were all of qualified form and there was no need to add a unqualified form import. Also to successfully build rust for vxworks, we need to fallback on the remove_impl_dir implementations.

Thank you.
2024-07-04 04:09:49 -04:00
Jacob Pratt
6cf34c0cfd
Rollup merge of #126792 - wooden-worm:master, r=Mark-Simulacrum
wasm64 build with target-feature=+simd128,+atomics

Fixes https://github.com/rust-lang/rust/issues/126778
2024-07-04 04:09:49 -04:00
tison
57e76d4596
impl PathBuf::add_extension and Path::with_added_extension
Signed-off-by: tison <wander4096@gmail.com>
2024-07-03 22:12:55 -07:00
The 8472
f21683432b stir the hash state a little to avoid prefix collisions 2024-07-04 01:03:25 +02:00
Zanie Blue
dd509c7a63 Add more test cases for path comparisons 2024-07-03 22:35:10 +02:00
Zanie Blue
a7372372f6 Add test case demonstrating equality of paths "foo/bar" and "foobar" 2024-07-03 22:35:10 +02:00
Jacob Pratt
db592253a6
Rollup merge of #123588 - tgross35:stabilize-assert_unchecked, r=dtolnay
Stabilize `hint::assert_unchecked`

Make the following API stable, including const:

```rust
// core::hint, std::hint

pub const unsafe fn assert_unchecked(p: bool);
```

This PR also reworks some of the documentation and adds an example.

Tracking issue: https://github.com/rust-lang/rust/issues/119131
FCP: https://github.com/rust-lang/rust/issues/119131#issuecomment-1906394087. The docs update should resolve the remaining concern.
2024-07-03 03:03:13 -04:00
B I Mohammed Abbas
a6c03ae6fe Fall back on remove dir implementation for vxworks 2024-07-03 11:46:24 +05:30
Matthias Krüger
a10c231118
Rollup merge of #127230 - hattizai:patch01, r=saethlin
chore: remove duplicate words

remove duplicate words in comments to improve readability.
2024-07-02 17:47:50 +02:00
hattizai
ada9fda7c3 chore: remove duplicate words 2024-07-02 11:25:31 +08:00
Guillaume Gomez
61db24d15d
Rollup merge of #126732 - StackOverflowExcept1on:master, r=m-ou-se
Stabilize `PanicInfo::message()` and `PanicMessage`

Resolves #66745

This stabilizes the [`PanicInfo::message()`](https://doc.rust-lang.org/nightly/core/panic/struct.PanicInfo.html#method.message) and [`PanicMessage`](https://doc.rust-lang.org/nightly/core/panic/struct.PanicMessage.html).

Demonstration of [custom panic handler](https://github.com/StackOverflowExcept1on/panicker):
```rust
#![no_std]
#![no_main]

extern crate libc;

#[no_mangle]
extern "C" fn main() -> libc::c_int {
    panic!("I just panic every time");
}

#[panic_handler]
fn my_panic(panic_info: &core::panic::PanicInfo) -> ! {
    use arrayvec::ArrayString;
    use core::fmt::Write;

    let message = panic_info.message();
    let location = panic_info.location().unwrap();

    let mut debug_msg = ArrayString::<1024>::new();
    let _ = write!(&mut debug_msg, "panicked with '{message}' at '{location}'");

    if debug_msg.try_push_str("\0").is_ok() {
        unsafe {
            libc::puts(debug_msg.as_ptr() as *const _);
        }
    }

    unsafe { libc::exit(libc::EXIT_FAILURE) }
}
```
```
$ cargo +stage1 run --release
panicked with 'I just panic every time' at 'src/main.rs:8:5'
```

- [x] FCP: https://github.com/rust-lang/rust/issues/66745#issuecomment-2198143725

r? libs-api
2024-07-01 20:29:55 +02:00
B I Mohammed Abbas
9732251e5f Remove unqualified import io:: Error for vxworks as all Error references are qualified in process_vxworks.rs 2024-07-01 11:13:30 +05:30
bors
b8d7dd8d69 Auto merge of #127026 - Urgau:cleanup-bootstrap-check-cfg, r=Kobzol
Cleanup bootstrap check-cfg

This PR cleanup many custom `check-cfg` in bootstrap that have been accumulated over the years.

As well as updating some outdated comments.
2024-06-30 22:27:29 +00:00
Matthias Krüger
1e39eb7d53
Rollup merge of #126953 - joboet:lazy_key, r=jhpratt
std: separate TLS key creation from TLS access

Currently, `std` performs an atomic load to get the OS key on every access to `StaticKey` even when the key is already known. This PR thus replaces `StaticKey` with the platform-specific `get` and `set` function and a new `LazyKey` type that acts as a `LazyLock<Key>`, allowing the reuse of the retreived key for multiple accesses.

Related to #110897.
2024-06-29 09:14:56 +02:00
joboet
65aea99daf
std: add safety comments 2024-06-28 10:44:26 +02:00
Urgau
f026e0bfc1 Cleanup bootstrap check-cfg 2024-06-27 11:30:03 +02:00
Jacob Pratt
8905be5ef3
Rollup merge of #126980 - Borgerr:fix-extendfromslice-check, r=workingjubilee
set self.is_known_utf8 to false in extend_from_slice

try-job: x86_64-msvc

closes #126977
Related to #126885, #126333, and [this conversation](<aa46a3368e (r143539097)>)
2024-06-27 02:06:20 -04:00
bors
4bdf8d2d58 Auto merge of #126608 - tgross35:f16-f128-library, r=Mark-Simulacrum
Add more constants, functions, and tests for `f16` and `f128`

This adds everything that was in some way blocked on const eval, since https://github.com/rust-lang/rust/pull/126429 landed. There is a lot of `cfg(bootstrap)` since that is a fairly recent change.

`f128` tests are disabled on everything except x86_64 and Linux aarch64, which are two platforms I know have "good" support for these types - meaning basic math symbols are available and LLVM doesn't hit selection crashes. `f16` tests are enabled on almost everything except for known LLVM crashes. Doctests are only enabled on x86_64.

Tracking issue: https://github.com/rust-lang/rust/issues/116909
2024-06-26 12:06:05 +00:00
Jubilee Young
5aac24909c std: test a variety of ways to extend a Wtf8Buf 2024-06-25 23:44:49 -07:00
ash
e5167fe7bd set self.is_known_utf8 to false in extend_from_slice 2024-06-25 23:58:43 -06:00
joboet
e8516f8b52
std: separate TLS key creation from TLS access
Currently, `std` performs an atomic load to get the OS key on every access to `StaticKey` even when the key is already known. This PR thus replaces `StaticKey` with the platform-specific `get` and `set` function and a new `LazyKey` type that acts as a `LazyLock<Key>`, allowing the reuse of the retreived key for multiple accesses.
2024-06-25 18:30:49 +02:00
ash
aa46a3368e PathBuf::as_mut_vec removed and verified for UEFI and Windows platforms #126333 2024-06-25 07:36:34 -06:00
ash
7e187e8e4b remove references to PathBuf::as_mut_vec in PathBuf::_set_extension 2024-06-25 07:36:34 -06:00
ash
b08cd69684 inner truncate methods for UEFI platforms 2024-06-25 07:36:34 -06:00
ash
2155c6c477 #126333 remove PathBuf::as_mut_vec reference at top of PathBuf::_push 2024-06-25 07:36:34 -06:00
Trevor Gross
e181297c8c Add tests for f16 and f128
This suite tests all library functions that are now available for the
types. Tests are only run on certain platforms where `f16` and `f128`
are known to work (have symbols available and don't crash LLVM).
2024-06-25 01:32:36 -04:00
Trevor Gross
6e2d934a88 Add more f16 and f128 library functions and constants
This adds everything that was directly or transitively blocked on const
arithmetic for these types, which was recently merged.

Since const arithmetic is recent, most of these need to be gated by
`bootstrap`.

Anything that relies on intrinsics that are still missing is excluded.
2024-06-25 01:32:36 -04:00
Trevor Gross
99ed3d3e99 Add build.rs config for reliable f16 and f128
There are some complexities about what platforms we can test f16 and
f128 on.  Put this in build.rs so we have an easy way to configure tests
with a single attribute, and keep it up to date.
2024-06-25 01:32:36 -04:00
Michael Goulet
c77dc28f87
Rollup merge of #125082 - kpreid:const-uninit, r=dtolnay
Remove `MaybeUninit::uninit_array()` and replace it with inline const blocks.

\[This PR originally contained the changes in #125995 too. See edit history for the original PR description.]

The documentation of `MaybeUninit::uninit_array()` says:

> Note: in a future Rust version this method may become unnecessary when Rust allows [inline const expressions](https://github.com/rust-lang/rust/issues/76001). The example below could then use `let mut buf = [const { MaybeUninit::<u8>::uninit() }; 32];`.

The PR adding it also said: <https://github.com/rust-lang/rust/pull/65580#issuecomment-544200681>

> if it’s stabilized soon enough maybe it’s not worth having a standard library method that will be replaceable with `let buffer = [MaybeUninit::<T>::uninit(); $N];`

That time has come to pass — inline const expressions are stable — so `MaybeUninit::uninit_array()` is now unnecessary. The only remaining question is whether it is an important enough *convenience* to keep it around.

I believe it is net good to remove this function, on the principle that it is better to compose two orthogonal features (`MaybeUninit` and array construction) than to have a specific function for the specific combination, now that that is possible.
2024-06-24 15:51:01 -04:00
Kevin Reid
13fca73f49 Replace MaybeUninit::uninit_array() with array repeat expression.
This is possible now that inline const blocks are stable; the idea was
even mentioned as an alternative when `uninit_array()` was added:
<https://github.com/rust-lang/rust/pull/65580#issuecomment-544200681>

> if it’s stabilized soon enough maybe it’s not worth having a
> standard library method that will be replaceable with
> `let buffer = [MaybeUninit::<T>::uninit(); $N];`

Const array repetition and inline const blocks are now stable (in the
next release), so that circumstance has come to pass, and we no longer
have reason to want `uninit_array()` other than convenience. Therefore,
let’s evaluate the inconvenience by not using `uninit_array()` in
the standard library, before potentially deleting it entirely.
2024-06-24 10:23:50 -07:00
bors
5a3e2a4e92 Auto merge of #126523 - joboet:the_great_big_tls_refactor, r=Mark-Simulacrum
std: refactor the TLS implementation

As discovered by Mara in #110897, our TLS implementation is a total mess. In the past months, I have simplified the actual macros and their expansions, but the majority of the complexity comes from the platform-specific support code needed to create keys and register destructors. In keeping with #117276, I have therefore moved all of the `thread_local_key`/`thread_local_dtor` modules to the `thread_local` module in `sys` and merged them into a new structure, so that future porters of `std` can simply mix-and-match the existing code instead of having to copy the same (bad) implementation everywhere. The new structure should become obvious when looking at `sys/thread_local/mod.rs`.

Unfortunately, the documentation changes associated with the refactoring have made this PR rather large. That said, this contains no functional changes except for two small ones:
* the key-based destructor fallback now, by virtue of sharing the implementation used by macOS and others, stores its list in a `#[thread_local]` static instead of in the key, eliminating one indirection layer and drastically simplifying its code.
* I've switched over ZKVM (tier 3) to use the same implementation as WebAssembly, as the implementation was just a way worse version of that

Please let me know if I can make this easier to review! I know these large PRs aren't optimal, but I couldn't think of any good intermediate steps.

`@rustbot` label +A-thread-locals
2024-06-24 15:55:28 +00:00
joboet
50a02ed789
std: fix wasm builds 2024-06-24 16:37:09 +02:00
wooden-worm
82c5cdc6b1 wasm64 build with target-feature=+simd128,+atomics 2024-06-23 22:58:30 -07:00
Trevor Gross
fce07a82c6 Extract repeated constants from f32 and f64 source
This will make it easier to keep `f16` and `f128` consistent as their
implementations get added.
2024-06-24 00:42:21 -05:00
Matthias Krüger
9892b3e9fe
Rollup merge of #126854 - devnexen:std_unix_os_fallback_upd, r=Mark-Simulacrum
std::unix::os::home_dir: fallback's optimisation.

we're using a guaranteed initialised field on success.
2024-06-24 06:27:16 +02:00