Commit Graph

260880 Commits

Author SHA1 Message Date
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
Michael Goulet
f08c43afc7 Suppress some fallout from gen in synstructure 2024-07-14 14:22:11 -04:00
Michael Goulet
dc20733913 Stop using the gen keyword in the compiler 2024-07-14 14:01:01 -04: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
joboet
32221c3a10
implement the os_unfair_lock functions on macOS 2024-07-14 19:15:06 +02:00
bors
5f993496b5 Auto merge of #3750 - RalfJung:dangling-intermediate-ref, r=RalfJung
add test for intermediate reference in '&(*x).0 as *const i32'
2024-07-14 16:45:52 +00:00
Ralf Jung
9a23878ea7 add test for intermediate reference in '&(*x).0 as *const i32' 2024-07-14 18:43:15 +02:00
bors
09682988f2 Auto merge of #125935 - madsmtm:merge-os-apple, r=workingjubilee
Merge Apple `std::os` extensions modules into `std::os::darwin`

The functionality available on Apple platforms are very similar, and were (basically) duplicated for each platform.

This PR rectifies that by merging the code into one module.

Ultimately, I've done this to fix `./x build library --target=aarch64-apple-tvos,aarch64-apple-watchos,aarch64-apple-visionos`, as that currently fails because of dead code warnings.

Publically exposing these to tvOS/watchOS/visionOS targets is considered in https://github.com/rust-lang/rust/pull/123723, but that seems to be dragging out, and in any case I think it makes sense to do the refactor separately from stabilization.

r? libs

Fixes https://github.com/rust-lang/rust/issues/121640 and https://github.com/rust-lang/rust/issues/124825.
2024-07-14 16:28:07 +00:00
Adwin White
e595f3d13f Add cache for allocate_str 2024-07-14 22:11:46 +08:00
Mads Marquart
306d5788a6 Merge Apple std::os extensions modules into std::os::darwin
The functionality available on Apple platforms are very similar, and
were duplicated for each platform.

Additionally, this fixes a warning when compiling the standard library
for tvOS, watchOS and visionOS by marking the corresponding code as
dead code.
2024-07-14 15:31:54 +02:00
Camille GILLOT
b494d98b18 find_field does not need to be a query. 2024-07-14 13:25:25 +00:00
bors
88fa119c77 Auto merge of #127670 - compiler-errors:no-type-length-limit, r=jackh726
Gate the type length limit check behind a nightly flag

Effectively disables the type length limit by introducing a `-Zenforce-type-length-limit` which defaults to **`false`**, since making the length limit actually be enforced ended up having a worse fallout than expected. We still keep the code around, but the type length limit attr is now a noop (except for its usage in some diagnostics code?).

r? `@lcnr` -- up to you to decide what team consensus we need here since this reverses an FCP decision.

Reopens #125460 (if we decide to reopen it or keep it closed)
Effectively reverses the decision FCP'd in #125507
Closes #127346
2024-07-14 12:44:07 +00:00
bors
a241cf1c49 Auto merge of #127713 - matthiaskrgr:rollup-zxlyexf, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #127083 (Add release notes for 1.80)
 - #127322 (handle ci-rustc incompatible options during config parse)
 - #127697 (use std for file mtime and atime modifications)
 - #127704 (Fix minor typos in std::process doc on Win argv)
 - #127710 (clarify the meaning of the version number for accepted/removed features)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-14 10:22:01 +00:00
Jakub Beránek
8cffb475fd
Remove several usages of the as_command_mut method
Passes `&Builder<'_>` to additional places, so that they could use the `BootstrapCommand` APIs directly, rather than going through `as_command_mut`.
2024-07-14 10:44:56 +02:00
Jakub Beránek
e31709345c
Port all remaining simple command usages in bootstrap to BootstrapCommand 2024-07-14 10:44:56 +02:00
Matthias Krüger
82f13e7215
Rollup merge of #127710 - RalfJung:features, r=compiler-errors
clarify the meaning of the version number for accepted/removed features

For accepted features this is pretty clear, we even use the version number in the warning that says "feature has been stabilized, please remove feature gate".

