tests: Move run-pass tests without naming conflicts to ui

This commit is contained in:
Vadim Petrochenkov 2019-07-27 01:33:01 +03:00
parent ca9faa52f5
commit 9be35f82c1
3226 changed files with 64 additions and 196 deletions

1
src/test/ui/issues/.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
issue-16278.rs -text

View file

@ -0,0 +1,6 @@
// no-prefer-dynamic
// compile-flags: --crate-type=lib
pub fn id<T>(t: T) -> T {
t
}

View file

@ -0,0 +1,15 @@
// no-prefer-dynamic
// compile-flags: -Ccodegen-units=2 --crate-type=lib
extern crate cgu_test;
pub mod a {
pub fn a() {
::cgu_test::id(0);
}
}
pub mod b {
pub fn a() {
::cgu_test::id(0);
}
}

View file

@ -0,0 +1,15 @@
// no-prefer-dynamic
// compile-flags: -Ccodegen-units=2 --crate-type=lib
extern crate cgu_test;
pub mod a {
pub fn a() {
::cgu_test::id(0);
}
}
pub mod b {
pub fn a() {
::cgu_test::id(0);
}
}

View file

@ -0,0 +1,3 @@
// A crate named after a built-in type.
pub struct Test;

View file

@ -0,0 +1,12 @@
#![crate_name="issue6919_3"]
// part of issue-6919.rs
pub struct C<K> where K: FnOnce() {
pub k: K,
}
fn no_op() { }
pub const D : C<fn()> = C {
k: no_op as fn()
};

View file

@ -0,0 +1,9 @@
pub struct ZeroLengthThingWithDestructor;
impl Drop for ZeroLengthThingWithDestructor {
fn drop(&mut self) {}
}
impl ZeroLengthThingWithDestructor {
pub fn new() -> ZeroLengthThingWithDestructor {
ZeroLengthThingWithDestructor
}
}

View file

@ -0,0 +1 @@
pub struct Wrap<A>(pub A);

View file

@ -0,0 +1,16 @@
#![deny(dead_code)]
mod inner {
pub trait Trait {
fn f(&self) { f(); }
}
impl Trait for isize {}
fn f() {}
}
pub fn foo() {
let a = &1isize as &inner::Trait;
a.f();
}

View file

@ -0,0 +1,18 @@
mod inner {
pub trait Trait {
fn f(&self) { f(); }
fn f_ufcs(&self) { f_ufcs(); }
}
impl Trait for isize {}
fn f() {}
fn f_ufcs() {}
}
pub fn foo<T: inner::Trait>(t: T) {
t.f();
}
pub fn foo_ufcs<T: inner::Trait>(t: T) {
T::f_ufcs(&t);
}

View file

@ -0,0 +1,28 @@
use inner::Trait;
mod inner {
pub struct Foo;
pub trait Trait {
fn f(&self);
fn f_ufcs(&self);
}
impl Trait for Foo {
fn f(&self) { }
fn f_ufcs(&self) { }
}
}
pub trait Outer {
fn foo<T: Trait>(&self, t: T) { t.f(); }
fn foo_ufcs<T: Trait>(&self, t: T) { T::f(&t); }
}
impl Outer for isize {}
pub fn foo<T: Outer>(t: T) {
t.foo(inner::Foo);
}
pub fn foo_ufcs<T: Outer>(t: T) {
T::foo_ufcs(&t, inner::Foo)
}

View file

@ -0,0 +1,28 @@
trait PrivateTrait {
fn private_trait_method(&self);
fn private_trait_method_ufcs(&self);
}
struct PrivateStruct;
impl PrivateStruct {
fn private_inherent_method(&self) { }
fn private_inherent_method_ufcs(&self) { }
}
impl PrivateTrait for PrivateStruct {
fn private_trait_method(&self) { }
fn private_trait_method_ufcs(&self) { }
}
#[inline]
pub fn public_inlinable_function() {
PrivateStruct.private_trait_method();
PrivateStruct.private_inherent_method();
}
#[inline]
pub fn public_inlinable_function_ufcs() {
PrivateStruct::private_trait_method(&PrivateStruct);
PrivateStruct::private_inherent_method(&PrivateStruct);
}

View file

@ -0,0 +1,10 @@
pub struct Closed01<F>(pub F);
pub trait Bar { fn new() -> Self; }
impl<T: Bar> Bar for Closed01<T> {
fn new() -> Closed01<T> { Closed01(Bar::new()) }
}
impl Bar for f32 { fn new() -> f32 { 1.0 } }
pub fn random<T: Bar>() -> T { Bar::new() }

View file

@ -0,0 +1 @@
pub struct A<'a>(pub &'a isize);

View file

@ -0,0 +1 @@
#![crate_type = "dylib"]

View file

@ -0,0 +1,6 @@
// no-prefer-dynamic
#![crate_type = "dylib"]
extern crate issue_12133_rlib as a;
extern crate issue_12133_dylib as b;

View file

@ -0,0 +1,3 @@
// no-prefer-dynamic
#![crate_type = "rlib"]

View file

@ -0,0 +1,3 @@
pub mod bar {
pub fn foo() {}
}

View file

@ -0,0 +1 @@
pub fn baz() {}

View file

@ -0,0 +1,11 @@
#![crate_type="lib"]
#![crate_name="issue12660aux"]
pub use my_mod::{MyStruct, my_fn};
mod my_mod {
pub struct MyStruct;
pub fn my_fn(my_struct: MyStruct) {
}
}

View file

@ -0,0 +1,87 @@
pub mod testtypes {
use std::any::TypeId;
pub fn type_ids() -> Vec<TypeId> {
vec![
TypeId::of::<FooBool>(),
TypeId::of::<FooInt>(),
TypeId::of::<FooUint>(),
TypeId::of::<FooFloat>(),
TypeId::of::<FooStr>(),
TypeId::of::<FooArray>(),
TypeId::of::<FooSlice>(),
TypeId::of::<FooBox>(),
TypeId::of::<FooPtr>(),
TypeId::of::<FooRef>(),
TypeId::of::<FooFnPtr>(),
TypeId::of::<FooNil>(),
TypeId::of::<FooTuple>(),
TypeId::of::<FooTrait>(),
TypeId::of::<FooStruct>(),
TypeId::of::<FooEnum>()
]
}
// Tests Bool
pub type FooBool = bool;
// Tests Char
pub type FooChar = char;
// Tests Int (does not test all variants of IntTy)
pub type FooInt = isize;
// Tests Uint (does not test all variants of UintTy)
pub type FooUint = usize;
// Tests Float (does not test all variants of FloatTy)
pub type FooFloat = f64;
// Tests Str
pub type FooStr = str;
// Tests Array
pub type FooArray = [u8; 1];
// Tests Slice
pub type FooSlice = [u8];
// Tests Box (of u8)
pub type FooBox = Box<u8>;
// Tests RawPtr
pub type FooPtr = *const u8;
// Tests Ref
pub type FooRef = &'static u8;
// Tests FnPtr
pub type FooFnPtr = fn(u8) -> bool;
// Tests Dynamic
pub trait FooTrait {
fn foo_method(&self) -> usize;
}
// Tests struct
pub struct FooStruct {
pub pub_foo_field: usize,
foo_field: usize
}
// Tests enum
pub enum FooEnum {
VarA(usize),
VarB(usize, usize)
}
// Tests Tuple
pub type FooNil = ();
pub type FooTuple = (u8, i8, bool);
// Skipping Param
// Skipping Infer
// Skipping Error
}

View file

@ -0,0 +1,9 @@
pub struct Foo {
pub foo: extern fn()
}
extern fn the_foo() {}
pub const FOO: Foo = Foo {
foo: the_foo
};

View file

@ -0,0 +1,3 @@
extern crate issue_13620_1 as crate1;
pub static FOO2: crate1::Foo = crate1::FOO;

View file

@ -0,0 +1 @@
pub enum A { B }

View file

@ -0,0 +1,3 @@
extern crate issue_13872_1 as foo;
pub use foo::A::B;

View file

@ -0,0 +1,9 @@
extern crate issue_13872_2 as bar;
use bar::B;
pub fn foo() {
match B {
B => {}
}
}

View file

@ -0,0 +1,5 @@
// no-prefer-dynamic
#![crate_type = "rlib"]
pub fn foo() {}

View file

@ -0,0 +1,3 @@
extern crate issue_14344_1;
pub fn bar() {}

View file

