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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment