Commit Graph

254109 Commits

Author SHA1 Message Date
Matthias Krüger
7fbfd8d770
Rollup merge of #124690 - compiler-errors:only-ambig-if-ambig, r=lcnr
Only consider ambiguous goals when finding best obligation for ambiguities

We don't care about ambiguous goals when reporting true errors, and vice versa for ambiguities.

r? lcnr
2024-05-04 22:27:31 +02:00
Matthias Krüger
f4d0776b4f
Rollup merge of #124663 - Kobzol:docker-local-download, r=Mark-Simulacrum
Enable reusing CI Docker cache when running CI images locally

When running a CI image locally, e.g. using `DEPLOY=1 src/ci/docker/run.sh dist-x86_64-linux`, it can take a long time until the Docker image is built, which is annoying.

Since we now use proper Docker caching on CI, it should be possible to just `docker pull` the prebuilt image to reuse the cache. We didn't want to do this on CI, since our caching key isn't perfect and it's possible that we can miss some changes, but I think that for local usage it is fine (we could introduce some env. var. to force disable the image download, if needed).

r? `@Mark-Simulacrum`
2024-05-04 22:27:31 +02:00
Matthias Krüger
bad5382346
Rollup merge of #124573 - onur-ozkan:update-dep-comment, r=Mark-Simulacrum
add a reference link to the comment of the "cc" and "cmake".

Having a reference link provides more context for the problems of bumping cc and cmake.
2024-05-04 22:27:30 +02:00
Matthias Krüger
43a5e3fb95
Rollup merge of #124501 - VladimirMakaev:add-lldb-to-config-toml, r=Mark-Simulacrum
add support to override lldb binary path for ./x test

When running debuginfo tests I couldn't set custom build of lldb. The `src/bootstrap/src/core/build_steps/test.rs` has "lldb" hardcoded. I ended up hacking `src/bootstrap/src/core/build_steps/test.rs` just to get the tests running the way I wanted.

Then I've found out that we can override `gdb` under [build] section. This PR enables the same for `lldb`
2024-05-04 22:27:30 +02:00
bors
d568423a7a Auto merge of #124716 - matthiaskrgr:rollup-ni58ie1, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #122441 (Improve several `Read` implementations)
 - #124584 (Various improvements to entrypoint code)
 - #124699 (Use `unchecked_sub` in `split_at`)
 - #124715 (interpret, miri: uniform treatments of intrinsics/functions with and without return block)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-04 18:18:42 +00:00
Vladimir Makaev
79e09a6fc5 Added an entry for "lldb" in config.example.toml 2024-05-04 17:55:19 +00:00
Matthias Krüger
743be1e35e
Rollup merge of #124715 - RalfJung:interpret-noreturn, r=compiler-errors
interpret, miri: uniform treatments of intrinsics/functions with and without return block

A long time ago we didn't have a `dest: &MPlaceTy<'tcx, Self::Provenance>` for diverging functions, and since `dest` is used so often we special-cased these non-returning intrinsics and functions so that we'd have `dest` available everywhere else. But this has changed a while ago, now only the return block `ret` is optional, and there's a convenient `return_to_block` function for dealing with the `None` case.

So there no longer is any reason to treat diverging intrinsics/functions any different from those that do return.
2024-05-04 18:36:38 +02:00
Matthias Krüger
a5cc1f663f
Rollup merge of #124699 - scottmcm:split_at_unchecked_should_use_unchecked, r=Nilstrieb
Use `unchecked_sub` in `split_at`

LLVM currently isn't figuring it out on its own, even in the checked version where it hypothetically could.

Before: <https://rust.godbolt.org/z/PEY38YrKs>
```llvm
bb1:                                              ; preds = %start
  %4 = getelementptr inbounds float, ptr %x.0, i64 %n
  %5 = sub i64 %x.1, %n
```

After:
```llvm
bb1:                                              ; preds = %start
  %4 = getelementptr inbounds float, ptr %x.0, i64 %n
  %5 = sub nuw i64 %x.1, %n
