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:
commit
cbaecee87c
5 changed files with 52 additions and 12 deletions
11
src/test/ui/const-generics/const-generic-type_name.rs
Normal file
11
src/test/ui/const-generics/const-generic-type_name.rs
Normal 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>");
|
||||
}
|
||||
|
|
@ -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
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue