Closed
Description
I tried this code:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=57bb53139f14a69326e005ea9d9f7cd7
#![feature(const_type_id)]
use std::any::TypeId;
pub struct GetTypeId<T>(T);
impl<T: 'static> GetTypeId<T> {
pub const VALUE: TypeId = TypeId::of::<T>();
}
const fn check_type_id<T: 'static>() -> bool {
matches!(GetTypeId::<T>::VALUE, GetTypeId::<T>::VALUE)
}
fn main() {
assert!(check_type_id::<usize>());
}
I expected the code to run without errors
Instead, the assertion failed.
Meta
Compiler version: 1.46.0-nightly (2020-07-01 f781bab)
Metadata
Metadata
Assignees
Labels
Area: Constant evaluation, covers all const contexts (static, const fn, ...)Category: This is a bug.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Relevant to the compiler team, which will review and decide on the PR/issue.This issue requires a nightly compiler in some way.