diff options
| author | Matthew <mjjasper1@gmail.com> | 2017-04-24 10:20:05 +0100 |
|---|---|---|
| committer | Matthew <mjjasper1@gmail.com> | 2017-04-24 10:20:05 +0100 |
| commit | 158b085f06a41004ebf36d87afa3548f8b60861a (patch) | |
| tree | e035c4787385e562748f7a3d04bb4e5018f82767 /src/test/run-pass | |
| parent | 8a3ea01bcae85a3ed0c90ca5603cd88c469172c3 (diff) | |
| parent | 15ce54096a589de277771ad1f55a334fe2661a64 (diff) | |
| download | rust-158b085f06a41004ebf36d87afa3548f8b60861a.tar.gz rust-158b085f06a41004ebf36d87afa3548f8b60861a.zip | |
Fix more merge conflicts
Diffstat (limited to 'src/test/run-pass')
| -rw-r--r-- | src/test/run-pass/auxiliary/issue-41394.rs | 26 | ||||
| -rw-r--r-- | src/test/run-pass/const-pattern-variant.rs | 38 | ||||
| -rw-r--r-- | src/test/run-pass/issue-23898.rs | 17 | ||||
| -rw-r--r-- | src/test/run-pass/issue-41394.rs | 17 | ||||
| -rw-r--r-- | src/test/run-pass/issue-8460.rs | 35 | ||||
| -rw-r--r-- | src/test/run-pass/sync-send-iterators-in-libcollections.rs | 19 | ||||
| -rw-r--r-- | src/test/run-pass/union/union-transmute.rs | 8 | ||||
| -rw-r--r-- | src/test/run-pass/while-let.rs | 2 |
8 files changed, 125 insertions, 37 deletions
diff --git a/src/test/run-pass/auxiliary/issue-41394.rs b/src/test/run-pass/auxiliary/issue-41394.rs new file mode 100644 index 00000000000..f06b81279ac --- /dev/null +++ b/src/test/run-pass/auxiliary/issue-41394.rs @@ -0,0 +1,26 @@ +// Copyright 2017 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. + +#![crate_type = "lib"] + +#[repr(u32)] +pub enum Foo { + Foo = Private::Variant as u32 +} + +#[repr(u8)] +enum Private { + Variant = 42 +} + +#[inline(always)] +pub fn foo() -> Foo { + Foo::Foo +} diff --git a/src/test/run-pass/const-pattern-variant.rs b/src/test/run-pass/const-pattern-variant.rs new file mode 100644 index 00000000000..104ab6e19db --- /dev/null +++ b/src/test/run-pass/const-pattern-variant.rs @@ -0,0 +1,38 @@ +// Copyright 2015 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. + +#![feature(const_fn)] + +#[derive(PartialEq, Eq)] +enum Cake { + BlackForest, + Marmor, +} +use Cake::*; + +const BOO: (Cake, Cake) = (Marmor, BlackForest); +const FOO: Cake = BOO.1; + +const fn foo() -> Cake { + Marmor +} + +const WORKS: Cake = Marmor; + +const GOO: Cake = foo(); + +fn main() { + match BlackForest { + FOO => println!("hi"), + GOO => println!("meh"), + WORKS => println!("möp"), + _ => println!("bye"), + } +} diff --git a/src/test/run-pass/issue-23898.rs b/src/test/run-pass/issue-23898.rs new file mode 100644 index 00000000000..3f5546ce83d --- /dev/null +++ b/src/test/run-pass/issue-23898.rs @@ -0,0 +1,17 @@ +// 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. + +// Note: This test was used to demonstrate #5873 (now #23898). + +enum State { ST_NULL, ST_WHITESPACE } + +fn main() { + [State::ST_NULL; (State::ST_WHITESPACE as usize)]; +} diff --git a/src/test/run-pass/issue-41394.rs b/src/test/run-pass/issue-41394.rs new file mode 100644 index 00000000000..798905599a8 --- /dev/null +++ b/src/test/run-pass/issue-41394.rs @@ -0,0 +1,17 @@ +// Copyright 2017 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. + +// aux-build:issue-41394.rs + +extern crate issue_41394 as lib; + +fn main() { + assert_eq!(lib::foo() as u32, 42); +} diff --git a/src/test/run-pass/issue-8460.rs b/src/test/run-pass/issue-8460.rs index 5148be5af83..17ea5b9a794 100644 --- a/src/test/run-pass/issue-8460.rs +++ b/src/test/run-pass/issue-8460.rs @@ -9,11 +9,22 @@ // except according to those terms. // ignore-emscripten no threads support -#![feature(rustc_attrs, zero_one)] +#![feature(rustc_attrs)] -use std::num::Zero; use std::thread; +trait Int { + fn zero() -> Self; + fn one() -> Self; +} +macro_rules! doit { + ($($t:ident)*) => ($(impl Int for $t { + fn zero() -> $t { 0 } + fn one() -> $t { 1 } + })*) +} +doit! { i8 i16 i32 i64 isize } + macro_rules! check { ($($e:expr),*) => { $(assert!(thread::spawn({ @@ -24,21 +35,21 @@ macro_rules! check { fn main() { check![ - isize::min_value() / -1, - i8::min_value() / -1, - i16::min_value() / -1, - i32::min_value() / -1, - i64::min_value() / -1, + isize::min_value() / -isize::one(), + i8::min_value() / -i8::one(), + i16::min_value() / -i16::one(), + i32::min_value() / -i32::one(), + i64::min_value() / -i64::one(), 1isize / isize::zero(), 1i8 / i8::zero(), 1i16 / i16::zero(), 1i32 / i32::zero(), 1i64 / i64::zero(), - isize::min_value() % -1, - i8::min_value() % -1, - i16::min_value() % -1, - i32::min_value() % -1, - i64::min_value() % -1, + isize::min_value() % -isize::one(), + i8::min_value() % -i8::one(), + i16::min_value() % -i16::one(), + i32::min_value() % -i32::one(), + i64::min_value() % -i64::one(), 1isize % isize::zero(), 1i8 % i8::zero(), 1i16 % i16::zero(), diff --git a/src/test/run-pass/sync-send-iterators-in-libcollections.rs b/src/test/run-pass/sync-send-iterators-in-libcollections.rs index d046705c94b..ea154590dee 100644 --- a/src/test/run-pass/sync-send-iterators-in-libcollections.rs +++ b/src/test/run-pass/sync-send-iterators-in-libcollections.rs @@ -10,13 +10,12 @@ #![allow(warnings)] #![feature(collections)] -#![feature(drain, enumset, collections_bound, btree_range, vecmap)] +#![feature(drain, collections_bound, btree_range, vecmap)] extern crate collections; use collections::BinaryHeap; use collections::{BTreeMap, BTreeSet}; -use collections::EnumSet; use collections::LinkedList; use collections::String; use collections::Vec; @@ -25,7 +24,6 @@ use std::collections::HashMap; use std::collections::HashSet; use collections::Bound::Included; -use collections::enum_set::CLike; use std::mem; fn is_sync<T>(_: T) where T: Sync {} @@ -76,21 +74,6 @@ fn main() { all_sync_send!(LinkedList::<usize>::new(), iter, iter_mut, into_iter); - #[derive(Copy, Clone)] - #[repr(usize)] - #[allow(dead_code)] - enum Foo { A, B, C } - impl CLike for Foo { - fn to_usize(&self) -> usize { - *self as usize - } - - fn from_usize(v: usize) -> Foo { - unsafe { mem::transmute(v) } - } - } - all_sync_send!(EnumSet::<Foo>::new(), iter); - all_sync_send!(VecDeque::<usize>::new(), iter, iter_mut, into_iter); is_sync_send!(VecDeque::<usize>::new(), drain(..)); diff --git a/src/test/run-pass/union/union-transmute.rs b/src/test/run-pass/union/union-transmute.rs index 4eb66268ab8..7a0b4c6aaca 100644 --- a/src/test/run-pass/union/union-transmute.rs +++ b/src/test/run-pass/union/union-transmute.rs @@ -8,12 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(core_float)] -#![feature(float_extras)] #![feature(untagged_unions)] extern crate core; -use core::num::Float; +use core::f32; union U { a: (u8, u8), @@ -33,8 +31,8 @@ fn main() { assert_eq!(u.a, (2, 2)); let mut w = W { a: 0b0_11111111_00000000000000000000000 }; - assert_eq!(w.b, f32::infinity()); - w.b = f32::neg_infinity(); + assert_eq!(w.b, f32::INFINITY); + w.b = f32::NEG_INFINITY; assert_eq!(w.a, 0b1_11111111_00000000000000000000000); } } diff --git a/src/test/run-pass/while-let.rs b/src/test/run-pass/while-let.rs index 9ffba2c7999..aed6986c5fe 100644 --- a/src/test/run-pass/while-let.rs +++ b/src/test/run-pass/while-let.rs @@ -9,8 +9,6 @@ // except according to those terms. -#![feature(binary_heap_extras)] - use std::collections::BinaryHeap; fn make_pq() -> BinaryHeap<isize> { |
