Skip to content

Fix transmutability type mismatch bug - #163946

Merged
rust-bors[bot] merged 24 commits into
rust-lang:mainfrom
lsunsi:next-transmute
Oct 12, 2026
Merged

rust-bors[bot] merged 24 commits into
rust-lang:mainfrom
lsunsi:next-transmute

Conversation

@lsunsi

@lsunsi lsunsi commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

View all comments

Fixes #161251

r? @ShoyuVanilla

The change was done as instructed by @ShoyuVanilla and @lcnr on Zulip.
There are some leftover questions I'll add as comments (self review).
But the original examples are both fixed.

@rustbot

rustbot commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@rustbot rustbot added 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Oct 7, 2026
@rustbot

rustbot commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

ShoyuVanilla is currently at their maximum review capacity.
They may take a while to respond.

Comment thread compiler/rustc_next_trait_solver/src/solve/trait_goals.rs Outdated
Comment thread compiler/rustc_next_trait_solver/Cargo.toml Outdated
Comment thread compiler/rustc_next_trait_solver/src/solve/mod.rs Outdated
Comment thread compiler/rustc_next_trait_solver/src/solve/trait_goals.rs Outdated
@rust-log-analyzer

This comment has been minimized.

Comment thread compiler/rustc_next_trait_solver/src/solve/trait_goals.rs Outdated
Comment thread compiler/rustc_next_trait_solver/src/solve/mod.rs Outdated
Comment thread compiler/rustc_next_trait_solver/src/solve/mod.rs
Comment thread compiler/rustc_middle/src/ty/mod.rs Outdated
Comment thread compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs Outdated
Comment thread compiler/rustc_next_trait_solver/src/solve/trait_goals.rs Outdated
Comment thread compiler/rustc_trait_selection/src/solve/delegate.rs Outdated
Comment thread tests/ui/transmutability/vec-recycle-next-solver.rs
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Comment thread compiler/rustc_next_trait_solver/Cargo.toml Outdated
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@ [next] compile-flags: -Znext-solver
//@ check-fail

@lcnr lcnr Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what 'that' exactly?
if you're referring to the revisions and check fail added to this test, I think I just added it to all transmute. does it not make sense in this one? is it because it's a rustfix test?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed this test this while reviewing 😅 I think it would be great if we have why we need this test and what this test is for. (Not just for this one but all the new ones we add) If we already have a related issue or discussion that explains it well, just adding a link to it would be enough

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, definitely! But since I'm not adding the test itself (the file was already there), I can't tell exactly what it is for. I'll look into the original commit and try to figure out.

Also I'll add links or comments to the other ones

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new tests are these four:

So considering 3 of the 4 tests are doc tests already, do you think it's best to remove them?
The third one is the one we discussed before, about testing the "add_goals", so I think it's worth keeping (and it's already commented explaining this).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally asked about "//@ check-fail", that is unnecessary I think

I would not add the two doc tests

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, because check-fail is the default right?
I thought explicit would be better, but I'll remove since it's implied.

@ShoyuVanilla what do you think, keep or drop tests/ui/transmutability/pointer-aligned-to-next-solver.rs and tests/ui/transmutability/transmute-from-next-solver.rs?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah dropping doc tests sgmt

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lcnr @ShoyuVanilla removed both and removed the directive 13694b6

thanks for the feedbacks (:

@lcnr

lcnr commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

@bors delegate+

@rust-bors

rust-bors Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

✌️ @lsunsi, you can now approve this pull request!

If @lcnr told you to "r=me" after making some further change, then please make that change and post @bors r=lcnr.

View changes since this delegation.

@ShoyuVanilla

Copy link
Copy Markdown
Member

@bors r=lcnr,ShoyuVanilla rollup

@rust-bors

rust-bors Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 13694b6 has been approved by lcnr,ShoyuVanilla

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 Oct 12, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 12, 2026
…uVanilla

Fix transmutability type mismatch bug

Fixes rust-lang#161251

r? @ShoyuVanilla

The change was done as instructed by @ShoyuVanilla and @lcnr on Zulip.
There are some leftover questions I'll add as comments (self review).
But the original examples are both fixed.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 12, 2026
…uVanilla

Fix transmutability type mismatch bug

Fixes rust-lang#161251

r? @ShoyuVanilla

The change was done as instructed by @ShoyuVanilla and @lcnr on Zulip.
There are some leftover questions I'll add as comments (self review).
But the original examples are both fixed.
rust-bors Bot pushed a commit that referenced this pull request Oct 12, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #164196 (`rust-analyzer` subtree update)
 - #164037 (Restrict application of optimization attributes from instance)
 - #164201 (Improve `--bless` output for `tests/debuginfo`)
 - #164202 ([rustdoc] Move the creation of `IndividualTestOptions` into the test runner closure to ensure the temporary folder is removed right after the test is done running)
 - #162140 (fn_addr_eq: we actually can guarantee basically nothing)
 - #163946 (Fix transmutability type mismatch bug)
 - #163978 (Copy over some methods from At to InferCtxt)
 - #164045 (-Zassumptions-on-binders: replace region vars with bound vars when handling alias outlives')
@rust-bors
rust-bors Bot merged commit cee2a0d into rust-lang:main Oct 12, 2026
14 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 12, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 12, 2026
Rollup merge of #163946 - lsunsi:next-transmute, r=lcnr,ShoyuVanilla

Fix transmutability type mismatch bug

Fixes #161251

r? @ShoyuVanilla

The change was done as instructed by @ShoyuVanilla and @lcnr on Zulip.
There are some leftover questions I'll add as comments (self review).
But the original examples are both fixed.
@lsunsi
lsunsi deleted the next-transmute branch October 12, 2026 20:07
@lcnr

lcnr commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

@lsunsi does this fix the issues added in #163946?

@lsunsi

lsunsi commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

@lcnr do you mean #161251? If so, yes, it fixes it.

@lcnr

lcnr commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

yikes xd, I meant #149228 😅

@lsunsi

lsunsi commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

@lcnr ./x test tests/ui/transmutability/transmutability-coherence.rs --compare-mode next-solver

The test added in #149228 passes cleanly on compare mode.
I'm not sure why the current PR is equivalent to the referred change, but it seems to be.

Do you want me to open a PR with just the new test? Or maybe just close the PR directly?

@lcnr

lcnr commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

please add these tests in a separate PR, yeah 😊

@lsunsi

lsunsi commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor Author

@lcnr here we go #164257 (:

EDIT: forgot to assign you as reviewer. should be a trivial approve, should I re-assign you?

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 13, 2026
Add transmutability test to cover for superseded PR

Adds a test present in rust-lang#149228
that was fixed by rust-lang#163946.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 13, 2026
Add transmutability test to cover for superseded PR

Adds a test present in rust-lang#149228
that was fixed by rust-lang#163946.
rust-bors Bot pushed a commit that referenced this pull request Oct 14, 2026
Rollup merge of #164257 - lsunsi:pull149228, r=ShoyuVanilla

Add transmutability test to cover for superseded PR

Adds a test present in #149228
that was fixed by #163946.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler 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.

-Znext-solver=globally breaks TransmuteFrom<&T>

5 participants