Created
January 7, 2019 05:21
-
-
Save alexreg/0163e1bc5d20af4619569ad281dbd661 to your computer and use it in GitHub Desktop.
`existential type` issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait TraitB { | |
type AssocB; | |
} | |
trait TraitC { | |
} | |
existential type Bar: Debug + TraitB<AssocB = impl Send>; | |
impl TraitB for i32 { | |
type AssocB = i32; | |
} | |
impl TraitC for i32 { | |
} | |
fn foo() -> Bar { | |
42 | |
} | |
/* | |
GENERATED HIR (by `lower_existential_impl_trait` method) | |
Item { ident: Bar#0, id: NodeId(86), hir_id: HirId { owner: DefIndex(0:13), local_id: 0 }, attrs: [], node: Existential(ExistTy { generics: Generics { params: [], where_clause: WhereClause { id: NodeId(96), predicates: [] }, span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 } }, bounds: [Trait(PolyTraitRef { bound_generic_params: [], trait_ref: TraitRef { path: path(Debug), ref_id: NodeId(87), hir_ref_id: HirId { owner: DefIndex(0:13), local_id: 3 } }, span: Span { lo: BytePos(570), hi: BytePos(575), ctxt: #0 } }, None), Trait(PolyTraitRef { bound_generic_params: [], trait_ref: TraitRef { path: path(TraitB<AssocB = >), ref_id: NodeId(89), hir_ref_id: HirId { owner: DefIndex(0:13), local_id: 7 } }, span: Span { lo: BytePos(578), hi: BytePos(604), ctxt: #0 } }, None)], impl_trait_fn: None }), vis: Spanned { node: Inherited, span: Span { lo: BytePos(548), hi: BytePos(548), ctxt: #0 } }, span: Span { lo: BytePos(548), hi: BytePos(605), ctxt: #0 } } | |
Item { ident: #0, id: NodeId(93), hir_id: HirId { owner: DefIndex(1:14), local_id: 0 }, attrs: [], node: Existential(ExistTy { generics: Generics { params: [], where_clause: WhereClause { id: NodeId(283), predicates: [] }, span: Span { lo: BytePos(594), hi: BytePos(603), ctxt: #0 } }, bounds: [Trait(PolyTraitRef { bound_generic_params: [], trait_ref: TraitRef { path: path(Send), ref_id: NodeId(94), hir_ref_id: HirId { owner: DefIndex(1:14), local_id: 2 } }, span: Span { lo: BytePos(599), hi: BytePos(603), ctxt: #0 } }, None)], impl_trait_fn: None }), vis: Spanned { node: Inherited, span: Span { lo: BytePos(594), hi: BytePos(594), ctxt: #0 } }, span: Span { lo: BytePos(594), hi: BytePos(603), ctxt: #6 } } | |
TypeBinding { id: NodeId(91), ident: AssocB#0, ty: type(), span: Span { lo: BytePos(585), hi: BytePos(603), ctxt: #0 } } | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait TraitB { | |
type AssocB; | |
} | |
trait TraitC { | |
} | |
existential type Bar: TraitB<AssocB = _0>; | |
existential type _0: Send; | |
impl TraitB for i32 { | |
type AssocB = i32; | |
} | |
impl TraitC for i32 { | |
} | |
fn foo() -> Bar { | |
42 | |
} | |
/* | |
GENERATED HIR (by `lower_existential_impl_trait` method) | |
Item { ident: Bar#0, id: NodeId(86), hir_id: HirId { owner: DefIndex(0:13), local_id: 0 }, attrs: [], node: Existential(ExistTy { generics: Generics { params: [], where_clause: WhereClause { id: NodeId(94), predicates: [] }, span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 } }, bounds: [Trait(PolyTraitRef { bound_generic_params: [], trait_ref: TraitRef { path: path(Debug), ref_id: NodeId(87), hir_ref_id: HirId { owner: DefIndex(0:13), local_id: 3 } }, span: Span { lo: BytePos(631), hi: BytePos(636), ctxt: #0 } }, None), Trait(PolyTraitRef { bound_generic_params: [], trait_ref: TraitRef { path: path(TraitB<AssocB = _0>), ref_id: NodeId(89), hir_ref_id: HirId { owner: DefIndex(0:13), local_id: 8 } }, span: Span { lo: BytePos(639), hi: BytePos(658), ctxt: #0 } }, None)], impl_trait_fn: None }), vis: Spanned { node: Inherited, span: Span { lo: BytePos(609), hi: BytePos(609), ctxt: #0 } }, span: Span { lo: BytePos(609), hi: BytePos(659), ctxt: #0 } } | |
Item { ident: _0#0, id: NodeId(95), hir_id: HirId { owner: DefIndex(0:14), local_id: 0 }, attrs: [], node: Existential(ExistTy { generics: Generics { params: [], where_clause: WhereClause { id: NodeId(98), predicates: [] }, span: Span { lo: BytePos(0), hi: BytePos(0), ctxt: #0 } }, bounds: [Trait(PolyTraitRef { bound_generic_params: [], trait_ref: TraitRef { path: path(Send), ref_id: NodeId(96), hir_ref_id: HirId { owner: DefIndex(0:14), local_id: 3 } }, span: Span { lo: BytePos(681), hi: BytePos(685), ctxt: #0 } }, None)], impl_trait_fn: None }), vis: Spanned { node: Inherited, span: Span { lo: BytePos(660), hi: BytePos(660), ctxt: #0 } }, span: Span { lo: BytePos(660), hi: BytePos(686), ctxt: #0 } } | |
TypeBinding { id: NodeId(91), ident: AssocB#0, ty: type(_0), span: Span { lo: BytePos(646), hi: BytePos(657), ctxt: #0 } } | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment