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