Skip to content

Rollup of 7 pull requests#156595

Closed
JonathanBrouwer wants to merge 23 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-tm0Xan2
Closed

Rollup of 7 pull requests#156595
JonathanBrouwer wants to merge 23 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-tm0Xan2

Conversation

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

Successful merges:

r? @ghost

Create a similar rollup

aerooneqq and others added 23 commits May 14, 2026 10:53
Add lint againts invalid runtime symbol definitions

This PR adds a deny-by-default lint againts invalid runtime symbol definitions, those runtime symbols are assumed and used by `core`[^1] and `rustc` with a specific definition.

We have had multiple reports of users tripping over `std` symbols (addressed in a future PR):
 - [Why does `#[no_mangle] fn open() {}` make `cargo t` hang?](https://users.rust-lang.org/t/why-does-no-mangle-fn-open-make-cargo-t-hang/103423)
 - [Pointer becomes misaligned in test with `no_mangle`](https://users.rust-lang.org/t/pointer-becomes-misaligned-in-test-with-no-mangle/126580)

This PR is a second attempt after rust-lang#146505, where T-lang had [some reservations](rust-lang#146505 (comment)) about a blanket lint that does not check the signature, which is now done with this PR, and about linting of `std` runtime symbols when std is not linked, which this PR omits by not including any std runtime symbols (for now).

## `invalid_runtime_symbol_definitions`

*(deny-by-default)*

The `invalid_runtime_symbol_definitions` lint checks the signature of items whose symbol name is a runtime symbols expected by `core`.

### Example

```rust,compile_fail
#[unsafe(no_mangle)]
pub fn memcmp() {} // invalid definition of the `memcmp` runtime symbol
```

```text
error: invalid definition of the runtime `memcmp` symbol used by the standard library
 --> a.rs:2:1
  |
4 | fn memcmp() {}
  | ^^^^^^^^^^^
  |
  = note: expected `unsafe extern "C" fn(*const c_void, *const c_void, usize) -> i32`
          found    `fn()`
  = help: either fix the signature or remove any attributes like `#[unsafe(no_mangle)]`, `#[unsafe(export_name = "memcmp")]`, or `#[link_name = "memcmp"]`
  = note: `#[deny(invalid_runtime_symbol_definitions)]` on by default
```

### Explanation

Up-most care is required when defining runtime symbols assumed and used by the standard library. They must follow the C specification, not use any standard-library facility or undefined behavior may occur.

The symbols currently checked are `memcpy`, `memmove`, `memset`, `memcmp`, `bcmp` and `strlen`.

[^1]: https://doc.rust-lang.org/core/index.html#how-to-use-the-core-library
actually run the temp_dir doctest

No idea why this currently doesn't get run.

That said, this might fail in Miri, so we may have to wait for rust-lang/miri#5029.
…utf8-pattern, r=ChrisDenton

Require UTF-8 in `Utf8Pattern::StringPattern`

Store `&str` instead, so the UTF-8 invariant is enforced at the API boundary.

Fixes rust-lang#156491
…, r=petrochenkov

delegation: emit error when self type is not specified and accessed

This PR adds error reporting when we create error self type if it was not specified. In most of the tests there were other errors, so this delayed bug was not triggered, but there are cases like `reuse Default::default;` (rust-lang#156388) which does not emit other errors and those delayed bugs are triggered.

Part of rust-lang#118212. Fixes rust-lang#156388.

r? @petrochenkov
…=mejrs

Test EII UI tests with prefer-dynamic

Tracking issue: rust-lang#125418

Remove `no-prefer-dynamic` from the EII UI tests now that rust-lang#153648 fixed exporting EII declaration aliases from dylibs.

Fixes rust-lang#151271.

Tested with:

```sh
python3 x.py test tests/ui/eii --force-rerun
```
…i-obk

Use DropCtxt::new_block and new_block_with_statements systematically.

Misc cleanups I found while staring at that code.
…xpansion, r=Urgau

Correctly handle associated items in rustdoc macro expansion

Fixes rust-lang#156075.

The bug was simply that it didn't cover associated items.

r? @Urgau
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label May 15, 2026
@rustbot rustbot added A-compiler-builtins Area: compiler-builtins (https://github.com/rust-lang/compiler-builtins) 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. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels May 15, 2026
@JonathanBrouwer
Copy link
Copy Markdown
Contributor Author

@bors r+ rollup=never p=5

Trying commonly failed jobs
@bors try jobs=dist-various-1,test-various,x86_64-gnu-aux,x86_64-gnu-llvm-21-3,x86_64-msvc-1,aarch64-apple,x86_64-mingw-1,i686-msvc-2

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 15, 2026

📌 Commit 2572fc8 has been approved by JonathanBrouwer

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 May 15, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request May 15, 2026
Rollup of 7 pull requests


try-job: dist-various-1
try-job: test-various
try-job: x86_64-gnu-aux
try-job: x86_64-gnu-llvm-21-3
try-job: x86_64-msvc-1
try-job: aarch64-apple
try-job: x86_64-mingw-1
try-job: i686-msvc-2
@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job x86_64-gnu-llvm-21-3 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@rust-bors rust-bors Bot 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 May 15, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 15, 2026

PR #155521, which is a member of this rollup, was unapproved.

This rollup was thus unapproved.

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 15, 2026
@rust-bors rust-bors Bot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 15, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 15, 2026

💔 Test for 2f7efde failed: CI. Failed jobs:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiler-builtins Area: compiler-builtins (https://github.com/rust-lang/compiler-builtins) 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. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants