Add a test for -Zhir-stats
output.
This will be very useful in subsequent commits where I will improve the output.
This commit is contained in:
parent
f03ce30962
commit
bf20777d13
41
src/test/ui/stats/hir-stats.rs
Normal file
41
src/test/ui/stats/hir-stats.rs
Normal file
@ -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"); }
|
||||
}
|
83
src/test/ui/stats/hir-stats.stderr
Normal file
83
src/test/ui/stats/hir-stats.stderr
Normal file
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user