]>
git.proxmox.com Git - rustc.git/blob - tests/rustdoc/show-const-contents.rs
1 // Test that the contents of constants are displayed as part of the
4 // @hasraw show_const_contents/constant.CONST_S.html 'show this'
5 // @!hasraw show_const_contents/constant.CONST_S.html '; //'
6 pub const CONST_S
: &'
static str = "show this";
8 // @hasraw show_const_contents/constant.CONST_I32.html '= 42;'
9 // @!hasraw show_const_contents/constant.CONST_I32.html '; //'
10 pub const CONST_I32
: i32 = 42;
12 // @hasraw show_const_contents/constant.CONST_I32_HEX.html '= 0x42;'
13 // @!hasraw show_const_contents/constant.CONST_I32_HEX.html '; //'
14 pub const CONST_I32_HEX
: i32 = 0x42;
16 // @hasraw show_const_contents/constant.CONST_NEG_I32.html '= -42;'
17 // @!hasraw show_const_contents/constant.CONST_NEG_I32.html '; //'
18 pub const CONST_NEG_I32
: i32 = -42;
20 // @hasraw show_const_contents/constant.CONST_EQ_TO_VALUE_I32.html '= 42i32;'
21 // @!hasraw show_const_contents/constant.CONST_EQ_TO_VALUE_I32.html '// 42i32'
22 pub const CONST_EQ_TO_VALUE_I32
: i32 = 42i32;
24 // @hasraw show_const_contents/constant.CONST_CALC_I32.html '= _; // 43i32'
25 pub const CONST_CALC_I32
: i32 = 42 + 1;
27 // @!hasraw show_const_contents/constant.CONST_REF_I32.html '= &42;'
28 // @!hasraw show_const_contents/constant.CONST_REF_I32.html '; //'
29 pub const CONST_REF_I32
: &'
static i32 = &42;
31 // @hasraw show_const_contents/constant.CONST_I32_MAX.html '= i32::MAX; // 2_147_483_647i32'
32 pub const CONST_I32_MAX
: i32 = i32::MAX
;
34 // @!hasraw show_const_contents/constant.UNIT.html '= ();'
35 // @!hasraw show_const_contents/constant.UNIT.html '; //'
36 pub const UNIT
: () = ();
38 pub struct MyType(i32);
40 // @!hasraw show_const_contents/constant.MY_TYPE.html '= MyType(42);'
41 // @!hasraw show_const_contents/constant.MY_TYPE.html '; //'
42 pub const MY_TYPE
: MyType
= MyType(42);
44 pub struct MyTypeWithStr(&'
static str);
46 // @!hasraw show_const_contents/constant.MY_TYPE_WITH_STR.html '= MyTypeWithStr("show this");'
47 // @!hasraw show_const_contents/constant.MY_TYPE_WITH_STR.html '; //'
48 pub const MY_TYPE_WITH_STR
: MyTypeWithStr
= MyTypeWithStr("show this");
50 // @hasraw show_const_contents/constant.PI.html '= 3.14159265358979323846264338327950288f32;'
51 // @hasraw show_const_contents/constant.PI.html '; // 3.14159274f32'
52 pub use std
::f32::consts
::PI
;
54 // @hasraw show_const_contents/constant.MAX.html '= i32::MAX; // 2_147_483_647i32'
55 #[allow(deprecated, deprecated_in_future)]
56 pub use std
::i32::MAX
;
58 macro_rules
! int_module
{
60 pub const MIN
: $T
= $T
::MIN
;
64 // @hasraw show_const_contents/constant.MIN.html '= i16::MIN; // -32_768i16'
67 // @has show_const_contents/constant.ESCAPE.html //pre '= r#"<script>alert("ESCAPE");</script>"#;'
68 pub const ESCAPE
: &str = r
#"<script>alert("ESCAPE");</script>"#;