Skip to content

Conversation

@Jamesbarford
Copy link
Contributor

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 Dec 22, 2025
@rust-log-analyzer

This comment has been minimized.

@Jamesbarford Jamesbarford force-pushed the chore/refactor-struct-placeholder-pt2 branch from 753b92c to 2077c6b Compare December 30, 2025 08:41
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@lcnr
Copy link
Contributor

lcnr commented Jan 5, 2026

The reason HashStable isn't implemented is kinda stupid.

HashStable_NoContext is a "perfect derive", i.e. we simply add where-clauses that each field implements the trait. This means the derive for BoundRegionKind adds I::DefId: HasHStable<CTX> and I::Symbol: HashStable<CTX>. These are then considered to not hold in the manual impl. Though tbf, I don't get why the manual impl exists at all.

Try to replace the manual impl with a derive and see if anything breaks. If it does break, add I::DefId: HashStable<CTX> and I::Symbol: HashStable<CTX> to the manual impl

@Jamesbarford Jamesbarford force-pushed the chore/refactor-struct-placeholder-pt2 branch from d262f5c to d36238d Compare January 13, 2026 11:42
@rust-log-analyzer

This comment has been minimized.

@Jamesbarford Jamesbarford force-pushed the chore/refactor-struct-placeholder-pt2 branch from d36238d to a03a907 Compare January 13, 2026 13:29
@rust-log-analyzer

This comment has been minimized.

@Jamesbarford Jamesbarford force-pushed the chore/refactor-struct-placeholder-pt2 branch from a03a907 to b4de573 Compare January 15, 2026 14:43
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Jamesbarford Jamesbarford force-pushed the chore/refactor-struct-placeholder-pt2 branch from 044bbd5 to cdff0b9 Compare January 19, 2026 12:01
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@lcnr
Copy link
Contributor

lcnr commented Jan 24, 2026

please cleanup the changes + commit history and make this ready for review 😊 thank you for working on this

@Jamesbarford Jamesbarford force-pushed the chore/refactor-struct-placeholder-pt2 branch from 4813077 to beb1a6e Compare January 26, 2026 08:24
@Jamesbarford Jamesbarford marked this pull request as ready for review January 26, 2026 08:27
@rustbot
Copy link
Collaborator

rustbot commented Jan 26, 2026

HIR ty lowering was modified

cc @fmease

changes to the core type system

cc @lcnr

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

This PR changes rustc_public

