Skip to content

Rollup of 14 pull requests #140321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 33 commits into from
Closed

Conversation

jhpratt
Copy link
Member

@jhpratt jhpratt commented Apr 26, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

m-ou-se and others added 30 commits April 15, 2025 17:29
This commit updates the vendored `wasm-component-ld` binary to 0.5.13
which includes some various bug fixes and new feature updates for
upcoming component model features coming down the pike. Not expected to
break any existing workflows, just a normal update.
On Windows, if creating a temporary directory fails with permission denied then use a retry/backoff loop. This hopefully fixes a recuring error in our CI.
Note that `NonZero` support is not wired up, as the author encountered
bugs while attempting this. A future commit will wire up `NonZero`
support.
… r=jdonszelmann,traviscross

Implement a lint for implicit autoref of raw pointer dereference - take 2

*[t-lang nomination comment](rust-lang#123239 (comment)

This PR aims at implementing a lint for implicit autoref of raw pointer dereference, it is based on rust-lang#103735 with suggestion and improvements from rust-lang#103735 (comment).

The goal is to catch cases like this, where the user probably doesn't realise it just created a reference.

```rust
pub struct Test {
    data: [u8],
}

pub fn test_len(t: *const Test) -> usize {
    unsafe { (*t).data.len() }  // this calls <[T]>::len(&self)
}
```

Since rust-lang#103735 already went 2 times through T-lang, where they T-lang ended-up asking for a more restricted version (which is what this PR does), I would prefer this PR to be reviewed first before re-nominating it for T-lang.

----

Compared to the PR it is as based on, this PR adds 3 restrictions on the outer most expression, which must either be:
   1. A deref followed by any non-deref place projection (that intermediate deref will typically be auto-inserted)
   2. A method call annotated with `#[rustc_no_implicit_refs]`.
   3. A deref followed by a `addr_of!` or `addr_of_mut!`. See bottom of post for details.

There are several points that are not 100% clear to me when implementing the modifications:
 - ~~"4. Any number of automatically inserted deref/derefmut calls." I as never able to trigger this. Am I missing something?~~ Fixed
 - Are "index" and "field" enough?

----

cc `@JakobDegen` `@WaffleLapkin`
r? `@RalfJung`
…location, r=tgross35

Stabilize proc_macro::Span::{start,end,line,column}.

This stabilizes part of rust-lang#54725

Specifically, the part related to getting the location of a span:

```rust
impl Span {
    pub fn start(&self) -> Span; // Empty span at the start of this span
    pub fn end(&self) -> Span; // Empty span at the end of this span

    pub fn line(&self) -> usize; // Line where the span starts
    pub fn column(&self) -> usize; // Column where the span starts
}
```

History of this part of the API:

Originally, `start` and `end` returned a `LineColumn` struct (containing the line and column).

This has been simplified/changed:

- No more `LineColumn`: `Span` now directly has `.line()` and `.column()` methods. This means we can easily add `.byte_offset()` or `.byte_range()` in the future if we want to.
- `Span::start()` and `Span::end()` are now the equivalent of rustc's internal `shrink_to_lo()` and `shrink_to_hi()`. This means you can do e.g. `span.end().column()`, removing the need for a `span.end_column()` or similar.
If creating a temporary directory fails with permission denied then retry with backoff

On Windows, if creating a temporary directory fails with permission denied then use a retry/backoff loop. This hopefully fixes a recuring error in our CI.

cc ``@jieyouxu,`` rust-lang#133959
…o, r=jswrenn

transmutability: Support char, NonZeroXxx

Note that `NonZero` support is not wired up, as the author encountered
bugs while attempting this. A future commit will wire up `NonZero`
support.

r? `@jswrenn`
Document that "extern blocks must be unsafe" in Rust 2024

The [documentation on `extern`](https://doc.rust-lang.org/std/keyword.extern.html) contains the following code sample:
```rust
#[link(name = "my_c_library")]
extern "C" {
    fn my_c_function(x: i32) -> bool;
}
```

Due to rust-lang#123743, attempting to compile such code with the 2024 edition of Rust fails:
```
error: extern blocks must be unsafe
```

This PR extends the `extern` documentation with a brief explanation of the new requirement. It also adds the missing `unsafe` keyword to the code sample, which should be compatible with rustc since v1.82.

**Related docs:**
- https://doc.rust-lang.org/reference/items/external-blocks.html
- https://doc.rust-lang.org/edition-guide/rust-2024/unsafe-extern.html
…ng, r=fmease

Fix detection of main function if there are expressions around it

Fixes rust-lang#140162.
Fixes rust-lang#139651.

Once this is merged, we can backport and I'll send a follow-up to emit a warning in case a `main` function is about to be "wrapped" (and therefore not run).

r? ``@fmease``
…-ld, r=jieyouxu

Update wasm-component-ld to 0.5.13

This commit updates the vendored `wasm-component-ld` binary to 0.5.13 which includes some various bug fixes and new feature updates for upcoming component model features coming down the pike. Not expected to break any existing workflows, just a normal update.
…ter, r=cuviper

Add XtensaAsmPrinter

See rust-lang#133601. The PR was closed because it required LLVM 19 in CI added with (rust-lang@12167d7)
Improve error message for `||` (or) in let chains

**Description**

This PR improves the error message when using `||` in an if let chain expression, addressing rust-lang#140263.

**Changes**

1. Creates a dedicated error message specifically for `||` usage in let chains
2. Points the primary span directly at the `||` operator
3. Removes confusing secondary notes about "let statements" and unsupported contexts
5. Adds UI tests verifying the new error message and valid cases

**Before**
```rust
error: expected expression, found let statement
 --> src/main.rs:2:8
  |
2 |     if let true = true || false {}
  |        ^^^^^^^^^^^^^^^
  |
  = note: only supported directly in conditions of if and while expressions
note: || operators are not supported in let chain expressions
 --> src/main.rs:2:24
  |
2 |     if let true = true || false {}
  |
```

**After**
```rust
error: `||` operators are not supported in let chain conditions
 --> src/main.rs:2:24
  |
2 |     if let true = true || false {}
  |                        ^^
```

**Implementation details**
1. Added new `OrInLetChain` diagnostic in errors.rs

2. Modified `CondChecker` in expr.rs to prioritize the `||` error

3. Updated fluent message definitions to use clearer wording

**Related issue**
Fixes rust-lang#140263

cc ``@ehuss`` (issue author)
…lcnr

Move inline asm check to typeck, properly handle aliases

Pull `InlineAsmCtxt` down to `rustc_hir_typeck`, and instead of using things like `Ty::is_copy`, use the `InferCtxt`-aware methods. To fix rust-lang/trait-system-refactor-initiative#189, we also add a `try_structurally_resolve_*` call to `expr_ty`.

r? lcnr
Track per-obligation recursion depth only if there is inference in the new solver

Track how many times an obligation has been processed in the fulfillment context by reusing its recursion depth, and only overflow if a singular (root) goal hits the limit.

This also fixes a (probably theoretical at this point) problem where we don't detect pseudo-hangs across `select_where_possible` calls.

fixes rust-lang/trait-system-refactor-initiative#186

r? lcnr
jhpratt added 3 commits April 25, 2025 22:55
…r-errors

handle specialization in the new trait solver

fixes rust-lang/trait-system-refactor-initiative#187
also fixes the regression in `plonky2_field` from rust-lang/trait-system-refactor-initiative#188

cc rust-lang#111994

r? ``@compiler-errors``
stall generator witness obligations: add regression test

fixes rust-lang/trait-system-refactor-initiative#180

r? ``@compiler-errors``
Remove redundant check

We still check for `rustc_on_unimplemented` on implementations, but this functionality was removed in rust-lang#139091, since then it always returns `Ok` when called with a non-trait defid.

https://github.com/rust-lang/rust/blob/b4c8b0c3f0533bb342a4873ff59bdad3883ab8e3/compiler/rustc_trait_selection/src/error_reporting/traits/on_unimplemented.rs#L557-L564
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) rollup A PR which is a rollup labels Apr 26, 2025
@jhpratt
Copy link
Member Author

jhpratt commented Apr 26, 2025

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented Apr 26, 2025

📌 Commit 9efd1d8 has been approved by jhpratt

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 26, 2025
@matthiaskrgr
Copy link
Member

this contains #140315 which failed already 🙃
@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 26, 2025
@jhpratt jhpratt closed this Apr 26, 2025
@jhpratt jhpratt deleted the rollup-ni3qypv branch April 26, 2025 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) rollup A PR which is a rollup S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.