Commit Graph

260600 Commits

Author SHA1 Message Date
Michael Goulet
841b30f63e Make sure trait def ids match before zipping args in note_function_argument_obligation 2024-07-15 17:53:22 -04:00
bors
eb72697e41 Auto merge of #127020 - tgross35:f16-f128-classify, r=workingjubilee
Add classify and related methods for f16 and f128

Also constify some functions where that was blocked on classify being available.

r? libs
2024-07-15 17:20:33 +00:00
bors
d3dd34a1d4 Auto merge of #127757 - workingjubilee:rollup-4dbks5r, r=workingjubilee
Rollup of 3 pull requests

Successful merges:

 - #127712 (Windows: Remove some unnecessary type aliases)
 - #127744 (std: `#![deny(unsafe_op_in_unsafe_fn)]` in platform-independent code)
 - #127750 (Make os/windows and pal/windows default to `#![deny(unsafe_op_in_unsafe_fn)]`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-15 10:57:49 +00:00
Jubilee
476d399782
Rollup merge of #127750 - ChrisDenton:safe-unsafe-unsafe, r=workingjubilee
Make os/windows and pal/windows default to `#![deny(unsafe_op_in_unsafe_fn)]`

This is to prevent regressions in modules that currently pass. I did also fix up a few trivial places where the module contained only one or two simple wrappers. In more complex cases we should try to ensure the `unsafe` blocks are appropriately scoped and have any appropriate safety comments.

This does not fix the windows bits of #127747 but it should help prevent regressions until that is done and also make it more obvious specifically which modules need attention.
2024-07-15 02:28:44 -07:00
Jubilee
99c5302d9f
Rollup merge of #127744 - workingjubilee:deny-unsafe-op-in-std, r=jhpratt
std: `#![deny(unsafe_op_in_unsafe_fn)]` in platform-independent code

This applies the `unsafe_op_in_unsafe_fn` lint in all places in std that _do not have platform-specific cfg in their code_. For all such places, the lint remains allowed, because they need further work to address the relevant concerns. This list includes:

- `std::backtrace_rs` (internal-only)
- `std::sys` (internal-only)
- `std::os`

Notably this eliminates all "unwrapped" unsafe operations in `std::io` and `std::sync`, which will make them much more auditable in the future. Such has *also* been left for future work. While I made a few safety comments along the way on interfaces I have grown sufficiently familiar with, in most cases I had no context, nor particular confidence the unsafety was correct.

In the cases where I was able to determine the unsafety was correct without having prior context, it was obviously redundant. For example, an unsafe function calling another unsafe function that has the exact same contract, forwarding its caller's requirements just as it forwards its actual call.
2024-07-15 02:28:44 -07:00
Jubilee
64495b5f94
Rollup merge of #127712 - ChrisDenton:raw-types, r=workingjubilee
Windows: Remove some unnecessary type aliases

Back in the olden days, C did not have fixed-width types so these type aliases were at least potentially useful. Nowadays, and especially in Rust, we don't need the aliases and they don't help with anything. Notably the windows bindings we use also don't bother with the aliases. And even when we have used aliases they're often only used once then forgotten about.

The only one that gives me pause is `DWORD` because it's used a fair bit. But it's still used inconsistently and we implicitly assume it's a `u32` anyway (e.g. `as` casting from an `i32`).
2024-07-15 02:28:43 -07:00
bors
adeb79d3f5 Auto merge of #127265 - harmou01:dev/harmou01/target-spec-metadata, r=Nilstrieb
Fill out target-spec metadata for all targets

**What does this PR try to resolve?**

