]> git.proxmox.com Git - rustc.git/blame - src/test/pretty/issue-4264.pp
Imported Upstream version 1.4.0+dfsg1
[rustc.git] / src / test / pretty / issue-4264.pp
CommitLineData
1a4d82fc
JJ
1#[prelude_import]
2use std::prelude::v1::*;
85aaf69f 3#[macro_use]
c34b1796 4extern crate std as std;
1a4d82fc
JJ
5// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
6// file at the top-level directory of this distribution and at
7// http://rust-lang.org/COPYRIGHT.
8//
9// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
10// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
11// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
12// option. This file may not be copied, modified, or distributed
13// except according to those terms.
14
15// pretty-compare-only
e9174d1e 16// pretty-mode:hir,typed
1a4d82fc
JJ
17// pp-exact:issue-4264.pp
18
19// #4264 fixed-length vector types
20
85aaf69f 21pub fn foo(_: [i32; (3 as usize)]) { }
1a4d82fc
JJ
22
23pub fn bar() {
85aaf69f 24 const FOO: usize = ((5 as usize) - (4 as usize) as usize);
1a4d82fc
JJ
25 let _: [(); (FOO as usize)] = ([(() as ())] as [(); 1]);
26
c34b1796 27 let _: [(); (1 as usize)] = ([(() as ())] as [(); 1]);
1a4d82fc
JJ
28
29 let _ =
85aaf69f
SL
30 (((&((([(1 as i32), (2 as i32), (3 as i32)] as [i32; 3])) as [i32; 3])
31 as &[i32; 3]) as *const _ as *const [i32; 3]) as
c34b1796 32 *const [i32; (3 as usize)] as *const [i32; 3]);
1a4d82fc
JJ
33
34
35
36
37
38
39
40
41
42 ((::std::fmt::format as
85aaf69f
SL
43 fn(core::fmt::Arguments<'_>) -> collections::string::String {collections::fmt::format})(((::std::fmt::Arguments::new_v1
44 as
45 fn(&[&str], &[core::fmt::ArgumentV1<'_>]) -> core::fmt::Arguments<'_> {core::fmt::Arguments<'a>::new_v1})(({
46 static __STATIC_FMTSTR:
47 &'static [&'static str]
48 =
49 (&([("test"
50 as
51 &'static str)]
52 as
53 [&'static str; 1])
54 as
55 &'static [&'static str; 1]);
56 (__STATIC_FMTSTR
57 as
58 &'static [&'static str])
59 }
60 as
61 &[&str]),
62 (&(match (()
63 as
64 ())
65 {
66 ()
67 =>
68 ([]
69 as
70 [core::fmt::ArgumentV1<'_>; 0]),
71 }
72 as
73 [core::fmt::ArgumentV1<'_>; 0])
1a4d82fc 74 as
85aaf69f
SL
75 &[core::fmt::ArgumentV1<'_>; 0]))
76 as
77 core::fmt::Arguments<'_>))
1a4d82fc
JJ
78 as collections::string::String);
79}
85aaf69f 80pub type Foo = [i32; (3 as usize)];
1a4d82fc 81pub struct Bar {
85aaf69f 82 pub x: [i32; (3 as usize)],
1a4d82fc 83}
85aaf69f
SL
84pub struct TupleBar([i32; (4 as usize)]);
85pub enum Baz { BazVariant([i32; (5 as usize)]), }
1a4d82fc
JJ
86pub fn id<T>(x: T) -> T { (x as T) }
87pub fn use_id() {
88 let _ =
85aaf69f
SL
89 ((id::<[i32; (3 as usize)]> as
90 fn([i32; 3]) -> [i32; 3] {id})(([(1 as i32), (2 as i32),
91 (3 as i32)] as [i32; 3])) as
92 [i32; 3]);
1a4d82fc
JJ
93}
94fn main() { }