@ -0,0 +1,25 @@
#![crate_type="lib"]
#![deny(warnings)]
#![allow(dead_code)]
pub use src::aliases::B;
pub use src::hidden_core::make;
mod src {
pub mod aliases {
use super::hidden_core::A;
pub type B = A<f32>;
}
pub mod hidden_core {
use super::aliases::B;
pub struct A<T> { t: T }
pub fn make() -> B { A { t: 1.0 } }
impl<T> A<T> {
pub fn foo(&mut self) { println!("called foo"); }
}
}
}

View file

@ -0,0 +1,25 @@
#![crate_type="lib"]
#![deny(warnings)]
pub use src::aliases::B;
pub use src::hidden_core::make;
mod src {
pub mod aliases {
use super::hidden_core::A;
pub type B = A;
}
pub mod hidden_core {
use super::aliases::B;
#[derive(Copy, Clone)]
pub struct A;
pub fn make() -> B { A }
impl A {
pub fn foo(&mut self) { println!("called foo"); }
}
}
}

View file

@ -0,0 +1,5 @@
#![crate_type = "lib"]
extern {
pub fn transmute();
}

View file

@ -0,0 +1,19 @@
#![crate_type = "lib"]
pub struct TreeBuilder<H> { pub h: H }
impl<H> TreeBuilder<H> {
pub fn process_token(&mut self) {
match self {
_ => for _y in self.by_ref() {}
}
}
}
impl<H> Iterator for TreeBuilder<H> {
type Item = H;
fn next(&mut self) -> Option<H> {
None
}
}

View file

@ -0,0 +1,12 @@
#![crate_type = "lib"]
pub trait Foo<'a, T> {
fn foo(&'a self) -> T;
}
pub fn foo<'a, T>(x: &'a Foo<'a, T>) -> T {
let x: &'a Foo<T> = x;
// ^ the lifetime parameter of Foo is left to be inferred.
x.foo()
// ^ encoding this method call in metadata triggers an ICE.
}

View file

@ -0,0 +1,10 @@
use std::sync::atomic;
pub const C1: usize = 1;
pub const C2: atomic::AtomicUsize = atomic::AtomicUsize::new(0);
pub const C3: fn() = { fn foo() {} foo };
pub const C4: usize = C1 * C1 + C1 / C1;
pub const C5: &'static usize = &C4;
pub static S1: usize = 3;
pub static S2: atomic::AtomicUsize = atomic::AtomicUsize::new(0);

View file

@ -0,0 +1,17 @@
#![crate_type = "rlib"]
struct Foo;
trait Tr {
fn tr(&self);
}
impl Tr for Foo {
fn tr(&self) {}
}
fn take_method<T>(f: fn(&T), t: &T) {}
#[inline]
pub fn pass_method() {
take_method(Tr::tr, &Foo);
}

View file

@ -0,0 +1,17 @@
#![crate_type = "rlib"]
pub trait Tr {
fn tr(&self);
}
pub struct St<V>(pub Vec<V>);
impl<V> Tr for St<V> {
fn tr(&self) {
match self {
&St(ref v) => {
v.iter();
}
}
}
}

View file

@ -0,0 +1,5 @@
#![crate_type = "rlib"]
pub fn inner<F>(f: F) -> F {
(move || f)()
}

View file

@ -0,0 +1,6 @@
// no-prefer-dynamic
#![crate_type = "rlib"]
#![crate_name = "foo"]
pub fn foo() -> i32 { 0 }

View file

@ -0,0 +1,6 @@
// no-prefer-dynamic
#![crate_type = "rlib"]
#![crate_name = "foo"]
pub fn foo() -> i32 { 1 }

View file

@ -0,0 +1,4 @@
pub struct Foo (pub isize);
pub enum MyEnum {
Foo(Foo),
}

View file

@ -0,0 +1,3 @@
pub enum Homura {
Madoka { name: String },
}

View file

@ -0,0 +1,4 @@
pub trait T {
type C;
fn dummy(&self) { }
}

View file

@ -0,0 +1,18 @@
fn foo(_x: i32) {
}
pub struct rsrc {
x: i32,
}
impl Drop for rsrc {
fn drop(&mut self) {
foo(self.x);
}
}
pub fn rsrc(x: i32) -> rsrc {
rsrc {
x: x
}
}

View file

