Commit Graph

4654 Commits

Author SHA1 Message Date
Jubilee Young
079949da8e Update std to backtrace 0.3.68
Dedup addr2line, miniz_oxide, object in .lock
2023-07-02 17:02:45 -07:00
Nilstrieb
1e5d8fbcc9 downgrade compiler_builtins
The outline-atomics support in compiler_builtins messed up and wasn't limited to linux only.
https://github.com/rust-lang/compiler-builtins/pull/532/files#r1249354225
2023-07-02 21:02:31 +02:00
Matthias Krüger
c4ba0a6912
Rollup merge of #113202 - guilliamxavier:patch-1, r=workingjubilee
std docs: factorize literal in Barrier example

Motivated by https://www.reddit.com/r/rust/comments/rnh5hu/barrier_question_barrier_does_not_sync_many/ (but maybe not worth it?)
2023-07-02 10:27:20 +02:00
Guilliam Xavier
e34ff93c6b
std docs: factorize literal in Barrier example 2023-06-30 16:11:30 +02:00
Tshepang Mbambo
5b46aa1122
make HashMap::or_insert_with example more simple 2023-06-29 09:33:15 +02:00
bors
c51fbb3dd3 Auto merge of #113001 - ChrisDenton:win-arm32-shim, r=thomcc
Move windows-sys arm32 shim to c.rs

This moves the arm32 shim in to c.rs instead of appending to the generated file itself.

This makes it simpler to change these workarounds if/when needed. The downside is we need to exclude a couple of functions from being generated (see the comment). A metadata solution could help here but they'll be easy enough to add back if that happens.
2023-06-25 11:27:19 +00:00
Matthias Krüger
48247884c9
Rollup merge of #113009 - ChrisDenton:remove-path, r=workingjubilee
Remove unnecessary `path` attribute

Follow up to #111401. I missed this at the time but it should now be totally unnecessary since the other include was removed.

r? `@workingjubilee`
2023-06-25 02:04:21 +02:00
Matthias Krüger
2ed4368d2f
Rollup merge of #112956 - Amanieu:weak-intrinsics, r=Mark-Simulacrum
Expose `compiler-builtins-weak-intrinsics` feature for `-Zbuild-std`

This was added in rust-lang/compiler-builtins#526 to force all compiler-builtins intrinsics to use weak linkage.
2023-06-25 02:04:20 +02:00
Matthias Krüger
8630b1b3f4
Rollup merge of #112950 - tshepang:patch-4, r=Mark-Simulacrum
DirEntry::file_name: improve explanation
2023-06-25 02:04:20 +02:00
Chris Denton
e2eff0d4ab
Remove unnecessary path attribute 2023-06-24 19:56:29 +01:00
Chris Denton
8a7399cd45
Move arm32 shim to c.rs 2023-06-24 17:30:27 +01:00
Michael Goulet
ee8b035fab
Rollup merge of #112763 - Patryk27:bump-compiler-builtins, r=Amanieu
Bump compiler_builtins

Actually closes https://github.com/rust-lang/rust/issues/108489.

