Commit Graph

260513 Commits

Author SHA1 Message Date
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
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
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
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
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
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
David Carlier
6cd19116bc
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 13:28:55 +01:00
Camille GILLOT
6e3cff7094 Bless coverage. 2024-07-13 12:02:12 +00:00
Camille GILLOT
7ac7f135e3 Propagate places through assignments. 2024-07-13 12:02:10 +00:00
Camille GILLOT
af876626b0 Add test for copying aggregates. 2024-07-13 11:54:30 +00:00
Camille GILLOT
76f5bc6a9f Create mapped places upon seeing them in the body. 2024-07-13 11:54:25 +00:00
bors
c1e3f03e60 Auto merge of #127450 - Kobzol:bootstrap-cmd-refactor-5, r=onur-ozkan
Bootstrap command refactoring: improve debuggability (step 5)

Continuation of https://github.com/rust-lang/rust/pull/127321.

This PR improves the debuggability of command execution, by improving the output logged when a command fails (it now includes the exact location where the command was created and where it was executed), and also by adding a "drop bomb", which will panic if a command was created, but not executed (which is probably a bug).

Here is how the output of a failed command looks like:
```
Command "git" "foo" "[bar]" (failure_mode=Exit, stdout_mode=Capture, stderr_mode=Capture) did not execute successfully.
Expected success, got exit status: 1
Created at: src/core/build_steps/compile.rs:1699:9
Executed at: src/core/build_steps/compile.rs:1699:58

STDOUT ----

STDERR ----
git: 'foo' is not a git command. See 'git --help'.
```

And this is what is printed if you forget to execute a command:
```
thread 'main' panicked at /projects/personal/rust/rust/src/tools/build_helper/src/drop_bomb/mod.rs:42:13:
command constructed at `src/core/build_steps/compile.rs:1699:9` was dropped without being executed: `git`
```

Best reviewed commit by commit.

Tracking issue: https://github.com/rust-lang/rust/issues/126819

r? `@onur-ozkan`
2024-07-13 09:44:05 +00:00
Jakub Beránek
0cce0bb204
Avoid more instances of unused command execution in dry run 2024-07-13 11:41:29 +02:00
bors
44fb8575de Auto merge of #127674 - jhpratt:rollup-0dxy3k7, r=jhpratt
Rollup of 3 pull requests

Successful merges:

 - #127654 (Fix incorrect NDEBUG handling in LLVM bindings)
 - #127661 (Stabilize io_slice_advance)
 - #127668 (Improved slice documentation)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-13 06:05:25 +00:00
Jacob Pratt
f0119130de
Rollup merge of #127668 - spencer3035:improve-slice-doc, r=jhpratt
Improved slice documentation

Improve slice documentation to include assert_eq checks for all the cases where there were existing examples. I think it makes things more clear when the documentation explicitly checks against values and shows the reader what it does.

I also started a rust internals discussion about it here: https://internals.rust-lang.org/t/improve-slice-documentaion/21168
2024-07-13 00:24:36 -04:00
Jacob Pratt
68ec9c1992
Rollup merge of #127661 - eduardosm:stabilize-io_slice_advance, r=cuviper
Stabilize io_slice_advance

Closes https://github.com/rust-lang/rust/issues/62726 (FCP completed)

Stabilized API:

```rust
impl<'a> IoSlice<'a> {
    pub fn advance(&mut self, n: usize);
    pub fn advance_slices(bufs: &mut &mut [IoSlice<'a>], n: usize);
}

impl<'a> IoSliceMut<'a> {
    pub fn advance(&mut self, n: usize);
    pub fn advance_slices(bufs: &mut &mut [IoSliceMut<'a>], n: usize);
}
```
2024-07-13 00:24:35 -04:00
Jacob Pratt
cb1ccc1842
Rollup merge of #127654 - nikic:llvm-ndebug-fix, r=cuviper
Fix incorrect NDEBUG handling in LLVM bindings

We currently compile our LLVM bindings using `-DNDEBUG` if debuginfo for LLVM is disabled. However, `NDEBUG` doesn't have any relation to debuginfo, it controls whether assertions are enabled.

Split the LLVM_NDEBUG environment variable into two, so that assertions and debuginfo are controlled independently.

After this change, `LLVMRustDIBuilderInsertDeclareAtEnd` triggers an assertion failure on LLVM 19 due to an incorrect cast. Fix it by removing the unused return value entirely.

r? `@cuviper`
2024-07-13 00:24:35 -04:00
bors
0065384608 Auto merge of #127397 - jyn514:multi-thread-panic-hook, r=workingjubilee
fix interleaved output in the default panic hook when multiple threads panic simultaneously

previously, we only held a lock for printing the backtrace itself. since all threads were printing to the same file descriptor, that meant random output in the default panic hook from one thread would be interleaved with the backtrace from another. now, we hold the lock for the full duration of the hook, and the output is ordered.

---

i noticed some odd things while working on this you may or may not already be aware of.

- libbacktrace is included as a submodule instead of a normal rustc crate, and as a result uses `cfg(backtrace_in_std)` instead of a more normal `cfg(feature = "rustc-dep-of-std")`. probably this is left over from before rust used a cargo-based build system?
- the default panic handler uses `trace_unsynchronized`, etc, in `sys::backtrace::print`. as a result, the lock only applies to concurrent *panic handlers*, not concurrent *threads*.  in other words, if another, non-panicking, thread tried to print a backtrace at the same time as the panic handler, we may have UB, especially on windows.
    - we have the option of changing backtrace to enable locking when `backtrace_in_std` is set so we can reuse their lock instead of trying to add our own.
2024-07-13 03:42:24 +00:00
bors
03c2100ded Auto merge of #126606 - zachs18:patch-2, r=joboet
Guard against calling `libc::exit` multiple times on Linux.

Mitigates (but does not fix) #126600 by ensuring only one thread which calls Rust `exit` actually calls `libc::exit`, and all other callers of Rust `exit` block.
2024-07-13 01:18:59 +00:00
Michael Howell
42ee400b0f Move assertion-free rustdoc ice tests to rustdoc-ui 2024-07-12 18:18:30 -07:00
Michael Goulet
938ed369ad Gate the type length limit check behind a nightly flag 2024-07-12 21:16:09 -04:00