@ -0,0 +1,3 @@
enum cat {
tabby, calico, tortoiseshell
}

View file

@ -0,0 +1,11 @@
#![allow(unused_imports)]
extern crate issue_2316_a;
pub mod cloth {
use issue_2316_a::*;
pub enum fabric {
gingham, flannel, calico
}
}

View file

@ -0,0 +1,15 @@
#![crate_name="a"]
#![crate_type = "lib"]
#![feature(box_syntax)]
pub trait i<T>
{
fn dummy(&self, t: T) -> T { panic!() }
}
pub fn f<T>() -> Box<i<T>+'static> {
impl<T> i<T> for () { }
box () as Box<i<T>+'static>
}

View file

@ -0,0 +1,12 @@
#![crate_name="a"]
#![crate_type = "lib"]
type t1 = usize;
trait foo {
fn foo(&self);
}
impl foo for String {
fn foo(&self) {}
}

View file

@ -0,0 +1,4 @@
#![crate_name="b"]
#![crate_type = "lib"]
extern crate a;

View file

@ -0,0 +1,13 @@
pub struct S(pub ());
impl S {
pub fn foo(&self) { }
}
pub trait T {
fn bar(&self);
}
impl T for S {
fn bar(&self) { }
}

View file

@ -0,0 +1,8 @@
// no-prefer-dynamic
#![crate_type = "rlib"]
#[link(name = "rust_test_helpers", kind = "static")]
extern {
pub fn rust_dbg_extern_identity_u32(u: u32) -> u32;
}

View file

@ -0,0 +1,3 @@
extern crate issue_25185_1;
pub use issue_25185_1::rust_dbg_extern_identity_u32;

View file

@ -0,0 +1,44 @@
#![crate_name="issue_2526"]
#![crate_type = "lib"]
use std::marker;
pub struct arc_destruct<T: Sync> {
_data: isize,
_marker: marker::PhantomData<T>
}
impl<T: Sync> Drop for arc_destruct<T> {
fn drop(&mut self) {}
}
fn arc_destruct<T: Sync>(data: isize) -> arc_destruct<T> {
arc_destruct {
_data: data,
_marker: marker::PhantomData
}
}
fn arc<T: Sync>(_data: T) -> arc_destruct<T> {
arc_destruct(0)
}
fn init() -> arc_destruct<context_res> {
arc(context_res())
}
pub struct context_res {
ctx : isize,
}
impl Drop for context_res {
fn drop(&mut self) {}
}
fn context_res() -> context_res {
context_res {
ctx: 0
}
}
pub type context = arc_destruct<context_res>;

View file

@ -0,0 +1,10 @@
#![crate_type="lib"]
pub trait Trait {
// the issue is sensitive to interning order - so use names
// unlikely to appear in libstd.
type Issue25467FooT;
type Issue25467BarT;
}
pub type Object = Option<Box<Trait<Issue25467FooT=(),Issue25467BarT=()>>>;

View file

@ -0,0 +1,14 @@
#![crate_name="req"]
#![crate_type = "lib"]
use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;
pub type header_map = HashMap<String, Rc<RefCell<Vec<Rc<String>>>>>;
// the unused ty param is necessary so this gets monomorphized
pub fn request<T>(req: &header_map) {
let data = req[&"METHOD".to_string()].clone();
let _x = data.borrow().clone()[0].clone();
}

View file

@ -0,0 +1,3 @@
pub unsafe fn f(xs: Vec<isize> ) {
xs.iter().map(|_x| { unsafe fn q() { panic!(); } }).collect::<Vec<()>>();
}

View file

@ -0,0 +1,16 @@
#![crate_name="a"]
#![crate_type = "lib"]
pub struct X(pub u8);
impl Drop for X {
fn drop(&mut self) {
assert_eq!(self.0, 1)
}
}
pub fn f(x: &mut X, g: fn()) {
x.0 = 1;
g();
x.0 = 0;
}

View file

@ -0,0 +1,20 @@
#![crate_name="socketlib"]
#![crate_type = "lib"]
pub mod socket {
pub struct socket_handle {
sockfd: u32,
}
impl Drop for socket_handle {
fn drop(&mut self) {
/* c::close(self.sockfd); */
}
}
pub fn socket_handle(x: u32) -> socket_handle {
socket_handle {
sockfd: x
}
}
}

