-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Move struct Placeholder<T>
#149535
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<T>
#149535
Conversation
This comment has been minimized.
This comment has been minimized.
e9e240f to
31df95c
Compare
This comment has been minimized.
This comment has been minimized.
Using The impl<T> rustc_type_ir::ir_print::IrPrint<T> for TyCtxt<'_>
where
T: Copy + for<'a, 'tcx> Lift<TyCtxt<'tcx>, Lifted: Print<'tcx, FmtPrinter<'a, 'tcx>>>,Yeah, it's the Lift impl currently in
Yeah, you should instead only use |
31df95c to
0097b2b
Compare
This comment has been minimized.
This comment has been minimized.
|
After implementing Despite the implementation in |
This comment has been minimized.
This comment has been minimized.
| // tidy-alphabetical-start | ||
| crate::ty::ParamTy, | ||
| crate::ty::PlaceholderType, | ||
| crate::ty::PlaceholderType<'tcx>, |
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.
this impl shouldn't exist. It overlaps with the blanket lift impl. We need to impl lift for BoundTy 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.
Interesting, when I remove crate::ty::PlaceholderType<'tcx> and add crate::tyBoundTy the volume of errors trebles but seems to emanate from;
Placeholder(ty::PlaceholderType<'tcx>),
| ^^ unsatisfied trait bound
Which is fixed by having crate::ty::PlaceholderType<'tcx> in this list 🤔
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.
what is the unsatisfied trait bound?
PlaceholderType should not be in this list, there's a generic Lift impl for Placeholder we should use here. That impl adds a bound of BoundTy we need to add an impl for 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.
The error I get is;
error[E0277]: the trait bound `Placeholder<..., ...>: TypeVisitable<_>` is not satisfied
--> compiler/rustc_infer/src/infer/region_constraints/mod.rs:128:17
|
125 | ..., Clone, PartialEq, Eq, Hash, TypeFoldable, TypeVisitable)]
| -------------
| |
| required by a bound introduced by this call
| in this derive macro expansion
...
128 | ...er(ty::PlaceholderType<'tcx>),
| ^^ unsatisfied trait bound
|
::: <location>/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/synstructure-0.13.2/src/macros.rs:95:9
|
95 | / pub fn $derives(
96 | | i: $crate::macros::TokenStream
97 | | ) -> $crate::macros::TokenStream {
| |________________________________________- in this expansion of `#[derive(TypeVisitable)]`
|
= help: the trait `TypeVisitable<_>` is not implemented for `Placeholder<TyCtxt<'_>, ...>`
= help: the following other types implement trait `TypeVisitable<I>`:
`&RawList<(), T>` implements `TypeVisitable<TyCtxt<'tcx>>`
`&RawList<TypeInfo, ...>` implements `TypeVisitable<TyCtxt<'tcx>>`
`&[T]` implements `TypeVisitable<I>`
`()` implements `TypeVisitable<I>`
`(A, B, C)` implements `TypeVisitable<I>`
`(T, U)` implements `TypeVisitable<I>`
`Adjust` implements `TypeVisitable<TyCtxt<'tcx>>`
`Adjustment<'tcx>` implements `TypeVisitable<TyCtxt<'tcx>>`
and 254 others
= note: the full name for the type has been written to '<location>/Documents/arm/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/rustc_infer-73d70faa908a1b3c.long-type-1457141661489514723.txt'
To which I thought I'd possibly need to implement TypeVisitable for Placeholder which led to a lot of changes, me getting confused and then halting as the TypeVisitable and TypeVisitor require Binder as an argument for visit_binder(...) which wasn't satisfied by Placeholder
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.
TypeVisitable doesn't have a visit_binder function, that's TypeVisitor.
You should derive TypeVisitable_Generic for it iirc
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.
Ah! That seems to have done it though has led to the next issue which is the same error but for PhantomData;
error[E0277]: the trait bound `PhantomData<fn() -> TyCtxt<'_>>: TypeFoldable<...>` is not satisfied
--> compiler/rustc_infer/src/infer/region_constraints/mod.rs:128:17
|
125 | #[derive(Copy, Clone, PartialEq, Eq, Hash, TypeFoldable, TypeVisitable)]
| ------------
| |
| required by a bound introduced by this call
| in this derive macro expansion
...
128 | Placeholder(ty::PlaceholderType<'tcx>),
| ^^ unsatisfied trait bound
|
::: <location>/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/synstructure-0.13.2/src/macros.rs:95:9
|
95 | / pub fn $derives(
96 | | i: $crate::macros::TokenStream
97 | | ) -> $crate::macros::TokenStream {
| |________________________________________- in this expansion of `#[derive(TypeFoldable)]`
|
= help: the trait `TypeFoldable<rustc_middle::ty::TyCtxt<'_>>` is not implemented for `std::marker::PhantomData<fn() -> rustc_middle::ty::TyCtxt<'_>>`
= help: the following other types implement trait `TypeFoldable<I>`:
`&RawList<(), (OpaqueTypeKey<TyCtxt<'tcx>>, ...)>` implements `TypeFoldable<rustc_middle::ty::TyCtxt<'tcx>>`
`&'tcx rustc_middle::ty::list::RawList<(), LocalDefId>` implements `TypeFoldable<rustc_middle::ty::TyCtxt<'tcx>>`
`&RawList<(), OutlivesPredicate<TyCtxt<'tcx>, ...>>` implements `TypeFoldable<rustc_middle::ty::TyCtxt<'tcx>>`
`&RawList<(), ProjectionElem<Local, Ty<'tcx>>>` implements `TypeFoldable<rustc_middle::ty::TyCtxt<'tcx>>`
`&RawList<(), GenericArg<'tcx>>` implements `TypeFoldable<rustc_middle::ty::TyCtxt<'tcx>>`
`&RawList<(), Pattern<'tcx>>` implements `TypeFoldable<rustc_middle::ty::TyCtxt<'tcx>>`
`&RawList<(), Ty<'tcx>>` implements `TypeFoldable<rustc_middle::ty::TyCtxt<'tcx>>`
`&RawList<(), Binder<TyCtxt<'tcx>, ...>>` implements `TypeFoldable<rustc_middle::ty::TyCtxt<'tcx>>`
and 246 others
= note: required for `rustc_type_ir::Placeholder<rustc_middle::ty::TyCtxt<'_>, BoundTy>` to implement `TypeFoldable<rustc_middle::ty::TyCtxt<'_>>`
= note: the full name for the type has been written to '<location>/Documents/arm/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/rustc_infer-73d70faa908a1b3c.long-type-15035837308766043169.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.
put #[type_foldable(identity)] and #[type_visitable(skip)] on that field
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.
This comment has been minimized.
This comment has been minimized.
8116744 to
e0c973c
Compare
| mir_def: LocalDefId, | ||
| } | ||
|
|
||
| const FR: NllRegionVariableOrigin = NllRegionVariableOrigin::FreeRegion; |
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.
alternative, add #[feature(generic_const_items)] (if it's not marked as incomplete) and change this to const FR<'tcx>: ...
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 was not able to do this I got the error; generic const items are experimental
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.
yeah, the feature is still incomplete, oki, let's keep this change then
|
nit, please slightly squash your commits, then r=me 😊 |
e0c973c to
1986be2
Compare
|
@bors r=lcnr |
|
@Jamesbarford: 🔑 Insufficient privileges: Not in reviewers |
|
changes to the core type system |
|
@bors r+ rollup=iffy |
|
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 198328a (parent) -> a9ac706 (this PR) Test differencesShow 30 test diffs30 doctest diffs were found. These are ignored, as they are noisy. Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard a9ac706b5f79e90d7255e3acc343fffba47cc5ef --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (a9ac706): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary -0.8%, secondary -3.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 2.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 471.708s -> 474.808s (0.66%) |
r? ghost
Couple of issues I've encountered;
compiler/rustc_infer/src/infer/region_constraints/mod.rsGenericKindI can't callwrite!(f, "{p}")due to error 1. Which looks like I may need to implementLiftforPlaceholder?define_print_and_forward_display!forty::PlaceholderTypecaused error 2, as I've moved the struct it no longer exists in the crate. I suspect because I'm not using that macro it causes the error forGenericKindError 1
Error 2