about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-01-25 07:45:10 +0900
committerGitHub <noreply@github.com>2020-01-25 07:45:10 +0900
commitcbaecee87cfceb2d21413ed431321e9cf480c176 (patch)
tree1810d27e19e1c73a8af0ec1912520899b76c12bd /src/test
parentc2d141df59703393c0c683abc259f9a8c3be041a (diff)
parent50dd8eaeb9ebbccb8b79ff30d3068d0ee337cd2f (diff)
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 https://github.com/rust-lang/rust/commit/5b9848912a85e28d000602fc2e81bad9c2f2a981#diff-4ed1a72c0bfdf17be769ed520932cd02R80.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/const-generics/const-generic-type_name.rs11
-rw-r--r--src/test/ui/const-generics/const-generic-type_name.stderr8
2 files changed, 19 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/const-generic-type_name.rs b/src/test/ui/const-generics/const-generic-type_name.rs
new file mode 100644
index 00000000000..28586426b44
--- /dev/null
+++ b/src/test/ui/const-generics/const-generic-type_name.rs
@@ -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>");
+}
diff --git a/src/test/ui/const-generics/const-generic-type_name.stderr b/src/test/ui/const-generics/const-generic-type_name.stderr
new file mode 100644
index 00000000000..6b60a77effe
--- /dev/null
+++ b/src/test/ui/const-generics/const-generic-type_name.stderr
@@ -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
+