]> git.lizzy.rs Git - rust.git/blob - src/test/pretty/issue-4264.pp
auto merge of #18192 : jmesmon/rust/platform-generic, r=alexcrichton
[rust.git] / src / test / pretty / issue-4264.pp
1 #![feature(phase)]
2 #![no_std]
3 #![feature(globs)]
4 #[phase(plugin, link)]
5 extern crate "std" as std;
6 extern crate "native" as rt;
7 #[prelude_import]
8 use std::prelude::*;
9 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
10 // file at the top-level directory of this distribution and at
11 // http://rust-lang.org/COPYRIGHT.
12 //
13 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
14 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
15 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
16 // option. This file may not be copied, modified, or distributed
17 // except according to those terms.
18
19 // pretty-compare-only
20 // pretty-mode:typed
21 // pp-exact:issue-4264.pp
22
23 // #4264 fixed-length vector types
24
25 pub fn foo(_: [int, ..(3 as uint)]) { }
26
27 pub fn bar() {
28     const FOO: uint = ((5u as uint) - (4u as uint) as uint);
29     let _: [(), ..(FOO as uint)] = ([(() as ())] as [(), ..1]);
30
31     let _: [(), ..(1u as uint)] = ([(() as ())] as [(), ..1]);
32
33     let _ =
34         (((&((([(1i as int), (2 as int), (3 as int)] as [int, ..3])) as
35                 [int, ..3]) as &[int, ..3]) as *const _ as *const [int, ..3])
36             as *const [int, ..(3u as uint)] as *const [int, ..3]);
37
38     (match (() as ()) {
39          () => {
40              #[inline]
41              #[allow(dead_code)]
42              static __STATIC_FMTSTR: [&'static str, ..(1u as uint)] =
43                  ([("test" as &'static str)] as [&'static str, ..1]);
44              let __args_vec =
45                  (&([] as [core::fmt::Argument<'_>, ..0]) as
46                      &[core::fmt::Argument<'_>, ..0]);
47              let __args =
48                  (unsafe {
49                       ((::std::fmt::Arguments::new as
50                            unsafe fn(&'static [&'static str], &'a [core::fmt::Argument<'a>]) -> core::fmt::Arguments<'a>)((__STATIC_FMTSTR
51                                                                                                                               as
52                                                                                                                               [&'static str, ..1]),
53                                                                                                                           (__args_vec
54                                                                                                                               as
55                                                                                                                               &[core::fmt::Argument<'_>, ..0]))
56                           as core::fmt::Arguments<'_>)
57                   } as core::fmt::Arguments<'_>);
58
59
60
61
62
63
64
65
66              ((::std::fmt::format as
67                   fn(&core::fmt::Arguments<'_>) -> collections::string::String)((&(__args
68                                                                                       as
69                                                                                       core::fmt::Arguments<'_>)
70                                                                                     as
71                                                                                     &core::fmt::Arguments<'_>))
72                  as collections::string::String)
73          }
74      } as collections::string::String);
75 }
76 pub type Foo = [int, ..(3u as uint)];
77 pub struct Bar {
78     pub x: [int, ..(3u as uint)],
79 }
80 pub struct TupleBar([int, ..(4u as uint)]);
81 pub enum Baz { BazVariant([int, ..(5u as uint)]), }
82 pub fn id<T>(x: T) -> T { (x as T) }
83 pub fn use_id() {
84     let _ =
85         ((id::<[int, ..(3u as uint)]> as
86              fn([int, ..3]) -> [int, ..3])(([(1 as int), (2 as int),
87                                              (3 as int)] as [int, ..3])) as
88             [int, ..3]);
89 }
90 fn main() { }