This PR completes the target-spec metadata fields for all targets. This is required for a corresponding Cargo PR which adds a check for whether a target supports building the standard library when the `-Zbuild-std=std` flag is passed ([see this issue](https://github.com/rust-lang/wg-cargo-std-aware/issues/87). This functionality in Cargo is reliant on the output of `--print=target-spec-json`.

**How should we test and review this PR?**

Check that a given target-spec metadata has been updated with:
```
$ ./x.py build library/std
$ build/host/stage1/bin/rustc --print=target-spec-json --target <target_name> -Zunstable-options
```

**Additional Information**

A few things to note:
* Where a targets 'std' or 'host tools' support is listed as '?' in the rust docs, these are left as 'None' with this PR. The corresponding changes in cargo will only reject an attempt to build std if the 'std' field is 'Some(false)'. In the case it is 'None', cargo will continue trying to build
* There's no rush for this to be merged. I understand that the format for this is not finalised yet.
* Related: #120745
2024-07-15 08:37:39 +00:00
Trevor Gross
2393093bb5 Mark some f16 and f128 functions unstably const
These constifications were blocked on classification functions being
added. Now that those methods are available, constify them.

This brings things more in line with `f32` and `f64`.
2024-07-15 03:34:32 -05:00
Chris Denton
7e16d5fb61
Move safety comment outside unsafe block 2024-07-15 07:30:11 +00:00
Chris Denton
3411a025d5
Make os/windows default to deny unsafe in unsafe 2024-07-15 07:17:39 +00:00
Chris Denton
2402e84e78
Make pal/windows default to deny unsafe in unsafe 2024-07-15 07:00:40 +00:00
Chris Denton
816d90ae5f
Fix Windows 7 2024-07-15 06:14:53 +00:00
bors
0da95bd869 Auto merge of #127719 - devnexen:math_log_fix_solill, r=Amanieu
std: removes logarithms family function edge cases handling for solaris.

Issue had been fixed over time with solaris, 11.x behaves correctly
 (and we support it as minimum), illumos works correctly too.
2024-07-15 05:43:22 +00:00
Chris Denton
ffe8fc276e
Don't re-export c_int from c 2024-07-15 05:01:23 +00:00
Chris Denton
8a1ce3dfcc
Make normalization regex less exact 2024-07-15 05:01:22 +00:00
Chris Denton
e2b062c9b5
Remove DWORD 2024-07-15 05:01:22 +00:00
Chris Denton
d8d7c5c3b9
Remove ULONG 2024-07-15 05:01:22 +00:00
Chris Denton
21f69b5b82
Remove PSRWLOCK 2024-07-15 05:01:22 +00:00
Chris Denton
84dd7e4959
Remove LPVOID 2024-07-15 05:01:21 +00:00
Chris Denton
351f1f36f6
Remove LPSECURITY_ATTRIBUTES 2024-07-15 05:01:21 +00:00
Chris Denton
1b7cf3a3f2
Remove LPOVERLAPPED 2024-07-15 05:01:21 +00:00
Chris Denton
8052fb8f3c
Remove LPCVOID 2024-07-15 05:01:21 +00:00
Chris Denton
286c3270b4
Remove SIZE_T 2024-07-15 05:01:20 +00:00
Chris Denton
5b700a76cf
Remove CHAR
As with USHORT, keep using C types for BSD socket APIs.
2024-07-15 05:01:20 +00:00
Chris Denton
f2cc94361c
Remove USHORT
We stick to C types in for socket and address as these are at least nominally BSD-ish and they're used outside of pal/windows in general *nix code
2024-07-15 05:01:20 +00:00
Chris Denton
e70cc28831
Remove LPWSTR 2024-07-15 05:01:20 +00:00
Chris Denton
b107cfa73c
Remove UINT 2024-07-15 05:01:19 +00:00
Chris Denton
65da4af0be
Remove LONG 2024-07-15 05:01:19 +00:00
Chris Denton
91ba4ebcfd
Remove LARGE_INTEGER 2024-07-15 05:01:19 +00:00
Chris Denton
1d1cae1ba5
Remove NonZeroDWORD 2024-07-15 05:01:18 +00:00
bors
594702ebb5 Auto merge of #127732 - GrigorenkoPV:teeos-safe-sys-init, r=Amanieu
sys::init is not unsafe on teeos

88fa119c77/library/std/src/sys/pal/teeos/mod.rs (L40-L42)

r​? `@petrochenkov`
2024-07-15 03:19:47 +00:00
Jubilee Young
e32460276c std: Unsafe-wrap std::sync 2024-07-14 17:59:37 -07:00
Jubilee Young
64fb2366da std: Unsafe-wrap in Wtf8 impl 2024-07-14 17:44:13 -07:00
Jubilee Young
df353a0cc3 std: Unsafe-wrap std::io 2024-07-14 17:17:55 -07:00
Jubilee Young
83a0fe5396 std: Directly call unsafe {un,}setenv in env 2024-07-14 17:08:44 -07:00
Jubilee Young
ce35265105 std: Unsafe-wrap OSStr{,ing}::from_encoded_bytes_unchecked 2024-07-14 16:59:12 -07:00
Jubilee Young
87d850dff0 std: Unsafe-wrap HashMap::get_many_unchecked_mut 2024-07-14 16:49:16 -07:00
Jubilee Young
4572ed6389 std: deny(unsafe_op_in_unsafe_fn) but allow sites
This provides a list of locations to hunt down issues in.
2024-07-14 16:44:01 -07:00
bors
8b72d7a9d7 Auto merge of #127718 - cjgillot:find_field, r=compiler-errors
find_field does not need to be a query.

The current implementation is quadratic in the number of nested fields.

r? `@davidtwco` as you reviewed https://github.com/rust-lang/rust/pull/115367
Fixes https://github.com/rust-lang/rust/issues/121755
2024-07-14 23:35:45 +00:00
Trevor Gross
3a2c0aedf1 Add classify and related methods for f16 and f128 2024-07-14 18:44:43 -04:00
David Carlier
d939351c31
std: removes logarithms family function edge cases handling for solaris.
Issue had been fixed over time with solaris, 11.x behaves correctly
 (and we support it as minimum), illumos works correctly too.
2024-07-14 23:20:46 +01:00
bors
d9284afea9 Auto merge of #127726 - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`
2024-07-14 21:14:02 +00:00
bors
f8e4ac0760 Auto merge of #127728 - matthiaskrgr:rollup-ercdbjd, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #127273 (Fix `DebugParser`.)
 - #127587 (Report usage of lib features in ast validation)
 - #127592 (doc: Suggest `str::repeat` over `iter::repeat().take().collect()`)
 - #127630 (Remove lang feature for type ascription (since it's a lib feature now))
 - #127711 (Add regression test for a gce + effects ICE)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-14 18:50:26 +00:00
Pavel Grigorenko
bbf303ed14 sys::init is not unsafe on teeos 2024-07-14 21:43:20 +03:00
Matthias Krüger
f19cb0b294
Rollup merge of #127711 - BoxyUwU:add_effects_test, r=fee1-dead
Add regression test for a gce + effects ICE

Fixes #125770

I'm not *exactly* sure why this stopped ICEing, I assume its something to do with the fact that there used to be a generic parameter on `Add` for the host generic and we have mismatched args here, which #125608 made no longer later cause issues. But now the desugaring is also different so? 🤷‍♀️

r? `@fee1-dead`
2024-07-14 20:25:00 +02:00
Matthias Krüger
79000d2a8f
Rollup merge of #127630 - compiler-errors:type-ascription, r=chenyukang
Remove lang feature for type ascription (since it's a lib feature now)

It's not necessary since it's a library feature now, via the type ascription macro. We can't (and shouldn't) register it as a removed feature since I think that would give "this feature has been removed" errors even for people using the macro (well, I'm pretty sure, though I didn't check).

r? `@Nilstrieb`
2024-07-14 20:24:59 +02:00
Matthias Krüger
77d25b9f9c
Rollup merge of #127592 - tesuji:patch-1, r=Mark-Simulacrum
doc: Suggest `str::repeat` over `iter::repeat().take().collect()`

r? libs
2024-07-14 20:24:59 +02:00
Matthias Krüger
5d1f9e21cf
Rollup merge of #127587 - compiler-errors:all-features-at-once, r=Nilstrieb
Report usage of lib features in ast validation

No idea why it was split between ast validation for lang features and a later pass for lang features.

r? `@Nilstrieb`
2024-07-14 20:24:58 +02:00
Matthias Krüger
febe4423c1
Rollup merge of #127273 - nnethercote:fix-DebugParser, r=workingjubilee
Fix `DebugParser`.

I tried using this and it didn't work at all. `prev_token` is never eof, so the accumulator is always false, which means the `then_some` always returns `None`, which means `scan` always returns `None`, and `tokens` always ends up an empty vec. I'm not sure how this code was supposed to work.

(An aside: I find `Iterator::scan` to be a pretty wretched function, that produces code which is very hard to understand. Probably why this is just one of two uses of it in the entire compiler.)

This commit changes it to a simpler imperative style that produces a valid `tokens` vec.

r? `@workingjubilee`
2024-07-14 20:24:58 +02:00
bors
e90f04731a Auto merge of #3745 - joboet:os_unfair_lock, r=RalfJung
Implement the `os_unfair_lock` functions on macOS

These are needed for rust-lang/rust#122408. See the documentation [here](https://developer.apple.com/documentation/os/synchronization?language=objc) and the implementation [here](a00a4cc36d/src/os/lock.c (L645)).
2024-07-14 17:36:18 +00:00