diff options
| author | Ding Xiang Fei <dingxiangfei2009@protonmail.ch> | 2020-07-31 18:04:13 +0800 |
|---|---|---|
| committer | Ding Xiang Fei <dingxiangfei2009@protonmail.ch> | 2020-07-31 18:04:13 +0800 |
| commit | c5114549d74f6092517af6ea630ec5a26317ae93 (patch) | |
| tree | 652d443946ed8a1f54fa341f146579dc16059212 /src/test | |
| parent | 4631579b000b006ed3eba7d3f80bbfece02579bc (diff) | |
| download | rust-c5114549d74f6092517af6ea630ec5a26317ae93.tar.gz rust-c5114549d74f6092517af6ea630ec5a26317ae93.zip | |
Add the proper tests
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/statics/static-promotion.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/test/ui/statics/static-promotion.rs b/src/test/ui/statics/static-promotion.rs index 500af1e15e1..bd8910bdb3f 100644 --- a/src/test/ui/statics/static-promotion.rs +++ b/src/test/ui/statics/static-promotion.rs @@ -12,12 +12,23 @@ struct A<T: 'static>(&'static T); struct B<T: 'static + ?Sized> { x: &'static T, } +static STR: &'static [u8] = b"hi"; static C: A<B<B<[u8]>>> = { A(&B { - x: &B { x: b"hi" as &[u8] }, + x: &B { x: STR }, }) }; +pub struct Slice(&'static [i32]); + +static CONTENT: i32 = 42; +pub static CONTENT_MAP: Slice = Slice(&[CONTENT]); + +pub static FOO: (i32, i32) = (42, 43); +pub static CONTENT_MAP2: Slice = Slice(&[FOO.0]); + fn main() { assert_eq!(b"hi", C.0.x.x); + assert_eq!(&[42], CONTENT_MAP.0); + assert_eq!(&[42], CONTENT_MAP2.0); } |
