-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Move struct placeholder pt2 #150271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move struct placeholder pt2 #150271
Conversation
This comment has been minimized.
This comment has been minimized.
753b92c to
2077c6b
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
The reason
Try to replace the manual impl with a derive and see if anything breaks. If it does break, add |
d262f5c to
d36238d
Compare
This comment has been minimized.
This comment has been minimized.
d36238d to
a03a907
Compare
This comment has been minimized.
This comment has been minimized.
a03a907 to
b4de573
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
044bbd5 to
cdff0b9
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
please cleanup the changes + commit history and make this ready for review 😊 thank you for working on this |
4813077 to
beb1a6e
Compare
| fn lift_to_interner(self, cx: U) -> Option<Self::Lifted> { | ||
| Some(BoundTy { var: self.var, kind: self.kind.lift_to_interner(cx)? }) | ||
| } | ||
| } |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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>,
}There was a problem hiding this comment.
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
There was a problem hiding this comment.
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>; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not actually resolved 😅
There was a problem hiding this comment.
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 🤦
There was a problem hiding this 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
8387fa4 to
267fa27
Compare
267fa27 to
9f0791e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me after nit
|
@bors delegate+ |
|
✌️ @Jamesbarford, you can now approve this pull request! If @lcnr told you to " |
9f0791e to
25c1365
Compare
|
@bors r=lcnr |
…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`)
Rollup merge of #150271 - Jamesbarford:chore/refactor-struct-placeholder-pt2, r=lcnr Move struct placeholder pt2 r? ghost
r? ghost