2014-08-12 22:31:30 -05:00
|
|
|
#[prelude_import]
|
2014-12-22 11:04:23 -06:00
|
|
|
use std::prelude::v1::*;
|
2014-12-26 15:36:21 -06:00
|
|
|
#[macro_use]
|
2015-03-19 17:39:03 -05:00
|
|
|
extern crate std as std;
|
2014-07-22 18:39:10 -05:00
|
|
|
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
// pretty-compare-only
|
2015-07-31 02:04:06 -05:00
|
|
|
// pretty-mode:hir,typed
|
2014-07-22 18:39:10 -05:00
|
|
|
// pp-exact:issue-4264.pp
|
|
|
|
|
|
|
|
// #4264 fixed-length vector types
|
|
|
|
|
2015-01-31 10:23:42 -06:00
|
|
|
pub fn foo(_: [i32; (3 as usize)]) { }
|
2014-07-22 18:39:10 -05:00
|
|
|
|
|
|
|
pub fn bar() {
|
2015-02-18 08:05:34 -06:00
|
|
|
const FOO: usize = ((5 as usize) - (4 as usize) as usize);
|
2014-12-05 20:12:25 -06:00
|
|
|
let _: [(); (FOO as usize)] = ([(() as ())] as [(); 1]);
|
2014-07-22 18:39:10 -05:00
|
|
|
|
2015-03-03 02:42:26 -06:00
|
|
|
let _: [(); (1 as usize)] = ([(() as ())] as [(); 1]);
|
2014-07-22 18:39:10 -05:00
|
|
|
|
|
|
|
let _ =
|
2015-09-11 03:15:58 -05:00
|
|
|
(((&([(1 as i32), (2 as i32), (3 as i32)] as [i32; 3]) as &[i32; 3])
|
|
|
|
as *const _ as *const [i32; 3]) as *const [i32; (3 as usize)] as
|
|
|
|
*const [i32; 3]);
|
2014-07-22 18:39:10 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-12-27 15:57:43 -06:00
|
|
|
((::std::fmt::format as
|
2014-09-07 16:57:26 -05:00
|
|
|
fn(core::fmt::Arguments<'_>) -> collections::string::String {collections::fmt::format})(((::std::fmt::Arguments::new_v1
|
|
|
|
as
|
2016-03-21 14:11:23 -05:00
|
|
|
fn(&[&str], &[core::fmt::ArgumentV1<'_>]) -> core::fmt::Arguments<'_> {core::fmt::Arguments<'_>::new_v1})(({
|
|
|
|
static __STATIC_FMTSTR:
|
|
|
|
&'static [&'static str]
|
|
|
|
=
|
|
|
|
(&([("test"
|
2014-09-07 16:57:26 -05:00
|
|
|
as
|
2016-03-21 14:11:23 -05:00
|
|
|
&'static str)]
|
2016-03-17 19:22:32 -05:00
|
|
|
as
|
2016-03-21 14:11:23 -05:00
|
|
|
[&'static str; 1])
|
|
|
|
as
|
|
|
|
&'static [&'static str; 1]);
|
|
|
|
(__STATIC_FMTSTR
|
|
|
|
as
|
|
|
|
&'static [&'static str])
|
|
|
|
}
|
|
|
|
as
|
|
|
|
&[&str]),
|
|
|
|
(&(match (()
|
|
|
|
as
|
|
|
|
())
|
|
|
|
{
|
|
|
|
()
|
|
|
|
=>
|
|
|
|
([]
|
|
|
|
as
|
|
|
|
[core::fmt::ArgumentV1<'_>; 0]),
|
|
|
|
}
|
|
|
|
as
|
|
|
|
[core::fmt::ArgumentV1<'_>; 0])
|
|
|
|
as
|
|
|
|
&[core::fmt::ArgumentV1<'_>; 0]))
|
2014-09-07 16:57:26 -05:00
|
|
|
as
|
|
|
|
core::fmt::Arguments<'_>))
|
2014-12-27 15:57:43 -06:00
|
|
|
as collections::string::String);
|
2014-07-22 18:39:10 -05:00
|
|
|
}
|
2015-02-18 08:05:34 -06:00
|
|
|
pub type Foo = [i32; (3 as usize)];
|
2014-07-22 18:39:10 -05:00
|
|
|
pub struct Bar {
|
2015-02-18 08:05:34 -06:00
|
|
|
pub x: [i32; (3 as usize)],
|
2014-07-22 18:39:10 -05:00
|
|
|
}
|
2015-02-17 08:47:49 -06:00
|
|
|
pub struct TupleBar([i32; (4 as usize)]);
|
|
|
|
pub enum Baz { BazVariant([i32; (5 as usize)]), }
|
2014-07-22 18:39:10 -05:00
|
|
|
pub fn id<T>(x: T) -> T { (x as T) }
|
|
|
|
pub fn use_id() {
|
|
|
|
let _ =
|
2015-02-18 08:05:34 -06:00
|
|
|
((id::<[i32; (3 as usize)]> as
|
2016-02-16 10:37:32 -06:00
|
|
|
fn([i32; 3]) -> [i32; 3] {id::<[i32; 3]>})(([(1 as i32),
|
|
|
|
(2 as i32),
|
|
|
|
(3 as i32)] as
|
|
|
|
[i32; 3])) as
|
2015-01-31 10:23:42 -06:00
|
|
|
[i32; 3]);
|
2014-07-22 18:39:10 -05:00
|
|
|
}
|
|
|
|
fn main() { }
|