Skip to content

refactor the normalization in coerce_shared_info - #158659

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
adwinwhite:coerce-shared-info-norm
Jul 5, 2026
Merged

refactor the normalization in coerce_shared_info#158659
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
adwinwhite:coerce-shared-info-norm

Conversation

@adwinwhite

@adwinwhiteadwinwhite 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 (#145612) 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

@rustbotrustbot 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 threadcompiler/rustc_hir_analysis/src/coherence/builtin.rs
@adwinwhite
adwinwhiteforce-pushed the coerce-shared-info-norm branch 2 times, most recently from e230f7e to 3d7f010CompareJuly 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() {

@lcnrlcnrJul 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

@lcnrlcnrJul 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

@lcnrlcnr 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.

@adwinwhite
adwinwhiteforce-pushed the coerce-shared-info-norm branch from 3d7f010 to 23e6ca0CompareJuly 3, 2026 03:37
@adwinwhite

Copy link
Copy Markdown
ContributorAuthor

@bors r=lcnr rollup

@rust-bors

rust-borsBot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 23e6ca0 has been approved by lcnr

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 10. This pull request will be tested once the tree is reopened.

@rust-borsrust-borsBot 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 Jul 3, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 3, 2026
…, r=lcnr
refactor the normalization in `coerce_shared_info`
This is pre-requisite of removing `eq_structurally_relating_aliases` which is part of rust-lang#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
@jhprattjhpratt mentioned this pull request Jul 3, 2026
rust-borsBot pushed a commit that referenced this pull request Jul 5, 2026
Rollup of 18 pull requests
Successful merges:
- #158692 (Add release notes for 1.96.1)
- #134021 (Implement `IntoIterator` for `[&[mut]] Box<[T; N], A>`)
- #152860 (Port the `without_debuginfo` test from `backtrace-rs` to the testsuite)
- #155932 (MIR Call terminator: evaluate destination place before arguments)
- #156777 (Add -Zautodiff_post_passes flag to limit which llvm passes to run after enzyme to make autodiff tests more robust)
- #157151 (JSON target specs: remove 'x86-softfloat' compatibility alias)
- #157835 (expand free alias types in the auto-trait orphan check)
- #158377 (add `-Zforce-intrinsic-fallback` flag)
- #158434 (delegation: refactor AST -> HIR lowering)
- #158552 (make some tidy errors around python easier to understand)
- #158624 (borrowck: Introduce BlameConstraint::to_obligation_cause_from_path())
- #158704 (Optimize `ArrayChunks::try_rfold` with `DoubleEndedIterator::next_chunk_back`)
- #158711 (library: Comment on libtest's dicey internal soundness)
- #158539 (Move `SizeHint` and `IoHandle` to `core::io`)
- #158659 (refactor the normalization in `coerce_shared_info`)
- #158689 (resolver: don't use `Finalize` when resolving visibilities during AST expansion)
- #158698 (Update TypeVisitable implementation)
- #158706 (Tweaks to MIR building scope API)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 5, 2026
…, r=lcnr
refactor the normalization in `coerce_shared_info`
This is pre-requisite of removing `eq_structurally_relating_aliases` which is part of rust-lang#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
rust-borsBot pushed a commit that referenced this pull request Jul 5, 2026
…uwer
Rollup of 20 pull requests
Successful merges:
- #158692 (Add release notes for 1.96.1)
- #134021 (Implement `IntoIterator` for `[&[mut]] Box<[T; N], A>`)
- #155932 (MIR Call terminator: evaluate destination place before arguments)
- #155989 (Update `transmute_copy` to ub_checks and `?Sized`)
- #156777 (Add -Zautodiff_post_passes flag to limit which llvm passes to run after enzyme to make autodiff tests more robust)
- #157151 (JSON target specs: remove 'x86-softfloat' compatibility alias)
- #157835 (expand free alias types in the auto-trait orphan check)
- #157857 (Stabilize `#[my_macro] mod foo;` (part of `proc_macro_hygiene`))
- #158377 (add `-Zforce-intrinsic-fallback` flag)
- #158434 (delegation: refactor AST -> HIR lowering)
- #158552 (make some tidy errors around python easier to understand)
- #158624 (borrowck: Introduce BlameConstraint::to_obligation_cause_from_path())
- #158704 (Optimize `ArrayChunks::try_rfold` with `DoubleEndedIterator::next_chunk_back`)
- #158711 (library: Comment on libtest's dicey internal soundness)
- #158751 (rustdoc: Fix crash when trying to inline foreign item which cannot have attributes)
- #158539 (Move `SizeHint` and `IoHandle` to `core::io`)
- #158659 (refactor the normalization in `coerce_shared_info`)
- #158689 (resolver: don't use `Finalize` when resolving visibilities during AST expansion)
- #158698 (Update TypeVisitable implementation)
- #158706 (Tweaks to MIR building scope API)
rust-borsBot pushed a commit that referenced this pull request Jul 5, 2026
…uwer
Rollup of 19 pull requests
Successful merges:
- #158692 (Add release notes for 1.96.1)
- #134021 (Implement `IntoIterator` for `[&[mut]] Box<[T; N], A>`)
- #155932 (MIR Call terminator: evaluate destination place before arguments)
- #155989 (Update `transmute_copy` to ub_checks and `?Sized`)
- #156777 (Add -Zautodiff_post_passes flag to limit which llvm passes to run after enzyme to make autodiff tests more robust)
- #157151 (JSON target specs: remove 'x86-softfloat' compatibility alias)
- #157835 (expand free alias types in the auto-trait orphan check)
- #157857 (Stabilize `#[my_macro] mod foo;` (part of `proc_macro_hygiene`))
- #158434 (delegation: refactor AST -> HIR lowering)
- #158552 (make some tidy errors around python easier to understand)
- #158624 (borrowck: Introduce BlameConstraint::to_obligation_cause_from_path())
- #158704 (Optimize `ArrayChunks::try_rfold` with `DoubleEndedIterator::next_chunk_back`)
- #158711 (library: Comment on libtest's dicey internal soundness)
- #158751 (rustdoc: Fix crash when trying to inline foreign item which cannot have attributes)
- #158539 (Move `SizeHint` and `IoHandle` to `core::io`)
- #158659 (refactor the normalization in `coerce_shared_info`)
- #158689 (resolver: don't use `Finalize` when resolving visibilities during AST expansion)
- #158698 (Update TypeVisitable implementation)
- #158706 (Tweaks to MIR building scope API)
@rust-bors
rust-borsBot merged commit b820b48 into rust-lang:mainJul 5, 2026
13 checks passed
@rustbotrustbot added this to the 1.98.0 milestone Jul 5, 2026
rust-timer added a commit that referenced this pull request Jul 5, 2026
Rollup merge of #158659 - adwinwhite:coerce-shared-info-norm, r=lcnr
refactor the normalization in `coerce_shared_info`
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
@theemathastheemathas modified the milestones: 1.98.0, 1.99.0Jul 6, 2026
pullBot pushed a commit to xtqqczze/rust-lang-miri that referenced this pull request Jul 6, 2026
…uwer
Rollup of 19 pull requests
Successful merges:
- rust-lang/rust#158692 (Add release notes for 1.96.1)
- rust-lang/rust#134021 (Implement `IntoIterator` for `[&[mut]] Box<[T; N], A>`)
- rust-lang/rust#155932 (MIR Call terminator: evaluate destination place before arguments)
- rust-lang/rust#155989 (Update `transmute_copy` to ub_checks and `?Sized`)
- rust-lang/rust#156777 (Add -Zautodiff_post_passes flag to limit which llvm passes to run after enzyme to make autodiff tests more robust)
- rust-lang/rust#157151 (JSON target specs: remove 'x86-softfloat' compatibility alias)
- rust-lang/rust#157835 (expand free alias types in the auto-trait orphan check)
- rust-lang/rust#157857 (Stabilize `#[my_macro] mod foo;` (part of `proc_macro_hygiene`))
- rust-lang/rust#158434 (delegation: refactor AST -> HIR lowering)
- rust-lang/rust#158552 (make some tidy errors around python easier to understand)
- rust-lang/rust#158624 (borrowck: Introduce BlameConstraint::to_obligation_cause_from_path())
- rust-lang/rust#158704 (Optimize `ArrayChunks::try_rfold` with `DoubleEndedIterator::next_chunk_back`)
- rust-lang/rust#158711 (library: Comment on libtest's dicey internal soundness)
- rust-lang/rust#158751 (rustdoc: Fix crash when trying to inline foreign item which cannot have attributes)
- rust-lang/rust#158539 (Move `SizeHint` and `IoHandle` to `core::io`)
- rust-lang/rust#158659 (refactor the normalization in `coerce_shared_info`)
- rust-lang/rust#158689 (resolver: don't use `Finalize` when resolving visibilities during AST expansion)
- rust-lang/rust#158698 (Update TypeVisitable implementation)
- rust-lang/rust#158706 (Tweaks to MIR building scope API)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

5 participants

@adwinwhite@rust-log-analyzer@lcnr@theemathas@rustbot