View file

@ -0,0 +1,4 @@
#![crate_type = "lib"]
#[path = "issue-3136-a.rs"]
pub mod issue_3136_a;

View file

@ -0,0 +1,14 @@
trait x {
fn use_x<T>(&self);
}
struct y(());
impl x for y {
fn use_x<T>(&self) {
struct foo { //~ ERROR quux
i: ()
}
fn new_foo<T>(i: ()) -> foo {
foo { i: i }
}
}
}

View file

@ -0,0 +1,16 @@
#[derive(Copy)]
pub struct U256(pub [u64; 4]);
impl Clone for U256 {
fn clone(&self) -> U256 {
*self
}
}
impl U256 {
pub fn new(value: u64) -> U256 {
let mut ret = [0; 4];
ret[0] = value;
U256(ret)
}
}

View file

@ -0,0 +1,20 @@
// compile-flags: -g
extern crate issue_31702_1;
use std::collections::HashMap;
use issue_31702_1::U256;
pub struct Ethash {
engine_params: fn() -> Option<&'static Vec<u8>>,
u256_params: HashMap<String, U256>,
}
impl Ethash {
pub fn u256_param(&mut self, name: &str) -> U256 {
let engine = self.engine_params;
*self.u256_params.entry(name.to_owned()).or_insert_with(|| {
engine().map_or(U256::new(0u64), |_a| loop {})
})
}
}

View file

@ -0,0 +1,20 @@
#![crate_type = "lib"]
pub trait Future {
type Item;
type Error;
}
impl Future for u32 {
type Item = ();
type Error = Box<()>;
}
fn foo() -> Box<Future<Item=(), Error=Box<()>>> {
Box::new(0u32)
}
pub fn bar<F, A, B>(_s: F)
where F: Fn(A) -> B,
{
foo();
}

View file

@ -0,0 +1,7 @@
#![crate_type = "lib"]
const fn foo(i: i32) -> i32 {
i
}
pub const FOO: i32 = foo(1);

View file

@ -0,0 +1,2 @@
#[macro_export]
macro_rules! m { ([$i:item]) => {} }

View file

@ -0,0 +1,23 @@
#![crate_type="rlib"]
#[inline(never)]
pub fn foo<T>() {
let _: Box<SomeTrait> = Box::new(SomeTraitImpl);
}
pub fn bar() {
SomeTraitImpl.bar();
}
mod submod {
pub trait SomeTrait {
fn bar(&self) {
panic!("NO")
}
}
}
use self::submod::SomeTrait;
pub struct SomeTraitImpl;
impl SomeTrait for SomeTraitImpl {}

View file

@ -0,0 +1,7 @@
#![allow(duplicate_macro_exports)]
#[macro_export]
macro_rules! foo_modern { ($i:ident) => {} }
#[macro_export]
macro_rules! foo_modern { () => {} }

View file

@ -0,0 +1,7 @@
#![allow(duplicate_macro_exports)]
#[macro_export]
macro_rules! foo { ($i:ident) => {} }
#[macro_export]
macro_rules! foo { () => {} }

View file

@ -0,0 +1,15 @@
#![crate_name="issue_3979_traits"]
#![crate_type = "lib"]
pub trait Positioned {
fn SetX(&mut self, _: isize);
fn X(&self) -> isize;
}
pub trait Movable: Positioned {
fn translate(&mut self, dx: isize) {
let x = self.X() + dx;
self.SetX(x);
}
}

View file

@ -0,0 +1,7 @@
#![crate_type="rlib"]
#[derive(Debug, PartialEq)]
pub struct RemoteC(pub u32);
#[derive(Debug, PartialEq)]
pub struct RemoteG<T>(pub T);

View file

@ -0,0 +1 @@
macro_rules! m { () => { $crate::main(); } }

View file

@ -0,0 +1 @@
pub struct Test;

View file

@ -0,0 +1,16 @@
#![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
}

View file

@ -0,0 +1,4 @@
#[repr(u8)]
pub enum E {
B = 1 as u8,
}

View file

@ -0,0 +1,10 @@
#![crate_name="numeric"]
#![crate_type = "lib"]
pub trait Trig<T> {
fn sin(&self) -> T;
}
pub fn sin<T:Trig<R>, R>(theta: &T) -> R { theta.sin() }
pub trait Angle<T>: Trig<T> {}