For removed features we are inconsistent. [This PR](8cece636b2 (diff-a82bdbaaa3c79096a30755dce8896aaf2885128a7f3f3a290072b767f05b6095)) set the version to when it got removed, but [here](https://github.com/rust-lang/rust/pull/116958/files#diff-1ff08f89ad7e972538827e989fa63732c5918b4d0216ccd921de08698d6e18ca) they just got copied over so the version says when the feature was originally added. As far as I can tell, this version number is not actually used anywhere in user-visible diagnostics.
2024-07-14 10:05:22 +02:00
Matthias Krüger
dba010d7fa
Rollup merge of #127704 - workingjubilee:fixup-better-than, r=ChrisDenton
Fix minor typos in std::process doc on Win argv
2024-07-14 10:05:21 +02:00
Matthias Krüger
bef29c0a8f
Rollup merge of #127697 - onur-ozkan:use-std-filetimes, r=Kobzol
use std for file mtime and atime modifications

Since 1.75 std provides an interface to set access and modified times on files. This change replaces the external dependency previously used for these operations with the corresponding std functions.
2024-07-14 10:05:21 +02:00
Matthias Krüger
60e10e65ba
Rollup merge of #127322 - onur-ozkan:ci-rustc-incompatible-options, r=Mark-Simulacrum
handle ci-rustc incompatible options during config parse

This PR ensures that `config.toml` does not use CI rustc incompatible options when CI rustc is enabled (just like [ci-llvm checks](e2cf31a614/src/bootstrap/src/core/config/config.rs (L1809-L1836))). Some options can change compiler's behavior in certain scenarios. If we don't check these incompatible options, CI runners using CI rustc might ignore options we have explicitly set. This could be dangerous as we might think a rustc test passed with option T but in fact it wasn't tested with option T.

Later in https://github.com/rust-lang/rust/pull/122709, I will disable CI rustc if any of those options were used (similar to [this approach](dd2c24aafd/src/ci/run.sh (L165-L169))). If CI runners fail because of these checks, it means the logic in run.sh isn't covering the incompatible options correctly (since any incompatible option should turn off CI rustc).

The list may not be complete, but should be a good first step as it's better than nothing!

Blocker for https://github.com/rust-lang/rust/pull/122709
2024-07-14 10:05:20 +02:00
Matthias Krüger
459120d983
Rollup merge of #127083 - BoxyUwU:relnotes_1_80, r=Mark-Simulacrum,workingjubilee
Add release notes for 1.80

cc `@rust-lang/release`
r? `@Mark-Simulacrum`

I tended to err on the side of leaving more stuff in since I don't have a perfect idea of what should or should not be in the release notes right now.
2024-07-14 10:05:19 +02:00
bors
0ffbddd09e Auto merge of #127087 - cjgillot:small-map, r=oli-obk
Only track mentioned places for jump threading

This PR aims to reduce the state space size in jump threading and dataflow const-prop opts.

The current implementation walks the types of all locals, and creates a place for each possible projection. This can easily lead to a large number of places and tracked values, most being useless to the actual pass.

With this PR, we instead collect places that appear syntactically in the MIR (first commit). However, this is not sufficient (second commit), and we miss places that we could track in aggregate assignments. The third commit tracks such assignments to mirror place projections, see the inline comment.

This is complementary to https://github.com/rust-lang/rust/pull/127036

r? `@oli-obk`
2024-07-14 08:01:21 +00:00
Boxy
a54dbbfd0e add_effects_test 2024-07-14 07:57:53 +01:00
Ralf Jung
2dd5369eda clarify the meaning of the version number for accepted/removed features 2024-07-14 08:18:03 +02:00
bors
8a63c84af5 Auto merge of #127706 - workingjubilee:rollup-d07ij30, r=workingjubilee
Rollup of 6 pull requests

Successful merges:

 - #122300 (Add FileCheck annotations to mir-opt/dest-prop tests)
 - #127434 (use "bootstrap" instead of "rustbuild" in comments and docs)
 - #127477 (Clear `inner_attr_ranges` regularly.)
 - #127558 (More attribute cleanups)
 - #127659 (Use ManuallyDrop in BufWriter::into_parts)
 - #127671 (rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 8))

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-14 05:41:24 +00:00
Zalathar
f7508f8816 Improve internal docs for MatchPair 2024-07-14 15:01:02 +10:00
Zalathar
ce86b2ae96 Move MatchPair tree creation to its own module
This makes it easier to see that `MatchPair::new` has only one non-recursive
caller, because the recursive callers are all in this module.
2024-07-14 15:00:57 +10:00
Boxy
8f73091166 Add 1.80 release notes
Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
2024-07-14 04:52:25 +01:00
bors
4cd8dc6335 Auto merge of #127705 - workingjubilee:rollup-sjlzycu, r=workingjubilee
Rollup of 3 pull requests

Successful merges:

 - #127370 (Windows: Add experimental support for linking std-required system DLLs using raw-dylib)
 - #127446 (Remove memory leaks in doctests in `core`, `alloc`, and `std`)
 - #127677 (using correct tool mode for `run-make-support` crate)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-14 03:20:11 +00:00
Jubilee
6a3566c2b0
Rollup merge of #127671 - notriddle:notriddle/issue-d, r=Mark-Simulacrum
rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 8)

