]>
git.proxmox.com Git - rustc.git/blob - src/test/run-pass/issue-20427.rs
1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
12 // ignore-pretty (#23623)
15 use std
::string
as i16;
19 fn f
<f64>(f64: f64) {}
29 fn f_
<f64_
>(f64: f64_
) {}
38 use super::i32_
as i32;
39 use super::i64_
as i64;
42 use super::u16_
as u16;
43 use super::u32_
as u32;
44 use super::u64_
as u64;
45 use super::bool_
as bool
;
46 use super::{bool_ as str}
;
47 use super::char_
as char;
55 fn usize<'
usize>(usize: &'
usize usize) -> &'
usize usize { usize }
58 use std
::mem
::size_of
;
61 use std
::string
::String
as i16;
64 assert_eq
!(size_of
::<u8>(), 8);
65 assert_eq
!(size_of
::<::u64>(), 0);
66 assert_eq
!(size_of
::<i16>(), 3 * size_of
::<*const ()>());
67 assert_eq
!(size_of
::<u16>(), 0);
73 use std
::u8; // bring module u8 in scope
74 fn f() -> u8 { // OK, resolves to primitive u8, not to std::u8
75 u8::max_value() // OK, resolves to associated function <u8>::max_value,
76 // not to non-existent std::u8::max_value
78 assert_eq
!(f(), u8::MAX
); // OK, resolves to std::u8::MAX
85 str @
true => if str { i32 as i64 }
else { i64 }
,
89 reuse
::check
::<u64>();