```

This is not using the wrapper because there's already a ubcheck covering it, so I don't want this to get a second one once #121571 lands.

---

This is basically the same as #108763, since `split_at` is essentially doing two `get_unchecked`s.
2024-05-04 18:36:38 +02:00
Matthias Krüger
9af1e8ce42
Rollup merge of #124584 - Nilstrieb:entrypointy, r=fee1-dead
Various improvements to entrypoint code

This moves some code around and adds some documentation comments to make it easier to understand what's going on with the entrypoint logic, which is a bit complicated.

The only change in behavior is consolidating the error messages for unix_sigpipe to make the code slightly simpler.
2024-05-04 18:36:37 +02:00
Matthias Krüger
00bc2a425c
Rollup merge of #122441 - a1phyr:improve_read_impls, r=ChrisDenton
Improve several `Read` implementations

- `read_to_end` and `read_to_string` for `Cursor`
- Error on OOM in `read_to_string` of `&[u8]` and `VecDeque<u8>`
- Avoid making the slices contiguous in `VecDeque::read_to_string`
- ~`read_exact` and (unstable) `read_buf_exact` for `Take`~
- ~`read_buf` for `UnixStream` and `&UnixStream`~ (moved to #123084)
- `read_to_end` for `ChildStdErr`
2024-05-04 18:36:37 +02:00
bors
1a851da73c Auto merge of #124704 - Urgau:fix-ignored-tests-fmt, r=GuillaumeGomez
Fix ignored tests for formatting

This PR fixes the ignored rules in `rustfmt.toml` that were changed in https://github.com/rust-lang/rust/pull/124613 to allow formatting `rmake.rs` but ended up allowing formatting every Rust files in `tests/`.

The fix is a bit involved since we need to workaround a [`.gitignore` pattern limitation](https://git-scm.com/docs/gitignore#_pattern_format):
> An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined.

Workaround using https://stackoverflow.com/a/5534865

I tested the fix by changing the formatting in an `rmake.rs` and UI test, and verifying that only the `rmake.rs` files were formatted.

Fixes https://github.com/rust-lang/rust/pull/124613#issuecomment-2094094670
cc `@GuillaumeGomez`
r? `@onur-ozkan`
2024-05-04 16:08:48 +00:00
Michael Goulet
6714216eaa Only consider ambiguous goals when finding best obligation for ambiguities 2024-05-04 12:05:36 -04:00
Ralf Jung
8e4466497f interpret, miri: uniform treatments of intrinsics/functions with and without return block 2024-05-04 17:39:29 +02:00
Nilstrieb
1572c0dcd7 Various improvements to entrypoint code
This moves some code around and adds some documentation comments to make
it easier to understand what's going on with the entrypoint logic, which
is a bit complicated.

The only change in behavior is consolidating the error messages for
unix_sigpipe to make the code slightly simpler.
2024-05-04 14:48:42 +02:00
bors
d7ea27808d Auto merge of #124703 - matthiaskrgr:rollup-2lljptd, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #123356 (Reduce code size of `thread::set_current`)
 - #124159 (Move thread parking to `sys::sync`)
 - #124293 (Let miri and const eval execute intrinsics' fallback bodies)
 - #124677 (Set non-leaf frame pointers on Fuchsia targets)
 - #124692 (We do not coerce `&mut &mut T -> *mut mut T`)
 - #124698 (Rewrite `rustdoc-determinism` test in Rust)
 - #124700 (Remove an unnecessary cast)
 - #124701 (Docs: suggest `uN::checked_sub` instead of check-then-unchecked)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-04 12:41:40 +00:00
Urgau
f43e3e2023 Fix ignored tests for formatting 2024-05-04 12:37:30 +02:00
Matthias Krüger
5f4f4fbb98
Rollup merge of #124701 - scottmcm:unchecked_sub_docs, r=Nilstrieb
Docs: suggest `uN::checked_sub` instead of check-then-unchecked

As of #124114 it's exactly the same in codegen, so might as well not use `unsafe`.

Note that this is only for *unsigned*, since the overflow conditions for `iN::checked_sub` are more complicated.
2024-05-04 12:37:24 +02:00
Matthias Krüger
770567101c
Rollup merge of #124700 - scottmcm:unneeded_cast, r=Nilstrieb
Remove an unnecessary cast

Very minor thing, obviously, but I randomly saw this unnecessary cast showing up in the UbChecks, so might as well get rid of it.
2024-05-04 12:37:24 +02:00
Matthias Krüger
b8711373cd
Rollup merge of #124698 - JoverZhang:test-rustdoc-determinism, r=jieyouxu
Rewrite `rustdoc-determinism` test in Rust

Rewrite the `rustdoc-determinism` test from #121876.

r? `@jieyouxu`
2024-05-04 12:37:23 +02:00
Matthias Krüger
b0715b4e57
Rollup merge of #124692 - workingjubilee:document-no-double-pointer-coercion-happens, r=compiler-errors
We do not coerce `&mut &mut T -> *mut mut T`

Resolves #34117 by declaring it to be "working as intended" until someone RFCs it or whatever other lang proposal would be required. It seems a bit of a footgun, but perhaps there are strong reasons to allow it anyways. Seeing as how I often have to be mindful to not allow a pointer to coerce the wrong way in my FFI work, I am inclined to think not, but perhaps it's fine in some use-case and that's actually more common?
2024-05-04 12:37:23 +02:00
Matthias Krüger
81b43b759c
Rollup merge of #124677 - djkoloski:set_fuchsia_frame_pointer, r=tmandry
Set non-leaf frame pointers on Fuchsia targets

This is part of our work to enable shadow call stack sanitization on Fuchsia, see [this Fuchsia issue](https://g-issues.fuchsia.dev/issues/327643884).

r? ``@tmandry``
2024-05-04 12:37:22 +02:00
Matthias Krüger
ceb7b5e70e
Rollup merge of #124293 - oli-obk:miri_intrinsic_fallback_body, r=RalfJung
Let miri and const eval execute intrinsics' fallback bodies

fixes https://github.com/rust-lang/miri/issues/3397

r? ``@RalfJung``
2024-05-04 12:37:22 +02:00
Matthias Krüger
cc51f91455
Rollup merge of #124159 - joboet:move_pal_thread_parking, r=ChrisDenton
Move thread parking to `sys::sync`

Part of #117276.

I'll leave the platform-specific API abstractions in `sys::pal`, as per the initial proposal. I'm not entirely sure whether we'll want to keep it that way, but that remains to be seen.

r? ``@ChrisDenton`` (if you have time)
2024-05-04 12:37:21 +02:00
Matthias Krüger
b8fa047398
Rollup merge of #123356 - joboet:set_current_size, r=ChrisDenton
Reduce code size of `thread::set_current`

#123265 introduced a rather large binary size regression, because it added an `unwrap()` call on a `Result<(), Thread>`, which in turn pulled its rather heavy `Debug` implementation. This PR fixes this by readding the `rtassert!` that was removed.
2024-05-04 12:37:20 +02:00
bors
7dd170fccb Auto merge of #124345 - Urgau:compiletest-check-cfg, r=jieyouxu
Enable `--check-cfg` by default in UI tests

This PR enables-by-default `--check-cfg` in UI tests, now that it has become stable.

To do so this PR does 2 main things:
 - it introduce the `no-auto-check-cfg` directive to `compiletest`, to prevent any `--check-cfg` args (only to be used for `--check-cfg` tests)
 - it updates the _remaining_[^1] UI tests by either:
     - allowing the lint when neither expecting the lint nor giving the check-cfg args make sense
     - give the appropriate check-cfg args
     - or expect the lint, when it useful

[^1]: some preparation work was done in #123577 #123702

I highly recommend reviewing this PR commit-by-commit.

r? `@jieyouxu`
2024-05-04 10:31:49 +00:00
Urgau
d4e26fbb53 compiletest: add enable-by-default check-cfg 2024-05-04 11:30:38 +02:00
Urgau
517374150c compiletest: add no-auto-check-cfg directive
this directive prevents compiletest from adding any implicit and
automatic --check-cfg arguments
2024-05-04 11:30:38 +02:00
Urgau
ed81578820 tests/ui: prepare some tests for --check-cfg by default 2024-05-04 11:30:38 +02:00
Scott McMurray
e1c833eb07 Docs: suggest uN::checked_sub instead of check-then-unchecked
As of 124114 it's exactly the same in codegen, so might as well not use `unsafe`.

Note that this is only for *unsigned*, since the overflow conditions for `iN::checked_sub` are more complicated.
2024-05-04 01:44:49 -07:00
Scott McMurray
b95d1b716f Remove an unnecessary cast
Very minor thing, obviously, but I randomly saw this unnecessary cast showing up in the UbChecks, so might as well get rid of it.
2024-05-04 01:25:39 -07:00
Scott McMurray
f1de4c16ee Use unchecked_sub in split_at 2024-05-04 00:54:21 -07:00
Jover Zhang
2f4861c0e6 Rewrite rustdoc-determinism test in Rust 2024-05-04 15:52:42 +08:00
bors
6d721dd0b8 Auto merge of #124562 - dpaoliello:mingwserver2022, r=Mark-Simulacrum
Use Server 2022 in CI for mingw jobs

From my [previous testing](https://github.com/rust-lang/rust/issues/92948#issuecomment-2077771347), there is nothing blocking using Server 2022 for the Windows MinGW jobs.

This change:
* Adds new `os` entries for Server 2022.
* Renamed the Server 2019 `os` entries (as we'll be removing these over time).
* Moves the mingw jobs to Server 2022 and leaves the msvc jobs on Server 2019.

Partially fixes #92948
2024-05-04 07:49:50 +00:00
Ralf Jung
4e97c6c5c7 mark const_(de)allocate intrinsics as suitable for Miri 2024-05-04 08:40:42 +02:00
bors
9fa862ff29 Auto merge of #124694 - compiler-errors:rollup-pfou5uu, r=compiler-errors
Rollup of 8 pull requests

Successful merges:

 - #124418 (Use a proof tree visitor to refine the `Obligation` for error reporting in new solver)
 - #124480 (Change `SIGPIPE` ui from `#[unix_sigpipe = "..."]` to `-Zon-broken-pipe=...`)
 - #124648 (Trim crate graph)
 - #124656 (release notes 1.78: add link to interior-mut breaking change)
 - #124658 (Migrate `run-make/doctests-keep-binaries` to new rmake.rs format)
 - #124678 (Stabilize `split_at_checked`)
 - #124681 (zkvm: fix run_tests)
 - #124687 (Make `Bounds.clauses` private)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-04 05:41:56 +00:00
