Commit Graph

263921 Commits

Author SHA1 Message Date
Xiretza
c864238baf Update annotate-snippets to 0.11 2024-08-19 20:22:07 +00:00
bors
4fe1e2bd5b Auto merge of #129218 - saethlin:gdb-supports-rust-now, r=jieyouxu
Delete debuginfo test suite infra for gdb without Rust support and lldb with Rust support

Implements https://github.com/rust-lang/rust/issues/128953

I also deleted all the `min-lldb-version: 310` comments, because the oldest compatible distro I can find is Ubuntu 16.04 which ships lldb 3.8, though of course the package that the Ubuntu maintainers put together for that is broken.

Rocky Linux 8 amusingly ships lldb 17, even though it has a similar glibc and kernel version.

This PR is multiple highly mechanical changes. Some of the commits were created by just running `sed`. You may find it easier to review each commit separately.
2024-08-19 12:16:20 +00:00
bors
45fbf41deb Auto merge of #128722 - tgross35:new-resolver-root, r=Mark-Simulacrum
Switch to using the v2 resolver in most workspaces

Pinning the resolver to v1 was done in 5abff3753a ("Explicit set workspace.resolver ...") in order to suppress warnings. Since there is no specific reason not to use the new resolver and since it fixes issues, change to `resolver = "2"` everywhere except library.
2024-08-19 09:50:33 +00:00
bors
e3f909b2bb Auto merge of #129261 - tgross35:rollup-xjbvqx7, r=tgross35
Rollup of 7 pull requests

Successful merges:

 - #127679 (Stabilize `raw_ref_op` (RFC 2582))
 - #128084 (Suggest adding Result return type for associated method in E0277.)
 - #128628 (When deduplicating unreachable blocks, erase the source information.)
 - #128902 (doc: std::env::var: Returns None for names with '=' or NUL byte)
 - #129048 (Update `crosstool-ng` for loongarch64)
 - #129116 (Include a copy of `compiler-rt` source in the `download-ci-llvm` tarball)
 - #129208 (Fix order of normalization and recursion in const folding.)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-19 06:23:49 +00:00
Trevor Gross
8a513f1720
Rollup merge of #129208 - veluca93:adt_const_fix, r=BoxyUwU
Fix order of normalization and recursion in const folding.

Fixes #126831.

Without this patch, type normalization is not always idempotent, which leads to all sorts of bugs in places that assume that normalizing a normalized type does nothing.

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

r? BoxyUwU
2024-08-18 23:41:49 -05:00
Trevor Gross
f956bceb6a
Rollup merge of #129116 - Zalathar:compiler-rt, r=Mark-Simulacrum
Include a copy of `compiler-rt` source in the `download-ci-llvm` tarball

This will make it possible to experiment with allowing `download-ci-llvm` builds to build `library/profiler_builtins`, without needing to check out the `src/llvm-project` submodule.

By itself, this PR just adds the files to the tarball, but doesn't actually do anything with them. The idea is that once this is merged, it will then be much easier to proceed with work on the necessary bootstrap changes (using the real downloaded tarball), without having to rig up weird hacks to simulate downloading a modified tarball.

---

Adding these files to the compressed tarballs appears to increase its size by a negligible amount (<1 MB out of 400/800+ MB).

The uncompressed size is about 14 MB (out of 2+ GB for the whole tarball).

(The excluded test files would have been another 35 MB.)
2024-08-18 23:41:48 -05:00
Trevor Gross
582b0a6623
Rollup merge of #129048 - heiher:update-crosstool-loongarch64, r=Mark-Simulacrum
Update `crosstool-ng` for loongarch64

The current cross-compilation toolchain for the LoongArch64 target consists of GCC 13.2.0, Binutils 2.40, and Glibc 2.36. However, Binutils 2.40 has known issues that in broken binaries without any error reports:

- https://github.com/rust-lang/rust/issues/121289
- https://github.com/cross-rs/cross/issues/1538

This patch upgrades the cross-compilation toolchain for the LoongArch64 target to resolve these issues.

