Skip to content

Check item bounds for projection clause wellformedness #150662

Draft
adwinwhite wants to merge 1 commit intorust-lang:mainfrom
adwinwhite:check-item-bounds
Draft

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

Conversation

@adwinwhite
Copy link
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
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
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
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>
{}

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

Labels

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

5 participants