Rollup merge of #68111 - varkor:const-generics-type_name, r=oli-obk

Print constants in `type_name` for const generics

Fixes https://github.com/rust-lang/rust/issues/65372.

r? @oli-obk as there may have been a deliberate decision not to in 5b9848912a (diff-4ed1a72c0bfdf17be769ed520932cd02R80).
This commit is contained in:
Yuki Okushi 2020-01-25 07:45:10 +09:00 committed by GitHub
commit cbaecee87c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 12 deletions

View file

@ -0,0 +1,11 @@
// run-pass
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
#[derive(Debug)]
struct S<const N: usize>;
fn main() {
assert_eq!(std::any::type_name::<S<3>>(), "const_generic_type_name::S<3usize>");
}

View file

@ -0,0 +1,8 @@
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> $DIR/const-generic-type_name.rs:3:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default