- GCC: 13.2.0 -> 14.2.0
- Binutils: 2.40 -> 2.42

The new binaries remain compatible with the existing GCC 13.2.0/Glibc 2.36 distribution, and no issues have been identified.

try-job: dist-loongarch64-linux
2024-08-18 23:41:48 -05:00
Trevor Gross
332ab61d29
Rollup merge of #128902 - evanj:evan.jones/env-var-doc, r=workingjubilee
doc: std::env::var: Returns None for names with '=' or NUL byte

The documentation incorrectly stated that std::env::var could return an error for variable names containing '=' or the NUL byte. Copy the correct documentation from var_os.

var_os was fixed in Commit 8a7a665, Pull Request #109894, which closed Issue #109893.

This documentation was incorrectly added in commit f2c0f292, which replaced a panic in var_os by returning None, but documented the change as "May error if ...".

Reference the specific error values and link to them.
2024-08-18 23:41:47 -05:00
Trevor Gross
5044b20028
Rollup merge of #128628 - khuey:simply-cfg-erase-source-info, r=nnethercote
When deduplicating unreachable blocks, erase the source information.

After deduplication the block conceptually belongs to multiple locations in the source. Although these blocks are unreachable, in #123341 we did come across a real side effect, an unreachable block that survives into the compiled code can cause a debugger to set a breakpoint on the wrong instruction. Erasing the source information ensures that a debugger will never be misled into thinking that the unreachable block is worth setting a breakpoint on, especially after #128627.

Technically we don't need to erase the source information if all the deduplicated blocks have identical source information, but tracking that seems like more effort than it's worth.

I'll let njn redirect this one too. r? `@nnethercote`
2024-08-18 23:41:47 -05:00
Trevor Gross
d21b6f2715
Rollup merge of #128084 - surechen:fix_125997_v1, r=cjgillot
Suggest adding Result return type for associated method in E0277.

Recommit #126515 because I messed up during rebase,

Suggest adding Result return type for associated method in E0277.

For following:

```rust
struct A;
impl A {
    fn test4(&self) {
        let mut _file = File::create("foo.txt")?;
        //~^ ERROR the `?` operator can only be used in a method
    }
```

Suggest:

```rust
impl A {
    fn test4(&self) -> Result<(), Box<dyn std::error::Error>> {
        let mut _file = File::create("foo.txt")?;
        //~^ ERROR the `?` operator can only be used in a method

    Ok(())
    }
}
```

For #125997

r? `@cjgillot`
2024-08-18 23:41:46 -05:00
Trevor Gross
f27a9b15d3
Rollup merge of #127679 - RalfJung:raw_ref_op, r=jieyouxu
Stabilize `raw_ref_op` (RFC 2582)

This stabilizes the syntax `&raw const $expr` and `&raw mut $expr`. It has existed unstably for ~4 years now, and has been exposed on stable via the `addr_of` and `addr_of_mut` macros since Rust 1.51 (released more than 3 years ago). I think it has become clear that these operations are here to stay. So it is about time we give them proper primitive syntax. This has two advantages over the macro:

- Being macros, `addr_of`/`addr_of_mut` could in theory do arbitrary magic with the expression on which they work. The only "magic" they actually do is using the argument as a place expression rather than as a value expression. Place expressions are already a subtle topic and poorly understood by many programmers; having this hidden behind a macro using unstable language features makes this even worse. Conversely, people do have an idea of what happens below `&`/`&mut`, so we can make the subtle topic a lot more approachable by connecting to existing intuition.
- The name `addr_of` is quite unfortunate from today's perspective, given that we have accepted provenance as a reality, which means that a pointer is *not* just an address. Strict provenance has a method, `addr`, which extracts the address of a pointer; using the term `addr` in two different ways is quite unfortunate. That's why this PR soft-deprecates `addr_of` -- we will wait a long time before actually showing any warning here, but we should start telling people that the "addr" part of this name is somewhat misleading, and `&raw` avoids that potential confusion.

In summary, this syntax improves developers' ability to conceptualize the operational semantics of Rust, while making a fundamental operation frequently used in unsafe code feel properly built in.

