Skip to content

Rustup#16866

Merged
flip1995 merged 28 commits intorust-lang:masterfrom
flip1995:rustup
Apr 16, 2026
Merged

Rustup#16866
flip1995 merged 28 commits intorust-lang:masterfrom
flip1995:rustup

Conversation

@flip1995
Copy link
Copy Markdown
Member

r? @ghost

changelog: none

m4rch3n1ng and others added 28 commits March 31, 2026 21:32
also removes E0452 and splits
`tests/rustdoc-ui/lints/renamed-lint-still-applies` into 2 tests

this is because of delayed warn lint being lost on compiler aborting on
error
Use fine grained component-wise span tracking in use trees

This often produces nicer spans and even doesn't need a Span field anymore (not that I expect the unused field to affect any perf, but still neat).
…kin,Kivooeo

renaming method is_impl_trait to is_opaque

Completing one of the tasks mentioned in this issue: rust-lang/rust#154941

r? @WaffleLapkin
The regressions are documented in the PR comments.
This reverts commit 2972b5e, reversing changes made to f908263.
Add suggestion to `.to_owned()` used on `Cow` when borrowing

fixes rust-lang/rust#144792
supersedes rust-lang/rust#144925 with the review comments addressed

the tests suggested from @Kivooeo from rust-lang/rust#144925 (comment) didn't work entirely, because these tests failed due to error `[E0308]` mismatched types, which actually already provides a suggestion, that actually makes the code compile:

```
$ cargo check
error[E0308]: mismatched types
 --> src/main.rs:3:5
  |
1 | fn test_cow_suggestion() -> String {
  |                             ------ expected `std::string::String` because of return type
2 |     let os_string = std::ffi::OsString::from("test");
3 |     os_string.to_string_lossy().to_owned()
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `String`, found `Cow<'_, str>`
  |
  = note: expected struct `std::string::String`
               found enum `std::borrow::Cow<'_, str>`
help: try using a conversion method
  |
3 |     os_string.to_string_lossy().to_owned().to_string()
  |                                           ++++++++++++
```

now this suggestion is of course not good or efficient code, but via clippy with `-Wclippy::nursery` lint group you can actually get to the correct code, so i don't think this is too much of an issue:

<details>
<summary>the clippy suggestions</summary>

```
$ cargo clippy -- -Wclippy::nursery
warning: this `to_owned` call clones the `Cow<'_, str>` itself and does not cause its contents to become owned
 --> src/main.rs:3:5
  |
3 |     os_string.to_string_lossy().to_owned().to_string()
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/beta/index.html#suspicious_to_owned
  = note: `#[warn(clippy::suspicious_to_owned)]` on by default
help: depending on intent, either make the `Cow` an `Owned` variant
  |
3 |     os_string.to_string_lossy().into_owned().to_string()
  |                                 ++
help: or clone the `Cow` itself
  |
3 -     os_string.to_string_lossy().to_owned().to_string()
3 +     os_string.to_string_lossy().clone().to_string()
  |
$ # apply first suggestion
$ cargo c -- -Wclippy::nursery
warning: redundant clone
 --> src/main.rs:3:45
  |
3 |     os_string.to_string_lossy().into_owned().to_string()
  |                                             ^^^^^^^^^^^^ help: remove this
  |
note: this value is dropped without further use
 --> src/main.rs:3:5
  |
3 |     os_string.to_string_lossy().into_owned().to_string()
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  = help: for further information visit https://rust-lang.github.io/rust-clippy/beta/index.html#redundant_clone
  = note: `-W clippy::redundant-clone` implied by `-W clippy::nursery`
  = help: to override `-W clippy::nursery` add `#[allow(clippy::redundant_clone)]`
```

</details>

the actual error that we are looking for is error `[E0515]`, cannot return value referencing local variable, which was only present in the original issue due to automatic type inference assuming you want to return a cloned `Cow<'_, str>`, which is of course not possible. this is why i took the original test functions and turned them into closures, where it's less obvious that it's trying to return the wrong type.

r? davidtwco

(because you reviewed the last attempt)
(also, let me know if i should squash this down to one commit and add myself as the co-contributor)
…uwer

Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#152901 (Introduce a `#[diagnostic::on_unknown]` attribute)
 - rust-lang/rust#155078 (Reject dangling attributes in where clauses)
 - rust-lang/rust#154449 (Invert dependency between `rustc_errors` and `rustc_abi`.)
 - rust-lang/rust#154646 (Add suggestion to `.to_owned()` used on `Cow` when borrowing)
 - rust-lang/rust#154993 (compiletest: pass -Zunstable-options for unpretty and no-codegen paths)
 - rust-lang/rust#155097 (Make `rustc_attr_parsing::SharedContext::emit_lint` take a `MultiSpan` instead of a `Span`)