View file

@ -0,0 +1,2 @@
pub struct S<T>(Option<T>);
pub fn mk<T>() -> S<T> { S(None) }

View file

@ -0,0 +1,6 @@
#![crate_type = "lib"]
#![crate_name = "issue48984aux"]
pub trait Foo { type Item; }
pub trait Bar: Foo<Item=[u8;1]> { }

View file

@ -0,0 +1,4 @@
trait A<'a, T> {
fn f(&mut self) -> &'a mut T;
fn p() -> T;
}

View file

@ -0,0 +1,3 @@
use std::collections::HashMap;
pub type map = Box<HashMap<usize, usize>>;

View file

@ -0,0 +1,7 @@
pub struct Foo<'a, A:'a>(&'a A);
impl<'a, A> Foo<'a, A> {
pub fn new(a: &'a A) -> Foo<'a, A> {
Foo(a)
}
}

View file

@ -0,0 +1 @@
pub struct V2<T>(pub T, pub T);

View file

@ -0,0 +1,15 @@
pub struct BTree<V> {
pub node: TreeItem<V>,
}
pub enum TreeItem<V> {
TreeLeaf { value: V },
}
pub fn leaf<V>(value: V) -> TreeItem<V> {
TreeItem::TreeLeaf { value: value }
}
fn main() {
BTree::<isize> { node: leaf(1) };
}

View file

@ -0,0 +1,4 @@
pub enum Foo<'a> {
A,
B(&'a str),
}

View file

@ -0,0 +1,16 @@
// for this issue, this code must be built in a library
use std::mem;
trait A {
fn dummy(&self) { }
}
struct B;
impl A for B {}
fn bar<T>(_: &mut A, _: &T) {}
fn foo<T>(t: &T) {
let mut b = B;
bar(&mut b as &mut A, t)
}

View file

@ -0,0 +1,9 @@
#![crate_type = "lib"]
pub trait X {
fn x() {
fn f() { }
f();
}
fn dummy(&self) { }
}

View file

@ -0,0 +1,7 @@
pub struct Foo<T>(T);
impl<T> Foo<T> {
pub fn new(t: T) -> Foo<T> {
Foo(t)
}
}

View file

@ -0,0 +1,13 @@
pub fn foo<T>() -> &'static isize {
if false {
static a: isize = 4;
return &a;
} else {
static a: isize = 5;
return &a;
}
}
pub fn bar() -> &'static isize {
foo::<isize>()
}

View file

@ -0,0 +1,15 @@
pub use other::FooBar;
pub use other::foo;
mod other {
pub struct FooBar{value: isize}
impl FooBar{
pub fn new(val: isize) -> FooBar {
FooBar{value: val}
}
}
pub fn foo(){
1+1;
}
}

View file

@ -0,0 +1,22 @@
pub use internal::core::{Trait, Struct};
mod internal {
pub mod core {
pub struct Struct;
impl Struct {
pub fn init() -> Struct {
Struct
}
}
pub trait Trait {
fn test(&self) {
private();
}
}
impl Trait for Struct {}
fn private() { }
}
}

View file

@ -0,0 +1,11 @@
// run-pass
#![allow(dead_code)]
// pretty-expanded FIXME #23616
unsafe extern fn foo() {}
unsafe extern "C" fn bar() {}
fn main() {
let _a: unsafe extern fn() = foo;
let _a: unsafe extern "C" fn() = foo;
}

View file

@ -0,0 +1,21 @@
// run-pass
#![allow(dead_code)]
// aux-build:issue-10028.rs
// pretty-expanded FIXME #23616
extern crate issue_10028 as issue10028;
use issue10028::ZeroLengthThingWithDestructor;
struct Foo {
zero_length_thing: ZeroLengthThingWithDestructor
}
fn make_foo() -> Foo {
Foo { zero_length_thing: ZeroLengthThingWithDestructor::new() }
}
fn main() {
let _f:Foo = make_foo();
}

View file

@ -0,0 +1,9 @@
// run-pass
// aux-build:issue-10031-aux.rs
// pretty-expanded FIXME #23616
extern crate issue_10031_aux;
pub fn main() {
let _ = issue_10031_aux::Wrap(());
}

