Closed
Description
Code (Playground):
#![feature(const_generics)]
#[derive(PartialEq, Eq)]
struct MyType;
struct Const<const V: MyType> {}
type MyConst = Const<{ MyType }>;
fn main() {
let _x = Const::<{ MyType }> {};
let _y = MyConst {};
}
Error message:
error[E0308]: mismatched types
--> src/main.rs:9:14
|
9 | let _x = Const::<{ MyType }> {};
| ^^^^^^^^^^^^^^^^^^^^^^ expected `ByRef { alloc: Allocation { bytes: [], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [], len: Size { raw: 0 } }, size: Size { raw: 0 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }: MyType`, found `ByRef { alloc: Allocation { bytes: [], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [], len: Size { raw: 0 } }, size: Size { raw: 0 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }: MyType`
|
= note: expected type `_`
found struct `Const<ByRef { alloc: Allocation { bytes: [], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [], len: Size { raw: 0 } }, size: Size { raw: 0 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }: MyType>`
error[E0308]: mismatched types
--> src/main.rs:10:14
|
10 | let _y = MyConst {};
| ^^^^^^^^^^ expected `ByRef { alloc: Allocation { bytes: [], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [], len: Size { raw: 0 } }, size: Size { raw: 0 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }: MyType`, found `ByRef { alloc: Allocation { bytes: [], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [], len: Size { raw: 0 } }, size: Size { raw: 0 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }: MyType`
|
= note: expected type `_`
found struct `Const<ByRef { alloc: Allocation { bytes: [], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [], len: Size { raw: 0 } }, size: Size { raw: 0 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }: MyType>`
This issue has been assigned to @lcnr via this comment.