…pratt,Urgau

Semantic checks of `impl` restrictions

This PR implements semantic checks for `impl` restrictions proposed in the [Restrictions RFC](https://rust-lang.github.io/rfcs/3323-restrictions.html) (Tracking Issue rust-lang/rust#105077), and linked to a [GSOC idea/proposal](https://github.com/rust-lang/google-summer-of-code/tree/142433eb3b104b2f32bae0b9dfafb78a0a2ac579?tab=readme-ov-file#implementing-impl-and-mut-restrictions).

It lowers the resolved paths of `impl` restrictions from the AST to HIR and into `TraitDef`, and integrates the checks into the coherence phase by extending `check_impl`. As parsing (rust-lang/rust#152943) and path resolution (rust-lang/rust#153556) have already been implemented, this PR provides a working implementation of `impl` restrictions.

r? @Urgau
cc @jhpratt
update thin-vec

With thin-vec v0.2.15 released, copy-pasted implementation of ExtractIf can be removed.
…mann

Implement EII for statics

This PR implements EII for statics. I've tried to mirror the implementation for functions in a few places, this causes some duplicate code but I'm also not really sure whether there's a clean way to merge the implementations.

This does not implement defaults for static EIIs yet, I will do that in a followup PR
…uwer

Rollup of 19 pull requests

Successful merges:

 - rust-lang/rust#155162 (relnotes for 1.95)
 - rust-lang/rust#140763 (Change codegen of LLVM intrinsics to be name-based, and add llvm linkage support for `bf16(xN)` and `i1xN`)
 - rust-lang/rust#153604 (Fix thread::available_parallelism on WASI targets with threads)
 - rust-lang/rust#154193 (Implement EII for statics)
 - rust-lang/rust#154389 (Add more robust handling of nested query cycles)
 - rust-lang/rust#154435 (resolve: Some import resolution cleanups)
 - rust-lang/rust#155236 (Normalize individual predicate of `InstantiatedPredicates` inside `predicates_for_generics`)
 - rust-lang/rust#155243 (cg_ssa: transmute between scalable vectors)
 - rust-lang/rust#153941 (tests/debuginfo/basic-stepping.rs: Explain why all lines are not steppable)
 - rust-lang/rust#154587 (Add --verbose-run-make-subprocess-output flag to suppress verbose run-make output for passing tests)
 - rust-lang/rust#154624 (Make `DerefPure` dyn-incompatible)
 - rust-lang/rust#154929 (Add `const Default` impls for `LazyCell` and `LazyLock`)
 - rust-lang/rust#154944 (Small refactor of `arena_cache` query values)
 - rust-lang/rust#155055 (UI automation)
 - rust-lang/rust#155062 (Move tests from `tests/ui/issues/` to appropriate directories)
 - rust-lang/rust#155131 (Stabilize feature `uint_bit_width`)
 - rust-lang/rust#155147 (Stabilize feature `int_lowest_highest_one`)
 - rust-lang/rust#155174 (Improve emission of `UnknownDiagnosticAttribute` lint)
 - rust-lang/rust#155194 (Fix manpage version replacement and use verbose version)
Start using pattern types in libcore



cc rust-lang/rust#135996

Replaces the innards of `NonNull` with `*const T is !null`.

This does affect LLVM's optimizations, as now reading the field preserves the metadata that the field is not null, and transmuting to another type (e.g. just a raw pointer), will also preserve that information for optimizations. This can cause LLVM opts to do more work, but it's not guaranteed to produce better machine code.

Once we also remove all uses of rustc_layout_scalar_range_start from rustc itself, we can remove the support for that attribute entirely and handle all such needs via pattern types
Post-attribute ports cleanup pt. 1 (again)

This is a re-implementation of most (but not all) of rust-lang/rust#154808

The code is the same as in that PR, other than a few changes, I'll leave comments where I changed things.
I did re-implement most of the commits rather than cherry-picking, so it's probably good to check the entire diff regardless

r? @jdonszelmann
@flip1995 flip1995 self-assigned this Apr 16, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Apr 16, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 16, 2026

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

@flip1995 flip1995 enabled auto-merge April 16, 2026 17:16
@flip1995 flip1995 added this pull request to the merge queue Apr 16, 2026
@github-actions
Copy link
Copy Markdown

Merged via the queue into rust-lang:master with commit f6d3106 Apr 16, 2026
11 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Apr 16, 2026
@flip1995 flip1995 deleted the rustup branch April 16, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.