Note that the example code given [in compiler_builtins](https://github.com/rust-lang/compiler-builtins/pull/527) doesn't compile on current rustc since we're still waiting for https://reviews.llvm.org/D153197 (aka `LLVM ERROR: Expected a constant shift amount!`), but it's a step forward anyway.
2023-06-23 19:47:20 -07:00
Michael Goulet
4a01a38466
Rollup merge of #111087 - ibraheemdev:patch-15, r=dtolnay
Implement `Sync` for `mpsc::Sender`

`mpsc::Sender` is currently `!Sync` because the previous implementation contained an optimization where the channel started out as single-producer and was dynamically upgraded on the first clone, which relied on a unique reference to the sender. This optimization is one of the main reasons the old implementation was so complex and was removed in #93563. `mpsc::Sender` can now soundly implement `Sync`.

Note for any potential confusion, this chance does *not* add MPMC behavior. This only affects the already `Send + Clone` *sender*, not *receiver*.

It's technically possible to rely on the `!Sync` behavior in the same way as a `PhantomData<*mut T>`, but that seems very unlikely in practice. Either way, this change is insta-stable and needs an FCP.

`@rustbot` label +T-libs-api -T-libs
2023-06-23 19:47:19 -07:00
Amanieu d'Antras
4a9f292e50 Expose compiler-builtins-weak-intrinsics feature for -Zbuild-std
This was added in rust-lang/compiler-builtins#526 to force all
compiler-builtins intrinsics to use weak linkage.
2023-06-23 11:15:34 +01:00
Tshepang Mbambo
6f61f6ba11
DirEntry::file_name: improve explanation 2023-06-23 04:47:30 +02:00
Thom Chiovoloni
5ef4d1fb2e
Actually save all the files 2023-06-21 14:59:40 -07:00
Thom Chiovoloni
37854aab76
Update tvOS support elsewhere in the stdlib 2023-06-21 14:59:40 -07:00
Thom Chiovoloni
49da0acb71
Avoid fork/exec spawning on tvOS/watchOS, as those functions are marked as prohibited 2023-06-21 14:59:40 -07:00
Thom Chiovoloni
f978d7ea42
Finish up preliminary tvos support in libstd 2023-06-21 14:59:39 -07:00
Thom Chiovoloni
bdc3db944c
wip: Support Apple tvOS in libstd 2023-06-21 14:59:37 -07:00
Guillaume Gomez
38916c71cb
Rollup merge of #112863 - clubby789:stderr-typo, r=albertlarsan68
Fix copy-paste typo in `eprint(ln)` docs

Fixes #112862
2023-06-21 15:45:17 +02:00
Guillaume Gomez
476798d4fd
Rollup merge of #99587 - ibraheemdev:park-orderings, r=m-ou-se
Document memory orderings of `thread::{park, unpark}`

Document `thread::park/unpark` as having acquire/release synchronization. Without that guarantee, even the example in the documentation can deadlock:

```rust
let flag = Arc::new(AtomicBool::new(false));

let t2 = thread::spawn(move || {
    while !flag.load(Ordering::Acquire) {
        thread::park();
    }
});

flag.store(true, Ordering::Release);
t2.thread().unpark();

// t1: flag.store(true)
// t1: thread.unpark()
// t2: flag.load() == false

// t2 now parks, is immediately unblocked but never
// acquires the flag, and thus spins forever
```

Multiple calls to `unpark` should also maintain a release sequence to make sure operations released by previous `unpark`s are not lost:

```rust
let a = Arc::new(AtomicBool::new(false));
let b = Arc::new(AtomicBool::new(false));

let t2 = thread::spawn(move || {
    while !a.load(Ordering::Acquire) || !b.load(Ordering::Acquire) {
        thread::park();
    }
});

thread::spawn(move || {
    a.store(true, Ordering::Release);
    t2.thread().unpark();
});

b.store(true, Ordering::Release);
t2.thread().unpark();

// t1: a.store(true)
// t1: t2.unpark()
// t3: b.store(true)
// t3: t2.unpark()

// t2 now parks, is immediately unblocked but never
// acquires the store of `a`, only the store of `b` which
// was released by the most recent unpark, and thus spins forever
```

This is of course a contrived example, but is reasonable to rely upon in real code.

Note that all implementations of park/unpark already comply with the rules, it's just undocumented.
2023-06-21 15:45:15 +02:00
Mara Bos
3acb1d2b9b
"Memory Orderings" -> "Memory Ordering"
Co-authored-by: yvt <i@yvt.jp>
2023-06-21 12:43:22 +02:00
clubby789
7201271fe8 Fix typo in eprintln docs 2023-06-21 01:08:10 +01:00
Ibraheem Ahmed
bf27f12d94 relaxed orderings in thread::park example 2023-06-20 20:05:31 -04:00
Guillaume Gomez
816b659157
Rollup merge of #112464 - eval-exec:exec/fix-connect_timeout-overflow, r=ChrisDenton
Fix windows `Socket::connect_timeout` overflow

This PR want to close #112405

- [x] add unit test
2023-06-20 14:23:39 +02:00
Eval EXEC
a0c757a13f
Remove useless unit tests 2023-06-20 18:47:31 +08:00
Eval EXEC
30e1c1a53c
Ignore connect_timeout unit test on SGX platform
Co-authored-by: Chris Denton <christophersdenton@gmail.com>
2023-06-20 18:43:12 +08:00
Michael Goulet
e24fe97bd9
Rollup merge of #112606 - clarfonthey:ip-display, r=thomcc
Alter `Display` for `Ipv6Addr` for IPv4-compatible addresses

ACP: rust-lang/libs-team#239
2023-06-19 17:53:35 -07:00
Patryk Wychowaniec
70ce2139e8
Bump compiler_builtins 2023-06-18 13:29:36 +02:00
Eval EXEC
f65b5d0ddf
Add unit test to connect to an unreachable address
Signed-off-by: Eval EXEC <execvy@gmail.com>
2023-06-18 15:59:25 +08:00
Matthias Krüger
eb40590579
Rollup merge of #112685 - cuviper:wasm-dlmalloc, r=Mark-Simulacrum
std: only depend on dlmalloc for wasm*-unknown

It was already filtered out for emscripten, but wasi doesn't need dlmalloc
either since it reuses `unix/alloc.rs`.
2023-06-18 08:06:42 +02:00
Matthias Krüger
876f00a655
Rollup merge of #107200 - mina86:c, r=Amanieu
io: soften ‘at most one write attempt’ requirement in io::Write::write

At the moment, documentation of std::io::Write::write indicates that
call to it ‘represents at most one attempt to write to any wrapped
object’.  It seems that such wording was put there to contrast it with
pre-1.0 interface which attempted to write all the data (it has since
been changed in [RFC 517]).

However, the requirement puts unnecessary constraints and may
complicate adaptors which perform non-trivial transformations on the
data.  For example, they may maintain an internal buffer which needs
to be written out before the write method accepts more data.  It might
be natural to code the method such that it flushes the buffer and then
grabs another chunk of user data.  With the current wording in the
documentation, the adaptor would be forced to return Ok(0).

This commit softens the wording such that implementations can choose
code structure which makes most sense for their particular use case.

While at it, elaborate on the meaning of `Ok(0)` return pointing out
that the write_all methods interprets it as an error.

[RFC 517]: https://rust-lang.github.io/rfcs/0517-io-os-reform.html
2023-06-18 08:06:41 +02:00
bors
ed7281e784 Auto merge of #112595 - hargoniX:l4re_fix, r=Mark-Simulacrum
fix: get the l4re target working again

This is based on work from https://github.com/rust-lang/rust/pull/103966, addressing the review comment by `@m-ou-se` at the time and "fixing" the (probably newly) missing read_buf.
2023-06-17 21:59:08 +00:00
Eval EXEC
fca9e6e706
Add unit test for TcpStream::connect_timeout
Signed-off-by: Eval EXEC <execvy@gmail.com>
2023-06-18 01:56:11 +08:00
Eval EXEC
22f62df337
Fix windows Socket::connect_timeout overflow
Signed-off-by: Eval EXEC <execvy@gmail.com>
2023-06-18 01:56:11 +08:00
bors
e1c29d137d Auto merge of #112739 - matthiaskrgr:rollup-8cfggml, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #112352 (Fix documentation build on FreeBSD)
 - #112644 (Correct types in method descriptions of `NonZero*` types)
 - #112683 (fix ICE on specific malformed asm clobber_abi)
 - #112707 ([rustdoc] Fix invalid handling of "going back in history" when "go to only search result" setting is enabled)
 - #112719 (Replace fvdl with ffx, allow test without install)
 - #112728 (Add `<meta charset="utf-8">` to `-Zdump-mir-spanview` output)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-17 13:19:29 +00:00
Matthias Krüger
d2120b7d42
Rollup merge of #112352 - dankm:fbsd_doc_fix, r=thomcc
Fix documentation build on FreeBSD

After the socket ancillary data implementation was introduced, the documentation build was broken on FreeBSD hosts, add the same workaround as for the existing implementations.

Fixes the doc build after #91793
2023-06-17 12:43:29 +02:00
The 8472
3738785735 Extend io::copy buffer reuse to BufReader too
previously it was only able to use BufWriter. This was due to a limitation in the
BufReader generics that prevented specialization. This change works around the issue
by using `where Self: Read` instead of `where I: Read`. This limits our options, e.g.
we can't access BufRead methods, but it happens to work out if we rely on some
implementation details.
2023-06-17 11:07:04 +02:00
Michael Goulet
4d5e7cdc03
Rollup merge of #112226 - devnexen:netbsd_affinity, r=cuviper
std: available_parallelism using native netbsd api first

before falling back to existing code paths like FreeBSD does.
2023-06-16 12:53:21 -07:00
Michael Goulet
c55af41e7a
Rollup merge of #111074 - WaffleLapkin:🌟unsizes_your_buf_reader🌟, r=Amanieu
Relax implicit `T: Sized` bounds on `BufReader<T>`, `BufWriter<T>` and `LineWriter<T>`

TL;DR:
```diff,rust
-pub struct BufReader<R> { /* ... */ }
+pub struct BufReader<R: ?Sized> { /* ... */ }

-pub struct BufWriter<W: Write> { /* ... */ }
+pub struct BufWriter<W: ?Sized + Write> { /* ... */ }

-pub struct LineWriter<W: Write> { /* ... */ }
+pub struct LineWriter<W: ?Sized + Write> { /* ... */ }
```

This allows using `&mut BufReader<dyn Read>`, for example.

**This is an insta-stable change**.
2023-06-16 12:53:21 -07:00
Dylan DPC
48b645e0ea
Rollup merge of #112579 - MikaelUrankar:freebsd_docs, r=cuviper
Fix building libstd documentation on FreeBSD.

It fixes the following error:
```
error[E0412]: cannot find type `sockcred2` in module `libc`
   --> library/std/src/os/unix/net/ancillary.rs:211:29
    |
211 | pub struct SocketCred(libc::sockcred2);
    |                             ^^^^^^^^^ not found in `libc`
```
2023-06-16 14:46:16 +05:30
Dylan DPC
627f85cd5a
Rollup merge of #112535 - RalfJung:miri-test-libstd, r=cuviper
reorder attributes to make miri-test-libstd work again

Fixes fallout from https://github.com/rust-lang/rust/pull/110141
2023-06-16 14:46:15 +05:30
Josh Stone
886085a4d5 std: only depend on dlmalloc for wasm*-unknown
It was already filtered out for emscripten, but wasi doesn't need dlmalloc
either since it reuses `unix/alloc.rs`.
2023-06-15 15:56:00 -07:00
许杰友 Jieyou Xu (Joe)
72b3b58efc
Extend unused_must_use to cover block exprs 2023-06-15 17:59:13 +08:00
bors
6ee4265ca6 Auto merge of #104455 - the8472:dont-drain-on-drop, r=Amanieu
Don't drain-on-drop in DrainFilter impls of various collections.

This removes drain-on-drop behavior from various unstable DrainFilter impls (not yet for HashSet/Map) because that behavior [is problematic](https://github.com/rust-lang/rust/issues/43244#issuecomment-641638196) (because it can lead to panic-in-drop when user closures panic) and may become forbidden if [this draft RFC passes](https://github.com/rust-lang/rfcs/pull/3288).

closes #101122

[ACP](https://github.com/rust-lang/libs-team/issues/136)

affected tracking issues
* #43244
* #70530
* #59618

Related hashbrown update: https://github.com/rust-lang/hashbrown/pull/374
2023-06-15 00:03:10 +00:00
ltdk
2dce58d0f6 Fix SocketAddrV6: Display tests 2023-06-14 15:21:15 -04:00
bors
0b475c705f Auto merge of #112624 - matthiaskrgr:rollup-db6ta1b, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #98202 (Implement `TryFrom<&OsStr>` for `&str`)
 - #107619 (Specify behavior of HashSet::insert)
 - #109814 (Stabilize String::leak)
 - #111974 (Update runtime guarantee for `select_nth_unstable`)
 - #112109 (Don't print unsupported split-debuginfo modes with `-Zunstable-options`)
 - #112506 (Properly check associated consts for infer placeholders)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-14 17:25:04 +00:00
Matthias Krüger
d54bb505d0
Rollup merge of #107619 - stepancheg:hash-set-insert, r=Amanieu
Specify behavior of HashSet::insert

`HashSet::insert` does not replace the value with equal value.

Fixes #107581.
2023-06-14 18:10:28 +02:00
Matthias Krüger
4efdb5c001
Rollup merge of #98202 - aticu:impl_tryfrom_osstr_for_str, r=Amanieu
Implement `TryFrom<&OsStr>` for `&str`

Recently when trying to work with `&OsStr` I was surprised to find this `impl` missing.

Since the `to_str` method already existed the actual implementation is fairly non-controversial, except for maybe the choice of the error type. I chose an opaque error here instead of something like `std::str::Utf8Error`, since that would already make a number of assumption about the underlying implementation of `OsStr`.

As this is a trait implementation, it is insta-stable, if I'm not mistaken?
Either way this will need an FCP.
I chose "1.64.0" as the version, since this is unlikely to land before the beta cut-off.

`@rustbot` modify labels: +T-libs-api

API Change Proposal: rust-lang/rust#99031 (accepted)
2023-06-14 18:10:27 +02:00