Michael Goulet
a55d30f53c
Rollup merge of #124687 - fee1-dead-contrib:private-clauses, r=compiler-errors
Make `Bounds.clauses` private

Construct it through `Bounds::default()`, then consume the clauses via the method `Bounds::clauses()`.

This helps with effects desugaring where `clauses()` is not only the clauses within the `clauses` field.
2024-05-03 23:34:25 -04:00
Michael Goulet
683197701c
Rollup merge of #124681 - risc0:erik/fix-test, r=joboet
zkvm: fix run_tests

`zkvm` is single-threaded, similar to `emscripten` and `wasm`. The `cfg` for `zkvm` seems to have been dropped. This PR adds the `cfg` again.
2024-05-03 23:34:24 -04:00
Michael Goulet
93ca906cb5
Rollup merge of #124678 - UserIsntAvailable:feat/stabilize-split-at-checked, r=jhpratt
Stabilize `split_at_checked`

Closes #119128

For the const version of `slice::split_at_mut_checked`, I'm reusing the `const_slice_split_at_mut` feature flag (#101804). I don't if it okay to reuse tracking issues or if it preferred to create new ones...
2024-05-03 23:34:24 -04:00
Michael Goulet
b2ca667939
Rollup merge of #124658 - GuillaumeGomez:migrate-to-run-make, r=jieyouxu
Migrate `run-make/doctests-keep-binaries` to new rmake.rs format