Follow up

* https://github.com/rust-lang/rust/pull/116214
* https://github.com/rust-lang/rust/pull/116432
* https://github.com/rust-lang/rust/pull/116824
* https://github.com/rust-lang/rust/pull/118105
* https://github.com/rust-lang/rust/pull/119561
* https://github.com/rust-lang/rust/pull/123574
* https://github.com/rust-lang/rust/pull/125382

As always, it's easier to review the commits one at a time. Don't use the Files Changed tab. It's confusing.
2024-07-13 20:19:48 -07:00
Jubilee
2d8493bb5f
Rollup merge of #127659 - saethlin:manually-drop-bufwriter, r=joboet
Use ManuallyDrop in BufWriter::into_parts

The fact that `mem::forget` takes by value means that it interacts very poorly with Stacked Borrows; generally users think of calling it as a no-op, but in Stacked Borrows, the field retagging tends to cause surprise tag invalidation.
2024-07-13 20:19:47 -07:00
Jubilee
125343e7ab
Rollup merge of #127558 - nnethercote:more-Attribute-cleanups, r=petrochenkov
More attribute cleanups

A follow-up to #127308.

r? ```@petrochenkov```
2024-07-13 20:19:46 -07:00
Jubilee
1c8ea14272
Rollup merge of #127477 - nnethercote:tweak-inner_attr_ranges, r=petrochenkov
Clear `inner_attr_ranges` regularly.

There's a comment saying we don't do it for performance reasons, but it doesn't actually affect performance.

The commit also tweaks the control flow, to make clearer that two code paths are mutually exclusive.

r? ````@petrochenkov````
2024-07-13 20:19:46 -07:00
Jubilee
1d59d22ac1
Rollup merge of #127434 - onur-ozkan:use-bootstrap-instead-of-rustbuild, r=Mark-Simulacrum
use "bootstrap" instead of "rustbuild" in comments and docs

Let's stick with the single name "bootstrap" to refer to the bootstrap project to avoid confusion. This should make it clearer, especially for new contributors.
2024-07-13 20:19:45 -07:00
Jubilee
4c493db0d9
Rollup merge of #122300 - CastilloDel:master, r=cjgillot
Add FileCheck annotations to mir-opt/dest-prop tests

Part of https://github.com/rust-lang/rust/issues/116971, adds FileCheck annotations to MIR-opt tests in tests/mir-opt/dest-prop.

I would like some feedback. Also, I don't know how to approach `union.rs`.  I couldn't figure out what it is testing.

r? cjgillot
2024-07-13 20:19:45 -07:00
Jubilee
9201f18310
Rollup merge of #127677 - onur-ozkan:use-correct-modes, r=Kobzol
using correct tool mode for `run-make-support` crate

We don't need to ensure std (and rustc) for testing run-make-support's unit tests. Using stage 0 compiler is already enough and speeds up `x test run-make-support` invocations on a clean build.
2024-07-13 20:18:24 -07:00
Jubilee
285d45d299
Rollup merge of #127446 - zachs18:miri-stdlib-leaks-core-alloc, r=Mark-Simulacrum
Remove memory leaks in doctests in `core`, `alloc`, and `std`

cc `@RalfJung`  https://github.com/rust-lang/rust/issues/126067 https://github.com/rust-lang/miri/issues/3670

Should be no actual *documentation* changes[^1], all added/modified lines in the doctests are hidden with `#`,

This PR splits the existing memory leaks in doctests in `core`, `alloc`, and `std` into two general categories:

1. "Non-focused" memory leaks that are incidental to the thing being documented, and/or are easy to remove, i.e. they are only there because preventing the leak would make the doctest less clear and/or concise.
    - These doctests simply have a comment like `# // Prevent leaks for Miri.` above the added line that removes the memory leak.
    - [^2]Some of these would perhaps be better as part of the public documentation part of the doctest, to clarify that a memory leak can happen if it is not otherwise mentioned explicitly in the documentation  (specifically the ones in `(A)Rc::increment_strong_count(_in)`).
2. "Focused" memory leaks that are intentional and documented, and/or are possibly fragile to remove.
    - These doctests have a `# // FIXME` comment above the line that removes the memory leak, with a note that once `-Zmiri-disable-leak-check` can be applied at test granularity, these tests should be "un-unleakified" and have `-Zmiri-disable-leak-check` enabled.
    - Some of these are possibly fragile (e.g. unleaking the result of `Vec::leak`) and thus should definitely not be made part of the documentation.

