Skip to content

Check item bounds for projection clause wellformedness #150662

Draft
adwinwhite wants to merge 2 commits intorust-lang:mainfrom
adwinwhite:check-item-bounds
Draft

Check item bounds for projection clause wellformedness #150662
adwinwhite wants to merge 2 commits intorust-lang:mainfrom
adwinwhite:check-item-bounds

Conversation

@adwinwhite
Copy link
Copy Markdown
Contributor

@adwinwhite adwinwhite commented Jan 4, 2026

Experiment for #149283.
There're some fatal regressions.
Preparing to run crater to find out the range of breakages.

r? @ghost

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

This comment has been minimized.

@fmease fmease added the T-types Relevant to the types team, which will review and decide on the PR/issue. label Jan 4, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Jan 13, 2026

☔ The latest upstream changes (presumably #150844) made this pull request unmergeable. Please resolve the merge conflicts.

region_mapping: FxHashMap<ty::Region<'tcx>, ty::Region<'tcx>>,
const_mapping: FxHashMap<ty::Const<'tcx>, ty::Const<'tcx>>,
}
impl<'tcx> PredicateArgFolder<'tcx> {
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.

how does this folder differ from whatever.instantiate(projection.projection_term.args)? 🤔

Copy link
Copy Markdown
Contributor Author

@adwinwhite adwinwhite Jan 21, 2026

Choose a reason for hiding this comment

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

This folder additionally maps identity projection alias to the rhs type of the projection: Self::Assoc -> projection.term. It's needed to apply the item bounds on projection.term.

E.g.

trait Trait<T> {
    type Assoc: Bound<T>;
}

fn function<T, U, I>()
where 
    // We need to transform `Self::Assoc: Bound<T>` into `U: Bound<I>`.
    // With instantiating alone, the result would be `T::Assoc: Bound<I>`, which is pointless 
    // as `AliasBound` candidate already covers this.
    T: Trait<I, Assoc = U>
{}

@rust-bors

This comment has been minimized.

@adwinwhite
Copy link
Copy Markdown
Contributor Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 31, 2026
Check item bounds for projection clause wellformedness
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 31, 2026

☀️ Try build successful (CI)
Build commit: b6bca0d (b6bca0d7327839b5e3f7a7779947cb9113d08917, parent: 08cd08fbef8c6663b052d8d9e4930d5696cbb8a7)

@adwinwhite
Copy link
Copy Markdown
Contributor Author

@craterbot run name=150662-leaf mode=check-only start=master#08cd08fbef8c6663b052d8d9e4930d5696cbb8a7 end=try#b6bca0d7327839b5e3f7a7779947cb9113d08917+rustflags=-Zstrict-projection-item-bounds

@craterbot
Copy link
Copy Markdown
Collaborator

👌 Experiment 150662-leaf created and queued.
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-crater Status: Waiting on a crater run to be completed. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types 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.

6 participants