about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/ui/stats/hir-stats.rs41
-rw-r--r--src/test/ui/stats/hir-stats.stderr83
2 files changed, 124 insertions, 0 deletions
diff --git a/src/test/ui/stats/hir-stats.rs b/src/test/ui/stats/hir-stats.rs
new file mode 100644
index 00000000000..3c59ee22f24
--- /dev/null
+++ b/src/test/ui/stats/hir-stats.rs
@@ -0,0 +1,41 @@
+// check-pass
+// compile-flags: -Zhir-stats
+// only-x86_64
+
+// The aim here is to include at least one of every different type of AST/HIR
+// node reported by `-Zhir-stats`.
+
+#![allow(dead_code)]
+
+use std::arch::asm;
+use std::fmt::Debug;
+use std::ffi::c_void;
+
+extern "C" { fn f(p: *mut c_void); }
+
+/// An enum.
+enum E<'a, T: Copy> { A { t: T }, B(&'a u32) }
+
+trait Go {
+    type G: Debug;
+    fn go(self) -> u32;
+}
+
+impl<'a, T: Copy> Go for E<'a, T> {
+    type G = bool;
+    fn go(self) -> u32 {
+        99
+    }
+}
+
+fn f2<T>(t: T) where T: Debug {}
+
+fn main() {
+    let x = E::A { t: 3 };
+    match x {
+        E::A { .. } => {}
+        _ => {}
+    }
+
+    unsafe { asm!("mov rdi, 1"); }
+}
diff --git a/src/test/ui/stats/hir-stats.stderr b/src/test/ui/stats/hir-stats.stderr
new file mode 100644
index 00000000000..a0c1c80022f
--- /dev/null
+++ b/src/test/ui/stats/hir-stats.stderr
@@ -0,0 +1,83 @@
+
+PRE EXPANSION AST STATS
+
+Name                Accumulated Size         Count     Item Size
+----------------------------------------------------------------
+Lifetime                          32             2            16
+MacCall                           64             1            64
+Local                             72             1            72
+Arm                               96             2            48
+FieldDef                         160             2            80
+ForeignItem                      160             1           160
+Stmt                             160             5            32
+FnDecl                           200             5            40
+Variant                          240             2           120
+Block                            288             6            48
+Attribute                        304             2           152
+ImplItem                         320             2           160
+TraitItem                        320             2           160
+GenericBound                     352             4            88
+PathSegment                      720            30            24
+Expr                             832             8           104
+Pat                              840             7           120
+Ty                             1_344            14            96
+Item                           1_800             9           200
+----------------------------------------------------------------
+Total                          8_304
+
+
+POST EXPANSION AST STATS
+
+Name                Accumulated Size         Count     Item Size
+----------------------------------------------------------------
+Lifetime                          32             2            16
+Local                             72             1            72
+Arm                               96             2            48
+FieldDef                         160             2            80
+ForeignItem                      160             1           160
+Stmt                             160             5            32
+FnDecl                           200             5            40
+Variant                          240             2           120
+Block                            288             6            48
+ImplItem                         320             2           160
+TraitItem                        320             2           160
+GenericBound                     352             4            88
+Attribute                        608             4           152
+PathSegment                      792            33            24
+Pat                              840             7           120
+Expr                             936             9           104
+Ty                             1_344            14            96
+Item                           2_200            11           200
+----------------------------------------------------------------
+Total                          9_120
+
+
+HIR STATS
+
+Name                Accumulated Size         Count     Item Size
+----------------------------------------------------------------
+Param                             64             2            32
+Local                             64             1            64
+ForeignItem                       72             1            72
+FieldDef                          96             2            48
+Arm                               96             2            48
+Stmt                              96             3            32
+FnDecl                           120             3            40
+Lifetime                         128             4            32
+Variant                          160             2            80
+ImplItem                         176             2            88
+GenericBound                     192             4            48
+TraitItem                        192             2            96
+WherePredicate                   216             3            72
+Block                            288             6            48
+QPath                            408            17            24
+Pat                              440             5            88
+Attribute                        608             4           152
+Expr                             672            12            56
+Item                             960            12            80
+Ty                             1_152            16            72
+Path                           1_296            27            48
+PathSegment                    2_240            40            56
+----------------------------------------------------------------
+Total                          9_736
+