cc @oli-obk, @celinval, @ouz-a, @makai410

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 26, 2026
fn lift_to_interner(self, cx: U) -> Option<Self::Lifted> {
Some(BoundTy { var: self.var, kind: self.kind.lift_to_interner(cx)? })
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

why can this one not be derived?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I get this error without the implementation;

error[E0277]: the trait bound `BoundTy<TyCtxt<'_>>: Lift<TyCtxt<'tcx>>` is not satisfied
   --> compiler/rustc_infer/src/infer/region_constraints/mod.rs:672:59
    |
672 |             GenericKind::Placeholder(ref p) => write!(f, "{p}"),
    |                                                -----------^^^--
    |                                                |          |
    |                                                |          unsatisfied trait bound
    |                                                in this macro invocation (#1)
    |
   --> /rustc/9b1f8ff42d110b0ca138116745be921df5dc97e7/library/core/src/macros/mod.rs:610:0
    |
    = note: in this expansion of `write!` (#1)
   ::: /rustc/9b1f8ff42d110b0ca138116745be921df5dc97e7/library/core/src/macros/mod.rs:612:23
    |
    = note: in this macro invocation (#2)
   ::: /rustc/9b1f8ff42d110b0ca138116745be921df5dc97e7/library/core/src/macros/mod.rs:997:4
    |
    = note: in this expansion of `$crate::format_args!` (#2)
    |
    = help: the nightly-only, unstable trait `for<'tcx> Lift<rustc_middle::ty::TyCtxt<'tcx>>` is not implemented for `BoundTy<rustc_middle::ty::TyCtxt<'_>>`
    = help: the following other types implement trait `Lift<I>`:
              `&RawList<(), BoundVariableKind<TyCtxt<'a>>>` implements `Lift<rustc_middle::ty::TyCtxt<'tcx>>`
              `&RawList<(), GenericArg<'a>>` implements `Lift<rustc_middle::ty::TyCtxt<'tcx>>`
              `&RawList<(), Ty<'a>>` implements `Lift<rustc_middle::ty::TyCtxt<'tcx>>`
              `&RawList<(), Binder<TyCtxt<'a>, ...>>` implements `Lift<rustc_middle::ty::TyCtxt<'tcx>>`
              `()` implements `Lift<rustc_middle::ty::TyCtxt<'tcx>>`
              `AliasTerm<I>` implements `Lift<J>`
              `AliasTy<I>` implements `Lift<J>`
              `AllocId` implements `Lift<rustc_middle::ty::TyCtxt<'tcx>>`
            and 68 others
    = note: required for `Placeholder<TyCtxt<'_>, BoundTy<TyCtxt<'_>>>` to implement `for<'tcx> Lift<rustc_middle::ty::TyCtxt<'tcx>>`
    = note: required for `rustc_middle::ty::TyCtxt<'_>` to implement `IrPrint<Placeholder<TyCtxt<'_>, BoundTy<...>>>`
    = note: required for `Placeholder<TyCtxt<'_>, BoundTy<TyCtxt<'_>>>` to implement `std::fmt::Display`
    = note: 1 redundant requirement hidden
    = note: required for `&Placeholder<TyCtxt<'_>, BoundTy<TyCtxt<'_>>>` to implement `std::fmt::Display`
    = note: the full name for the type has been written to '/home/jambar02/Documents/arm/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/rustc_infer-29c3d638b97358db.long-type-10995706924995725161.txt'
    = note: consider using `--verbose` to print the full type name to the console

Copy link
Contributor

Choose a reason for hiding this comment

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

without the manual implementation but with a derive?

Copy link
Contributor

Choose a reason for hiding this comment

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

as in, using Lift_Generic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I get the same error when doing;

#[derive_where(Clone, Copy, PartialEq, Eq, Hash; I: Interner)]
#[derive(Lift_Generic)]
#[cfg_attr(
    feature = "nightly",
    derive(Encodable_NoContext, Decodable_NoContext, HashStable_NoContext)
)]
pub struct BoundTy<I: Interner> {
    pub var: ty::BoundVar,
    pub kind: BoundTyKind<I>,
}

Copy link
Contributor

@lcnr lcnr Jan 27, 2026

Choose a reason for hiding this comment

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

that might be as BoundVar doesn't implement Lift.

Does only deriving it for BoundRegionKind also error? The same with its HashStable impl

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doing it for BoundRegionKind allowed me to then also do it for BoundVariableKind and BoundTyKind.

type BoundTy: BoundVarLike<Self>;
type PlaceholderTy: PlaceholderLike<Self, Bound = Self::BoundTy>;
type Symbol: Copy + Hash + PartialEq + Eq + Debug;
type Symbol: Copy + Hash + PartialEq + Eq + Debug + Symbol<Self>;
Copy link
Contributor

Choose a reason for hiding this comment

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

please move all these item bounds to be super traits of Symbol instead

Copy link
Contributor

Choose a reason for hiding this comment

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

not actually resolved 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't push my changes 🤦

Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

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

nits, then r=me

also, for future PRs. It would have been good to keep the BoundRegionKind::NamedForPrinting rename in a separate commit as that one isn't strictly related to the other changes

View changes since this review

@Jamesbarford Jamesbarford force-pushed the chore/refactor-struct-placeholder-pt2 branch 2 times, most recently from 8387fa4 to 267fa27 Compare January 27, 2026 12:09
@Jamesbarford Jamesbarford force-pushed the chore/refactor-struct-placeholder-pt2 branch from 267fa27 to 9f0791e Compare January 29, 2026 08:34
Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

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

@lcnr
Copy link
Contributor

lcnr commented Jan 29, 2026

@bors delegate+

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 29, 2026

✌️ @Jamesbarford, 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.

@Jamesbarford Jamesbarford force-pushed the chore/refactor-struct-placeholder-pt2 branch from 9f0791e to 25c1365 Compare January 29, 2026 11:12
@Jamesbarford
Copy link
Contributor Author

@bors r=lcnr

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 29, 2026

📌 Commit 25c1365 has been approved by lcnr

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 Jan 29, 2026
rust-bors bot pushed a commit that referenced this pull request Jan 29, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #147387 (hir_owner_parent optimized to inlined call for non-incremental build)
 - #150271 (Move struct placeholder pt2)
 - #151283 (Suggest ignore returning value inside macro for unused_must_use lint)
 - #151565 (Rename, clarify, and document code for "erasing" query values)
 - #149482 (thread::scope: document how join interacts with TLS destructors)
 - #151827 (Use `Rustc` prefix for `rustc` attrs in `AttributeKind`)
 - #151833 (Treat unions as 'data types' in attr parsing diagnostics)
 - #151834 (Update `askama` version to `0.15.4`)
@rust-bors rust-bors bot merged commit 40d7cb8 into rust-lang:main Jan 29, 2026
11 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Jan 29, 2026
rust-timer added a commit that referenced this pull request Jan 29, 2026
Rollup merge of #150271 - Jamesbarford:chore/refactor-struct-placeholder-pt2, r=lcnr

Move struct placeholder pt2

r? ghost
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-clippy Relevant to the Clippy team. 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.

4 participants