Possible questions to consider, based on the RFC and [this](https://github.com/rust-lang/rust/issues/64490#issuecomment-1163802912) great summary by `@CAD97:`

- Some questions are entirely about the semantics. The semantics are the same as with the macros so I don't think this should have any impact on this syntax PR. Still, for completeness' sake:
  - Should `&raw const *mut_ref` give a read-only pointer?
    - Tracked at: https://github.com/rust-lang/unsafe-code-guidelines/issues/257
    - I think ideally the answer is "no". Stacked Borrows says that pointer is read-only, but Tree Borrows says it is mutable.
  - What exactly does `&raw const (*ptr).field` require? Answered in [the reference](https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html): the arithmetic to compute the field offset follows the rules of `ptr::offset`, making it UB if it goes out-of-bounds. Making this a safe operation (using `wrapping_offset` rules) is considered too much of a loss for alias analysis.
- Choose a different syntax? I don't want to re-litigate the RFC. The only credible alternative that has been proposed is `&raw $place` instead of `&raw const $place`, which (IIUC) could be achieved by making `raw` a contextual keyword in a new edition. The type is named `*const T`, so the explicit `const` is consistent in that regard. `&raw expr` lacks the explicit indication of immutability. However, `&raw const expr` is quite a but longer than `addr_of!(expr)`.
- Shouldn't we have a completely new, better raw pointer type instead? Yes we all want to see that happen -- but I don't think we should block stabilization on that, given that such a nicer type is not on the horizon currently and given the issues with `addr_of!` mentioned above. (If we keep the `&raw $place` syntax free for this, we could use it in the future for that new type.)
- What about the lint the RFC talked about? It hasn't been implemented yet.  Given that the problematic code is UB with or without this stabilization, I don't think the lack of the lint should block stabilization.
  - I created an issue to track adding it: https://github.com/rust-lang/rust/issues/127724
- Other points from the "future possibilites of the RFC
  - "Syntactic sugar" extension: this has not been implemented. I'd argue this is too confusing, we should stick to what the RFC suggested and if we want to do anything about such expressions, add the lint.
  - Encouraging / requiring `&raw` in situations where references are often/definitely incorrect: this has been / is being implemented. On packed fields this already is a hard error, and for `static mut` a lint suggesting raw pointers is being rolled out.
  - Lowering of casts: this has been implemented. (It's also an invisible implementation detail.)
  - `offsetof` woes: we now have native `offset_of` so this is not relevant any more.

To be done before landing:

- [x] Suppress `unused_parens` lint around `&raw {const|mut}` expressions
  - See bottom of https://github.com/rust-lang/rust/pull/127679#issuecomment-2264073752 for rationale
  - Implementation: https://github.com/rust-lang/rust/pull/128782
- [ ] Update the Reference.
  - https://github.com/rust-lang/reference/pull/1567

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

cc `@rust-lang/lang` `@rust-lang/opsem`

try-job: x86_64-msvc
try-job: test-various
try-job: dist-various-1
try-job: armhf-gnu
try-job: aarch64-apple
2024-08-18 23:41:46 -05:00
Trevor Gross
370168787b Generate completions after version updates
Running `cargo update` changed completion output. Regenerate them here.
2024-08-18 22:52:54 -05:00
Trevor Gross
1eb1e1816d Adjust expected errors for a rustdoc test
`pulldown-cmark` has slightly different behavior between 0.11.0 and
0.11.2, causing one of the `unportable-markdown` tests to no longer emit
an error. Per [1], remove the error annotation and bless the output.

[1]: https://github.com/rust-lang/rust/pull/128722#issuecomment-2295522292
2024-08-18 22:52:54 -05:00
bors
804be74e3c Auto merge of #129228 - matthiaskrgr:oopsie, r=jieyouxu
crashes: more tests

r? `@jieyouxu`
2024-08-19 01:59:36 +00:00
Matthias Krüger
5fe70afc8c crashes: more tests 2024-08-19 00:38:28 +02:00
bors
d0293c6cf2 Auto merge of #125854 - beetrees:zst-arg-abi, r=estebank
Move ZST ABI handling to `rustc_target`

Currently, target specific handling of ZST function call ABI (specifically passing them indirectly instead of ignoring them) is handled in `rustc_ty_utils`, whereas all other target specific function call ABI handling is located in `rustc_target`. This PR moves the ZST handling to `rustc_target` so that all the target-specific function call ABI handling is in one place. In the process of doing so, this PR fixes #125850 by ensuring that ZST arguments are always correctly ignored in the x86-64 `"sysv64"` ABI; any code which would be affected by this fix would have ICEd before this PR. Tests are also added using `#[rustc_abi(debug)]` to ensure this behaviour does not regress.

Fixes #125850
2024-08-18 22:15:41 +00:00
Ben Kimock
b2dae987f8 Fixup tests 2024-08-18 17:41:01 -04:00
Ben Kimock
22ed23d680 Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
Ben Kimock
41d06f4115 Delete lldbr annotations 2024-08-18 16:59:58 -04:00
Ben Kimock
c5fdc90a73 Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
Ben Kimock
e2523c1842 Clean up compiletest 2024-08-18 16:58:26 -04:00
Ben Kimock
156088f8a8 Delete redundant gdb-version requirements and related comments 2024-08-18 16:58:25 -04:00
Ben Kimock
e93e610329 Grep for enabled and clean up those hits 2024-08-18 16:58:00 -04:00
Trevor Gross
b1b1dd17d3 Adjust licensing exceptions for WASM components
Recent versions of wasm-tools are now Apache-2.0 or MIT or Apache-2.0
with the LLVM exception, rather than strictly Apache-2.0 with the LLVM
exception. The only component with the exception has moved to a new
dependency `wasi-preview1-component-adapter-provider`.
2024-08-18 14:01:30 -05:00
Trevor Gross
7240da01ee Run cargo update with the new v2 resolver
v2 resolves some dependencies differently, and we adjusted some
dependency versions. Run `cargo update` to make sure everything is in
sync.
2024-08-18 14:00:50 -05:00
Trevor Gross
f69e74e2f5 Update some dependency versions that allow better licensing
With the new resolver, a few dependencies get brought in twice with
different licenses. For example, all dependencies from `wasm-tools`
gained Apache-2.0 and MIT options, and with the v2 resolver we were
using one version from before and one version from after this change.
This made tidy's license check difficult.

Update some minimum versions to remove duplicate dependencies and smooth
out license checking.
2024-08-18 13:59:27 -05:00
Trevor Gross
42b9cb1cb5 Switch to using the v2 resolver in most workspaces
Pinning the resolver to v1 was done in 5abff3753a ("Explicit set
workspace.resolver ...") in order to suppress warnings. Since there is
no specific reason not to use the new resolver and since it fixes
issues, change to `resolver = "2"` everywhere except library and
submodules.
2024-08-18 13:59:09 -05:00
Ralf Jung
35709be02d rename AddressOf -> RawBorrow inside the compiler 2024-08-18 19:46:53 +02:00
Ralf Jung
b8464961a2 soft-deprecate the addr_of macros 2024-08-18 19:46:53 +02:00
Ralf Jung
79503dd742 stabilize raw_ref_op 2024-08-18 19:46:53 +02:00
Ben Kimock
e1a82c9634 Delete compiletest support for gdbg 2024-08-18 12:39:07 -04:00
Ben Kimock
95ae9b8c84 Fix up a special case 2024-08-18 12:39:07 -04:00
Ben Kimock
fa0e8585d4 Replace gdbr with gdbg 2024-08-18 12:39:07 -04:00
Ben Kimock
4314661671 Delete gdbg commands 2024-08-18 12:39:06 -04:00
bors
6de928dce9 Auto merge of #126450 - madsmtm:promote-mac-catalyst, r=Mark-Simulacrum
Promote Mac Catalyst targets to Tier 2, and ship with rustup

Promote the Mac Catalyst targets `x86_64-apple-ios-macabi` and `aarch64-apple-ios-macabi` to Tier 2, as per [the MCP](https://github.com/rust-lang/compiler-team/issues/761) (see that for motivation and details).

These targets are now also distributed with rustup, although without the sanitizer runtime, as that currently has trouble building, see https://github.com/rust-lang/rust/issues/129069.
2024-08-18 15:52:58 +00:00
Evan Jones
b0023f5a41 code review improvements 2024-08-18 10:43:36 -04:00
bors
f04f6ca36d Auto merge of #129230 - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`
2024-08-18 13:05:32 +00:00
Ralf Jung
0708b289b7 fix build with bootstrap compiler 2024-08-18 13:36:11 +02:00
bors
c74ffd88cb Auto merge of #3820 - tiif:epoller, r=RalfJung
Add epollerr support

Fixes #3816

For socketpair, if the peer fd is closed while having data in its read buffer, ``EPOLLER`` will be thrown.

This is still WIP because I am currently finding a way to check if peer fd still has something in its ``readbuf`` when it is closed and add the ``EPOLLER`` flag In ``get_epoll_ready_events``.
2024-08-18 10:26:13 +00:00
tiif
483120d6ce Add EPOLLER support 2024-08-18 18:18:07 +08:00
bors
334e509912 Auto merge of #129227 - jieyouxu:no-dumping, r=Kobzol
Disable `dump-ice-to-disk` for i686-mingw (again)

To avoid blocking full CI or `i686-mingw` try jobs (failed in https://github.com/rust-lang/rust/pull/127679#issuecomment-2295184771).

At least we now have some context for why the assertion failed.

Anyone with r+ can approve this.
2024-08-18 09:47:46 +00:00
bors
93700208a8 Auto merge of #3818 - tiif:loseevents, r=RalfJung
epoll: iterate through output buffer then fetch an event from ready list

Fixes #3812
2024-08-18 09:45:00 +00:00
许杰友 Jieyou Xu (Joe)
ce7a70ade8 tests: disable dump-ice-to-disk for i686-mingw
To avoid blocking full CI.
2024-08-18 09:13:44 +00:00
tiif
6702f158fd epoll: iterate through output buffer then fetch an event from ready list 2024-08-18 17:12:57 +08:00
bors
8f2768b507 Auto merge of #3825 - RalfJung:epoll-miri, r=RalfJung
epoll test_socketpair_read: explicitly check real and Miri behavior
2024-08-18 09:09:58 +00:00
Ralf Jung
e614d7d51b epoll test_socketpair_read: explicitly check real and Miri behavior 2024-08-18 10:49:56 +02:00
bors
aea3cfd867 Auto merge of #3824 - tiif:maxeventeinval, r=RalfJung
Set EINVAL for epoll_wait maxevent value 0

Fixes #3821
2024-08-18 08:43:22 +00:00
Ralf Jung
f918de8c4a make sure we read all arguments before returning early 2024-08-18 10:41:58 +02:00
bors
7521bdaf5b Auto merge of #129225 - jieyouxu:rollup-xwtkwgr, r=jieyouxu
Rollup of 5 pull requests

Successful merges:

 - #129164 (Use `ar_archive_writer` for writing COFF import libs on all backends)
 - #129173 (Fix `is_val_statically_known` for floats)
 - #129185 (Port `run-make/libtest-json/validate_json.py` to Rust)
 - #129203 (Use cnum for extern crate data key)
 - #129221 (Remove JohnTitor from review rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-18 07:22:33 +00:00
许杰友 Jieyou Xu (Joe)
f31f0f321e
Rollup merge of #129221 - ehuss:johntitor-rotation, r=jieyouxu
Remove JohnTitor from review rotation

This removes `@JohnTitor` from the review rotation. I haven't seen any comments from them in this repository since February, and PRs that get assigned to them tend to sit a few weeks until someone notices. I see that they are still semi-active with libc, but I haven't been able to reach them on Zulip. If `@JohnTitor` wants to get back on the rotation in the future, they are welcome (I don't want to pressure them, their support in the past was much appreciated).
2024-08-18 14:55:24 +08:00