Skip to content

refactor the normalization in coerce_shared_info#158659

Open
adwinwhite wants to merge 1 commit into
rust-lang:mainfrom
adwinwhite:coerce-shared-info-norm
Open

refactor the normalization in coerce_shared_info#158659
adwinwhite wants to merge 1 commit into
rust-lang:mainfrom
adwinwhite:coerce-shared-info-norm

Conversation

@adwinwhite

@adwinwhite adwinwhite commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

This is pre-requisite of removing eq_structurally_relating_aliases which is part of #155345.

coerce_shared_info is only used in the unstable feature reborrow which provides a CoerceShared trait indicating a mutable borrow can be converted into a shared borrow.

I think using deeply_normalize is more suitable for these identity instantiated types.
No reason to allow ambiguous normalization and use infer vars as normalization result here.

r? lcnr

@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. labels Jul 1, 2026
@rust-log-analyzer

This comment has been minimized.

Comment thread compiler/rustc_hir_analysis/src/coherence/builtin.rs
@adwinwhite adwinwhite force-pushed the coerce-shared-info-norm branch from 8104ac2 to e230f7e Compare July 2, 2026 06:09
@adwinwhite adwinwhite force-pushed the coerce-shared-info-norm branch from e230f7e to 3d7f010 Compare July 2, 2026 06:48
let ty = f.ty(tcx, args).skip_norm_wip();
if ty.is_phantom_data() {
let ty = f.ty(tcx, args);
if ty.skip_normalization().is_phantom_data() {

@lcnr lcnr Jul 2, 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.

can you keep that as skip_norm_wip? I am not confident we don't want to allow <PhantomData as Id>::This here or some free type alias that normalizes to PhantomData

View changes since the review

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.

maybe even a FIXME(whatever-feature)

@@ -0,0 +1,45 @@
//@ check-pass

@lcnr lcnr Jul 2, 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.

can you add a comment explaining what this does :>

View changes since the review

@lcnr lcnr left a comment

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.

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

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants