]> git.lizzy.rs Git - rust.git/blob - src/test/pretty/issue-4264.pp
rollup merge of #20608: nikomatsakis/assoc-types-method-dispatch
[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 #[prelude_import]
7 use std::prelude::v1::*;
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     const 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 *const [int; 3]) as
35             *const [int; (3u as uint)] as *const [int; 3]);
36
37
38
39
40
41
42
43
44
45     ((::std::fmt::format as
46          fn(core::fmt::Arguments<'_>) -> collections::string::String {std::fmt::format})(((::std::fmt::Arguments::new
47                                                                                               as
48                                                                                               fn(&[&str], &[core::fmt::Argument<'_>]) -> core::fmt::Arguments<'_> {core::fmt::Arguments<'a>::new})(({
49                                                                                                                                                                                                         #[inline]
50                                                                                                                                                                                                         #[allow(dead_code)]
51                                                                                                                                                                                                         static __STATIC_FMTSTR:
52                                                                                                                                                                                                                &'static [&'static str]
53                                                                                                                                                                                                                =
54                                                                                                                                                                                                             (&([("test"
55                                                                                                                                                                                                                     as
56                                                                                                                                                                                                                     &'static str)]
57                                                                                                                                                                                                                   as
58                                                                                                                                                                                                                   [&'static str; 1])
59                                                                                                                                                                                                                 as
60                                                                                                                                                                                                                 &'static [&'static str; 1]);
61                                                                                                                                                                                                         (__STATIC_FMTSTR
62                                                                                                                                                                                                             as
63                                                                                                                                                                                                             &'static [&'static str])
64                                                                                                                                                                                                     }
65                                                                                                                                                                                                        as
66                                                                                                                                                                                                        &[&str]),
67                                                                                                                                                                                                    (&(match (()
68                                                                                                                                                                                                                 as
69                                                                                                                                                                                                                 ())
70                                                                                                                                                                                                           {
71                                                                                                                                                                                                           ()
72                                                                                                                                                                                                           =>
73                                                                                                                                                                                                           ([]
74                                                                                                                                                                                                               as
75                                                                                                                                                                                                               [core::fmt::Argument<'_>; 0]),
76                                                                                                                                                                                                       }
77                                                                                                                                                                                                          as
78                                                                                                                                                                                                          [core::fmt::Argument<'_>; 0])
79                                                                                                                                                                                                        as
80                                                                                                                                                                                                        &[core::fmt::Argument<'_>; 0]))
81                                                                                              as
82                                                                                              core::fmt::Arguments<'_>))
83         as collections::string::String);
84 }
85 pub type Foo = [int; (3u as uint)];
86 pub struct Bar {
87     pub x: [int; (3u as uint)],
88 }
89 pub struct TupleBar([int; (4u as uint)]);
90 pub enum Baz { BazVariant([int; (5u as uint)]), }
91 pub fn id<T>(x: T) -> T { (x as T) }
92 pub fn use_id() {
93     let _ =
94         ((id::<[int; (3u as uint)]> as
95              fn([int; 3]) -> [int; 3] {id})(([(1 as int), (2 as int),
96                                               (3 as int)] as [int; 3])) as
97             [int; 3]);
98 }
99 fn main() { }