This should be all of the leaks currently in `core` and `alloc`. I only found one leak in `std`, and it was in the first category (excluding the modules `@RalfJung` mentioned in https://github.com/rust-lang/rust/issues/126067 , and reducing the number of iterations of [one test](https://github.com/rust-lang/rust/blob/master/library/std/src/sync/once_lock.rs#L49-L94) from 1000 to 10)

[^1]: assuming [^2] is not added
[^2]: backlink
2024-07-13 20:18:23 -07:00
Jubilee
5c56577948
Rollup merge of #127370 - ChrisDenton:win-sys, r=Mark-Simulacrum
Windows: Add experimental support for linking std-required system DLLs using raw-dylib

For Windows, this allows std to define system imports without needing the user to have import libraries. It's intended for this to become the default.

For now it's an experimental feature so it can be tested using build-std.
2024-07-13 20:18:23 -07:00
tesuji
193767e650 doc: Suggest str::repeat over iter::repeat().take().collect()
Using ../../std syntax because of difficulty link alloc stuff to core.
2024-07-14 00:51:08 +00:00
Jubilee Young
99a5964b73 Fix minor typos in std::process doc on Win argv 2024-07-13 16:56:25 -07:00
bors
00167abb41 Auto merge of #127694 - bjorn3:sync_cg_clif-2024-07-13, r=bjorn3
Subtree sync for rustc_codegen_cranelift

Couple of bug fixes this time.

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

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
2024-07-13 23:06:12 +00:00
onur-ozkan
e2c15fe03b use std for file mtime and atime modifications
Since 1.75 std provides an interface to set access and modified times on files.
This change replaces the external dependency previously used for these operations
with the corresponding std functions.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-14 00:41:05 +03:00
bors
fcaa6fdfbe Auto merge of #126958 - dtolnay:u32char, r=Mark-Simulacrum
Stabilize const unchecked conversion from u32 to char

Closes https://github.com/rust-lang/rust/issues/89259.

The functions in this PR were left out of the initial set of `feature(const_char_convert)` stabilizations in https://github.com/rust-lang/rust/pull/102470, but have since been unblocked by https://github.com/rust-lang/rust/pull/118979.

If `unsafe { from_u32_unchecked(u) }` is called in const with a value for which `from_u32(u)` returns None, we get the following compile error.

```rust
fn main() {
    let _ = const { unsafe { char::from_u32_unchecked(0xd800) } };
}
```

```console
error[E0080]: it is undefined behavior to use this value
 --> src/main.rs:2:19
  |
2 |     let _ = const { unsafe { char::from_u32_unchecked(0xd800) } };
  |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x0000d800, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
  |
  = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
  = note: the raw bytes of the constant (size: 4, align: 4) {
              00 d8 00 00                                     │ ....
          }

note: erroneous constant encountered
 --> src/main.rs:2:13
  |
2 |     let _ = const { unsafe { char::from_u32_unchecked(0xd800) } };
  |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
2024-07-13 18:41:08 +00:00
bjorn3
6ff363f0ff Merge commit '659243d85c7489412bd0faa1c068d904a6042941' into sync_cg_clif-2024-07-13 2024-07-13 18:39:03 +00:00
bjorn3
659243d85c Fix rustc test suite 2024-07-13 18:38:35 +00:00
bjorn3
739dfcab8e Rustup to rustc 1.81.0-nightly (c6727fc9b 2024-07-12) 2024-07-13 18:32:48 +00:00
onur-ozkan
41070bd938 explain why we use in-tree std for compiletest
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-13 19:58:36 +03:00
onur-ozkan
fc0d1dc99b use ModeToolBootstrap for run-make-support's crate tests
We don't need to ensure std (and rustc) for testing run-make-support's
unit tests. Using stage 0 compiler is already enough and speeds up
`x test run-make-support` invocations on a clean build.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-13 19:22:44 +03:00
bors
366e558c3b Auto merge of #127683 - devnexen:macos_fs_update, r=joboet
std::unix::fs: removing, now useless, layers predating macOs 10.10.

fdopendir, openat and unlinkat are available since yosemite but we support sierra as minimum.
2024-07-13 16:19:23 +00:00
bjorn3
f5c3195e92 Nicer error message when using raw-dylib
cc rust-lang/rustc_codegen_cranelift#1510
2024-07-13 13:53:14 +00:00
bors
25acbbd12f Auto merge of #127435 - GrigorenkoPV:tests-for-112905, r=cjgillot
Add tests for #112905

This is a part of #105107. Adds the tests from the OP in #112905.
2024-07-13 13:12:52 +00:00