r? ```@jieyouxu```
2024-05-03 23:34:23 -04:00
Michael Goulet
f8ab0a74ab
Rollup merge of #124656 - RalfJung:release-notes, r=Mark-Simulacrum
release notes 1.78: add link to interior-mut breaking change

Cc https://github.com/rust-lang/rust/pull/123248#issuecomment-2092448205

r? ```@Mark-Simulacrum```
2024-05-03 23:34:23 -04:00
Michael Goulet
356b6c70ab
Rollup merge of #124648 - nnethercote:trim-crate-graph, r=jackh726
Trim crate graph

This PR removes some unnecessary `Cargo.toml` entries, and makes some other small related cleanups that I found while looking at this stuff.

r? ```@pnkfelix```
2024-05-03 23:34:22 -04:00
Michael Goulet
9dfd527c6f
Rollup merge of #124480 - Enselic:on-broken-pipe, r=jieyouxu
Change `SIGPIPE` ui from `#[unix_sigpipe = "..."]` to `-Zon-broken-pipe=...`

In the stabilization [attempt](https://github.com/rust-lang/rust/pull/120832) of `#[unix_sigpipe = "sig_dfl"]`, a concern was [raised ](https://github.com/rust-lang/rust/pull/120832#issuecomment-2007394609) related to using a language attribute for the feature: Long term, we want `fn lang_start()` to be definable by any crate, not just libstd. Having a special language attribute in that case becomes awkward.

So as a first step towards the next stabilization attempt, this PR changes the `#[unix_sigpipe = "..."]` attribute to a compiler flag `-Zon-broken-pipe=...` to remove that concern, since now the language is not "contaminated" by this feature.

Another point was [also raised](https://github.com/rust-lang/rust/pull/120832#issuecomment-1987023484), namely that the ui should not leak **how** it does things, but rather what the **end effect** is. The new flag uses the proposed naming. This is of course something that can be iterated on further before stabilization.

Tracking issue: https://github.com/rust-lang/rust/issues/97889
2024-05-03 23:34:22 -04:00
Michael Goulet
e3bf0a13cf
Rollup merge of #124418 - compiler-errors:better-cause, r=lcnr
Use a proof tree visitor to refine the `Obligation` for error reporting in new solver

With the magic of `ProofTreeVisitor`, we can close the gap that we have on `ObligationCause`s being not as descriptive in the new trait solver.

r? lcnr

Needs some work and obviously documentation.
2024-05-03 23:34:21 -04:00
bors
2c4bf249bd Auto merge of #124684 - Muscraft:update-cargo, r=Muscraft
Update cargo

18 commits in 6087566b3fa73bfda29702632493e938b12d19e5..05364cb2f61a2c2b091e061c1f42b207dfb5f81f
2024-04-30 20:45:20 +0000 to 2024-05-03 16:48:59 +0000
- chore(deps): update msrv (3 versions) to v1.76 (rust-lang/cargo#13857)
- Stabilize `-Zcheck-cfg` as always enabled (rust-lang/cargo#13571)
- fix(lints): Prevent inheritance from bring exposed for published packages (rust-lang/cargo#13852)
- refactor: remove unnecessary branch for link binary on macOS (rust-lang/cargo#13851)
- perf(toml): Avoid inferring when targets are known (rust-lang/cargo#13849)
- Update continuous-integration.md: Include CircleCI reference (rust-lang/cargo#13850)
- chore(deps): update msrv (1 version) to v1.78 (rust-lang/cargo#13848)
- Workaround copying file returning EAGAIN on ZFS on mac OS (rust-lang/cargo#13845)
- Clean package perf improvements (rust-lang/cargo#13818)
- fix(toml): Validate crates_types/proc-macro for bin like others (rust-lang/cargo#13841)
- fix(toml): On 2024 Edition, disallow ignored `default-features` when inheriting (rust-lang/cargo#13839)
- chore(ci): Ignore openssl deps (rust-lang/cargo#13840)
- fix(lints): Remove ability to specify `-` in lint name (rust-lang/cargo#13837)
- fix(resolver): Treat unset MSRV as compatible (rust-lang/cargo#13791)
- fix(toml): Don't lose 'public' when inheriting a dep (rust-lang/cargo#13836)
- chore(deps): update compatible (rust-lang/cargo#13834)
- Error when unstable lints are specified but not enabled (rust-lang/cargo#13805)
- fix(lint): Warn not Error on unsupported lint tool (rust-lang/cargo#13833)

r? ghost

Note: this includes the fix that was beta backported in #124647
2024-05-04 03:33:57 +00:00
Jubilee Young
e404e7a8bd We do not coerce &mut &mut T -> *mut mut T 2024-05-03 20:19:20 -07:00
Deadbeef
921e74fa57 Make Bounds.clauses private 2024-05-04 10:20:39 +08:00
bors
09cd00fea4 Auto merge of #124401 - oli-obk:some_hir_cleanups, r=cjgillot
Some hir cleanups

It seemed odd to not put `AnonConst` in the arena, compared with the other types that we did put into an arena. This way we can also give it a `Span` without growing a lot of other HIR data structures because of the extra field.

r? compiler
2024-05-04 00:32:27 +00:00
Scott Schafer
8644cf9ccc
Update cargo 2024-05-03 17:05:30 -06:00
bors
d2d24e395a Auto merge of #123602 - cjgillot:gvn-borrowed, r=oli-obk
Account for immutably borrowed locals in MIR copy-prop and GVN

For the most part, we consider that immutably borrowed `Freeze` locals still fulfill SSA conditions. As the borrow is immutable, any use of the local will have the value given by the single assignment, and there can be no surprise.

This allows copy-prop to merge a non-borrowed local with a borrowed local. We chose to keep copy-classes heads unborrowed, as those may be easier to optimize in later passes.

This also allows to GVN the value behind an immutable borrow. If a SSA local is borrowed, dereferencing that borrow is equivalent to copying the local's value: re-executing the assignment between the borrow and the dereference would be UB.

r? `@ghost` for perf
2024-05-03 21:50:13 +00:00
Erik Kaneda
dde17cf3ee
zkvm: fix run_tests
zkvm is single-threaded, similar to emscripten and wasm.
2024-05-03 14:34:51 -07:00