Commit Graph

9118 Commits

Author SHA1 Message Date
Deadbeef
08ac185e99 append_const_msg for std traits 2022-09-16 11:48:43 +08:00
Deadbeef
a77f4bc6d3 Mark Drop with #[const_trait] 2022-09-16 11:48:43 +08:00
Deadbeef
5a6273e263 Do not implement Unpin as const 2022-09-16 11:48:42 +08:00
Deadbeef
bc6483d11e Prevent errors for stage0 rustc build 2022-09-16 11:48:42 +08:00
Deadbeef
4b539b04a6 Add more const_trait annotations 2022-09-16 11:48:42 +08:00
Deadbeef
be65e03676 Add const_traits 2022-09-16 11:48:42 +08:00
Deadbeef
81b1810cd7 Require #[const_trait] for const impls 2022-09-16 11:48:42 +08:00
Dylan DPC
cfef659d13
Rollup merge of #101802 - chriss0612:const_fn_trait_ref_impls, r=fee1-dead
Constify impl Fn* &(mut) Fn*

Tracking Issue: [101803](https://github.com/rust-lang/rust/issues/101803)

Feature gate: `#![feature(const_fn_trait_ref_impls)]`

This feature allows using references to Fn* Items as Fn* Items themself in a const context.
2022-09-16 11:17:02 +05:30
Matthias Krüger
b71b640f3c
Rollup merge of #101810 - raldone01:feat/const_partial_eq_ordering, r=fee1-dead
Constify `PartialEq` for `Ordering`

Adds `impl const PartialEq for Ordering {}` to #92391.
2022-09-15 08:00:16 +02:00
Matthias Krüger
93ae223951
Rollup merge of #101559 - andrewpollack:add-backtrace-off-fuchsia, r=tmandry
Adding "backtrace off" option for fuchsia targets

Used for improving compiler test suite results on Fuchsia targets
2022-09-15 08:00:12 +02:00
Andrew Pollack
88baf8f6f5 Adding backtrace off option for fuchsia targets 2022-09-14 23:54:40 +00:00
raldone01
f4ff6860dc Constify PartialEq for Ordering. 2022-09-14 18:31:53 +02:00
onestacked
478c471ce8 Added Tracking Issue number. 2022-09-14 15:10:02 +02:00
onestacked
404b60bf6b Constify impl Fn* &(mut) Fn* 2022-09-14 14:19:11 +02:00
Matthias Krüger
e44073b5db
Rollup merge of #101754 - NaokiM03:rename-log-to-ilog, r=Dylan-DPC
Fix doc of log function

Hi.

I found a forgotten documentation correction in the following pull request.
https://github.com/rust-lang/rust/pull/100332

See also:
https://github.com/rust-lang/rust/issues/70887
2022-09-13 22:25:36 +02:00
Dylan DPC
95c9a7e7c8
Rollup merge of #101745 - jay3332:patch-1, r=JohnTitor
Fix typo in concat_bytes documentation

This fixes the typo `&[u8, _]` -> `&[u8; _]`
2022-09-13 16:51:32 +05:30
NaokiM03
a4f8d3e36d Fix doc of log function 2022-09-13 19:21:40 +09:00
bors
c81575657c Auto merge of #100640 - reitermarkus:socket-display-buffer, r=thomcc
Use `DisplayBuffer` for socket addresses.

Continuation of https://github.com/rust-lang/rust/pull/100625 for socket addresses.

Renames `net::addr` to `net::addr::socket`, `net::ip` to `net::addr::ip` and `net::ip::display_buffer::IpDisplayBuffer` to `net::addr::display_buffer::DisplayBuffer`.
2022-09-13 06:41:37 +00:00
Jay3332
ba3b3bcc17
Fix typo in concat_bytes documentation
This fixes the typo `&[u8, _]` -> `&[u8; _]`
2022-09-12 21:40:28 -04:00
Guillaume Gomez
7fc3183520
Rollup merge of #100291 - WaffleLapkin:cstr_const_methods, r=oli-obk
constify some `CStr` methods

This PR marks the following public APIs as `const`:
```rust
impl CStr {
    // feature(const_cstr_from_bytes)
    pub const fn from_bytes_until_nul(bytes: &[u8]) -> Result<&CStr, FromBytesUntilNulError>;
    pub const fn from_bytes_with_nul(bytes: &[u8]) -> Result<&Self, FromBytesWithNulError>;

    // feature(const_cstr_to_bytes)
    pub const fn to_bytes(&self) -> &[u8];
    pub const fn to_bytes_with_nul(&self) -> &[u8];
    pub const fn to_str(&self) -> Result<&str, str::Utf8Error>;
}
```

r? ```@oli-obk``` (use of `const_eval_select` :P )
cc ```@mina86``` (you've asked for this <3 )
2022-09-12 22:47:14 +02:00
Markus Reiter
14230a7f8e
Simplify clippy fix. 2022-09-12 19:46:51 +02:00
Markus Reiter
d01498a902
Add rustc_diagnostic_item for IP addresses. 2022-09-12 19:04:17 +02:00
Markus Reiter
f7e8ba28a4
Flatten net module again. 2022-09-12 19:04:17 +02:00
Markus Reiter
a1e4a339ed
Move net::parser into net::addr module. 2022-09-12 19:04:17 +02:00
Markus Reiter
65003fd4e3
Add tests for SockAddr Display. 2022-09-12 19:04:16 +02:00
Markus Reiter
96b44f6f65
Use DisplayBuffer for socket addresses. 2022-09-12 19:04:16 +02:00
Maybe Waffle
cb02b647dc constify CStr methods 2022-09-12 16:29:12 +04:00
Dylan DPC
10af4fb530
Rollup merge of #101671 - LingMan:ieee_754, r=Dylan-DPC
Fix naming format of IEEE 754 standard

Currently the documentation of f64::min refers to "IEEE-754 2008" while the documentation of f64::minimum refers to "IEEE 754-2019".
Note that one has the format IEEE,hyphen,number,space,year while the other is IEEE,space,number,hyphen,year. The official IEEE site [1] uses the later format and it is also the one most commonly used throughout the codebase.

Update all comments and - more importantly - documentation to consistently use the official format.

[1] https://standards.ieee.org/ieee/754/4211/
2022-09-12 15:21:32 +05:30
Dylan DPC
93177758fc
Rollup merge of #100767 - kadiwa4:escape_ascii, r=jackh726
Remove manual <[u8]>::escape_ascii

`@rustbot` label: +C-cleanup
2022-09-12 15:21:30 +05:30
bors
3194958217 Auto merge of #100251 - compiler-errors:tuple-trait-2, r=jackh726
Implement `std::marker::Tuple`

Split out from #99943 (https://github.com/rust-lang/rust/pull/99943#pullrequestreview-1064459183).

Implements part of rust-lang/compiler-team#537
r? `@jackh726`
2022-09-12 03:24:29 +00:00
bors
98e1f041b6 Auto merge of #101442 - joboet:null_check_tcs, r=thomcc
Check if TCS is a null pointer on SGX

The `EENTER` instruction only checks if the TCS is aligned, not if it zero. Saying the address returned is a `NonNull<u8>` (for which `Tcs` is a type alias) is unsound. As well-behaved runners will not put the TCS at address zero, so the definition of `Tcs` is correct. However, `std` should check the address before casting it to a `NonNull`.

ping `@jethrogb` `@raoulstrackx`
`@rustbot` label I-unsound
2022-09-11 22:19:24 +00:00
bors
59e7a308e4 Auto merge of #101299 - saethlin:vecdeque-drain-drop, r=thomcc
Remove &[T] from vec_deque::Drain

Fixes https://github.com/rust-lang/rust/issues/60076

I don't know what the right approach is here. There were a few suggestions in the issue, and they all seem a bit thorny to implement. So I just picked one that was kind of familiar.
2022-09-11 19:50:41 +00:00
joboet
2fa58080cb
std: check if TCS is a null pointer 2022-09-11 12:15:32 +02:00
bors
56b625be68 Auto merge of #101482 - joboet:netbsd_parker, r=sanxiyn
Optimize thread parking on NetBSD

As the futex syscall is not present in the latest stable release, NetBSD cannot use the efficient thread parker and locks Linux uses. Currently, it therefore relies on a pthread-based parker, consisting of a mutex and semaphore which protect a state variable. NetBSD however has more efficient syscalls available: [`_lwp_park`](https://man.netbsd.org/_lwp_park.2) and [`_lwp_unpark`](https://man.netbsd.org/_lwp_unpark.2). These already provide the exact semantics of `thread::park` and `Thread::unpark`, but work with thread ids. In `std`, this ID is here stored in an atomic state variable, which is also used to optimize cases were the parking token is already available at the time `thread::park` is called.

r? `@m-ou-se`
2022-09-11 04:07:17 +00:00
LingMan
fd21df7182 Fix naming format of IEEE 754 standard
Currently the documentation of f64::min refers to "IEEE-754 2008" while the documentation of
f64::minimum refers to "IEEE 754-2019".
Note that one has the format IEEE,hyphen,number,space,year while the other is
IEEE,space,number,hyphen,year. The official IEEE site [1] uses the later format and it is also the
one most commonly used throughout the codebase.

Update all comments and - more importantly - documentation to consistently use the official format.

[1] https://standards.ieee.org/ieee/754/4211/
2022-09-11 04:13:33 +02:00
bors
abd4d2ef0d Auto merge of #101643 - ChrisDenton:alloc-link-kernel32, r=thomcc
Explicitly link kernel32.lib from alloc
2022-09-11 01:44:09 +00:00
Ben Kimock
54684c438f Alternate approach; just modify Drain 2022-09-10 17:52:34 -04:00
Ben Kimock
25f4cb59d3 Remove &[T] from vec_deque::Drain 2022-09-10 17:52:34 -04:00
joboet
81b11ed698
std: optimize thread parking on NetBSD 2022-09-10 20:03:15 +02:00
Dylan DPC
33d54c4f73
Rollup merge of #101606 - akhi3030:patch-1, r=Dylan-DPC
doc: fix minor typo
2022-09-10 18:56:07 +05:30
Chris Denton
931e851144
Explicitly link kernel32.lib from alloc 2022-09-10 11:57:36 +01:00
bors
5197c96c49 Auto merge of #101483 - oli-obk:guaranteed_opt, r=fee1-dead
The `<*const T>::guaranteed_*` methods now return an option for the unknown case

cc https://github.com/rust-lang/rust/issues/53020#issuecomment-1236932443

I chose `0` for "not equal" and `1` for "equal" and left `2` for the unknown case so backends can just forward to raw pointer equality and it works 

r? `@fee1-dead` or `@lcnr`

cc `@rust-lang/wg-const-eval`
2022-09-10 09:50:21 +00:00
bors
395e56f398 Auto merge of #101617 - Dylan-DPC:rollup-iiy4ipc, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #101366 (Restore old behaviour on broken UNC paths)
 - #101492 (Suggest adding array lengths to references to arrays if possible)
 - #101529 (Fix the example code and doctest for Formatter::sign_plus)
 - #101573 (update `ParamKindOrd`)
 - #101612 (Fix code generation of `Rvalue::Repeat` with 128 bit values)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-09 23:06:40 +00:00
Dylan DPC
fcdd5016c5
Rollup merge of #101529 - mousetail:patch-2, r=thomcc
Fix the example code and doctest for Formatter::sign_plus

The provided example to the `sign_plus` method on `fmt` was broken, it displays the `-` sign twice for negative numbers.

This pull request should fix the issue by `.abs()` ing the number so that the negative sign appears only once. It is just one possible solution to the issue, not sure if it's the best. However, this one will behave as expected when combined with fill and alignment operators.
2022-09-09 22:02:17 +05:30
Dylan DPC
d9609c7c26
Rollup merge of #101366 - ChrisDenton:unc-forward-slash, r=m-ou-se
Restore old behaviour on broken UNC paths

This fixes #101358 by restoring the behaviour from previous stable Rust versions. I'm not convinced this is ultimately right but I think it's less wrong and maybe this should be backported to beta?

r? libs
2022-09-09 22:02:16 +05:30
Oli Scherer
f632dbe46f The <*const T>::guaranteed_* methods now return an option for the unknown case 2022-09-09 15:16:04 +00:00
Guillaume Gomez
ff21ccfba1
Rollup merge of #101529 - mousetail:patch-2, r=thomcc
Fix the example code and doctest for Formatter::sign_plus

The provided example to the `sign_plus` method on `fmt` was broken, it displays the `-` sign twice for negative numbers.

This pull request should fix the issue by `.abs()` ing the number so that the negative sign appears only once. It is just one possible solution to the issue, not sure if it's the best. However, this one will behave as expected when combined with fill and alignment operators.
2022-09-09 15:36:37 +02:00
Guillaume Gomez
3ec332fc82
Rollup merge of #101495 - bjorn3:pause-no-sse2, r=Mark-Simulacrum
Compile spin_loop_hint as pause on x86 even without sse2 enabled

The x86 `pause` instruction was introduced with sse2, but because it is encoded as `rep nop`, it works just fine on cpu's without sse2 support. It just doesn't do anything.
2022-09-09 15:36:36 +02:00
joboet
262193e044
std: use futex-based locks and thread parker on Hermit 2022-09-09 11:56:50 +02:00
Akhilesh Singhania
1933b74dbd
doc: fix minor typo 2022-09-09 11:30:40 +02:00