-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)C-bugCategory: This is a bug.Category: This is a bug.F-const_generics`#![feature(const_generics)]``#![feature(const_generics)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
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.
rodrimati1992 and Restioson
Metadata
Metadata
Assignees
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)C-bugCategory: This is a bug.Category: This is a bug.F-const_generics`#![feature(const_generics)]``#![feature(const_generics)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.