View file

@ -0,0 +1,20 @@
// run-pass
#![allow(dead_code)]
#![allow(unused_variables)]
// pretty-expanded FIXME #23616
enum StdioContainer {
CreatePipe(bool)
}
struct Test<'a> {
args: &'a [String],
io: &'a [StdioContainer]
}
pub fn main() {
let test = Test {
args: &[],
io: &[StdioContainer::CreatePipe(true)]
};
}

View file

@ -0,0 +1,30 @@
// run-pass
#![allow(unused_variables)]
struct A { foo: isize }
struct B { a: isize, b: isize, c: isize }
fn mka() -> A { panic!() }
fn mkb() -> B { panic!() }
fn test() {
let A { foo, } = mka();
let A {
foo,
} = mka();
let B { a, b, c, } = mkb();
match mka() {
A { foo: _foo, } => {}
}
match Some(mka()) {
Some(A { foo: _foo, }) => {}
None => {}
}
}
pub fn main() {
if false { test() }
}

View file

@ -0,0 +1,11 @@
// run-pass
fn works<T>(x: T) -> Vec<T> { vec![x] }
fn also_works<T: Clone>(x: T) -> Vec<T> { vec![x] }
fn main() {
let _: Vec<usize> = works(0);
let _: Vec<usize> = also_works(0);
let _ = works(0);
let _ = also_works(0);
}

View file

@ -0,0 +1,27 @@
// run-pass
// ignore-cloudabi no processes
// ignore-emscripten no processes
// ignore-sgx no processes
// Make sure that if a process doesn't have its stdio/stderr descriptors set up
// that we don't die in a large ball of fire
use std::env;
use std::process::{Command, Stdio};
pub fn main () {
let args: Vec<String> = env::args().collect();
if args.len() > 1 && args[1] == "child" {
for _ in 0..1000 {
println!("hello?");
}
for _ in 0..1000 {
println!("hello?");
}
return;
}
let mut p = Command::new(&args[0]);
p.arg("child").stdout(Stdio::null()).stderr(Stdio::null());
println!("{:?}", p.spawn().unwrap().wait());
}

View file

@ -0,0 +1,11 @@
// run-pass
// pretty-expanded FIXME #23616
pub fn main() {
//// I am not a doc comment!
////////////////// still not a doc comment
/////**** nope, me neither */
/*** And neither am I! */
5;
/*****! certainly not I */
}

View file

@ -0,0 +1,15 @@
// run-pass
// Regression test for issue #10682
// Nested `proc` usage can't use outer owned data
// pretty-expanded FIXME #23616
#![feature(box_syntax)]
fn work(_: Box<isize>) {}
fn foo<F:FnOnce()>(_: F) {}
pub fn main() {
let a = box 1;
foo(move|| { foo(move|| { work(a) }) })
}

View file

@ -0,0 +1,11 @@
// run-pass
// pretty-expanded FIXME #23616
static NAME: &'static str = "hello world";
fn main() {
match &*NAME.to_ascii_lowercase() {
"foo" => {}
_ => {}
}
}

View file

@ -0,0 +1,11 @@
// run-pass
// pretty-expanded FIXME #23616
fn f<F:FnOnce()>(p: F) {
p();
}
pub fn main() {
let p = || ();
f(p);
}

View file

@ -0,0 +1,36 @@
// run-pass
#![allow(non_upper_case_globals)]
static mut drop_count: usize = 0;
struct Foo {
dropped: bool
}
impl Drop for Foo {
fn drop(&mut self) {
// Test to make sure we haven't dropped already
assert!(!self.dropped);
self.dropped = true;
// And record the fact that we dropped for verification later
unsafe { drop_count += 1; }
}
}
pub fn main() {
// An `if true { expr }` statement should compile the same as `{ expr }`.
if true {
let _a = Foo{ dropped: false };
}
// Check that we dropped already (as expected from a `{ expr }`).
unsafe { assert_eq!(drop_count, 1); }
// An `if false {} else { expr }` statement should compile the same as `{ expr }`.
if false {
panic!();
} else {
let _a = Foo{ dropped: false };
}
// Check that we dropped already (as expected from a `{ expr }`).
unsafe { assert_eq!(drop_count, 2); }
}

Some files were not shown because too many files have changed in this diff Show more