diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2016-04-26 10:51:14 -0700 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2016-05-06 16:24:48 -0400 |
| commit | fbc082dcc65d5bb37a4af09b731b01e860b8c5bf (patch) | |
| tree | 0ba4a400b7d8863f55a892ee6deeaa7733d7ac18 /src/test/codegen-units | |
| parent | 77ae7591a88a87f901cfd1e6a8a9e77a944a49b4 (diff) | |
| download | rust-fbc082dcc65d5bb37a4af09b731b01e860b8c5bf.tar.gz rust-fbc082dcc65d5bb37a4af09b731b01e860b8c5bf.zip | |
move auxiliary builds to a test-relative `aux`
Instead of finding aux-build files in `auxiliary`, we now search for an `aux` directory relative to the test. So if your test is `compile-fail/foo.rs`, we would look in `compile-fail/aux`. Similarly, we ignore the `aux` directory when searching for tets.
Diffstat (limited to 'src/test/codegen-units')
6 files changed, 178 insertions, 0 deletions
diff --git a/src/test/codegen-units/item-collection/aux/cgu_export_trait_method.rs b/src/test/codegen-units/item-collection/aux/cgu_export_trait_method.rs new file mode 100644 index 00000000000..49b8e43836e --- /dev/null +++ b/src/test/codegen-units/item-collection/aux/cgu_export_trait_method.rs @@ -0,0 +1,34 @@ +// Copyright 2012-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. + +#![crate_type = "lib"] + +pub trait Trait : Sized { + fn without_self() -> u32; + fn without_self_default() -> u32 { 0 } + + fn with_default_impl(self) -> Self { self } + fn with_default_impl_generic<T>(self, x: T) -> (Self, T) { (self, x) } + + fn without_default_impl(x: u32) -> (Self, u32); + fn without_default_impl_generic<T>(x: T) -> (Self, T); +} + +impl Trait for char { + fn without_self() -> u32 { 2 } + fn without_default_impl(x: u32) -> (Self, u32) { ('c', x) } + fn without_default_impl_generic<T>(x: T) -> (Self, T) { ('c', x) } +} + +impl Trait for u32 { + fn without_self() -> u32 { 1 } + fn without_default_impl(x: u32) -> (Self, u32) { (0, x) } + fn without_default_impl_generic<T>(x: T) -> (Self, T) { (0, x) } +} diff --git a/src/test/codegen-units/item-collection/aux/cgu_extern_closures.rs b/src/test/codegen-units/item-collection/aux/cgu_extern_closures.rs new file mode 100644 index 00000000000..944d85db508 --- /dev/null +++ b/src/test/codegen-units/item-collection/aux/cgu_extern_closures.rs @@ -0,0 +1,33 @@ +// Copyright 2012-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. + +#![crate_type = "lib"] + +#[inline] +pub fn inlined_fn(x: i32, y: i32) -> i32 { + + let closure = |a, b| { a + b }; + + closure(x, y) +} + +pub fn inlined_fn_generic<T>(x: i32, y: i32, z: T) -> (i32, T) { + + let closure = |a, b| { a + b }; + + (closure(x, y), z) +} + +pub fn non_inlined_fn(x: i32, y: i32) -> i32 { + + let closure = |a, b| { a + b }; + + closure(x, y) +} diff --git a/src/test/codegen-units/item-collection/aux/cgu_generic_function.rs b/src/test/codegen-units/item-collection/aux/cgu_generic_function.rs new file mode 100644 index 00000000000..04c68748eca --- /dev/null +++ b/src/test/codegen-units/item-collection/aux/cgu_generic_function.rs @@ -0,0 +1,37 @@ +// Copyright 2012-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. + +#![crate_type = "lib"] + +struct Struct(u32); + +#[inline(never)] +pub fn foo<T>(x: T) -> (T, u32, i8) { + let (x, Struct(y)) = bar(x); + (x, y, 2) +} + +#[inline(never)] +fn bar<T>(x: T) -> (T, Struct) { + let _ = not_exported_and_not_generic(0); + (x, Struct(1)) +} + +// These should not contribute to the codegen items of other crates. +#[inline(never)] +pub fn exported_but_not_generic(x: i32) -> i64 { + x as i64 +} + +#[inline(never)] +fn not_exported_and_not_generic(x: u32) -> u64 { + x as u64 +} + diff --git a/src/test/codegen-units/partitioning/aux/cgu_explicit_inlining.rs b/src/test/codegen-units/partitioning/aux/cgu_explicit_inlining.rs new file mode 100644 index 00000000000..e4ba9fae412 --- /dev/null +++ b/src/test/codegen-units/partitioning/aux/cgu_explicit_inlining.rs @@ -0,0 +1,20 @@ +// Copyright 2012-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. + +#![crate_type = "lib"] + +#[inline] +pub fn inlined() {} + +#[inline(always)] +pub fn always_inlined() {} + +#[inline(never)] +pub fn never_inlined() {} diff --git a/src/test/codegen-units/partitioning/aux/cgu_extern_drop_glue.rs b/src/test/codegen-units/partitioning/aux/cgu_extern_drop_glue.rs new file mode 100644 index 00000000000..049bdb46579 --- /dev/null +++ b/src/test/codegen-units/partitioning/aux/cgu_extern_drop_glue.rs @@ -0,0 +1,17 @@ +// Copyright 2012-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. + +#![crate_type = "lib"] + +pub struct Struct(pub u32); + +impl Drop for Struct { + fn drop(&mut self) {} +} diff --git a/src/test/codegen-units/partitioning/aux/cgu_generic_function.rs b/src/test/codegen-units/partitioning/aux/cgu_generic_function.rs new file mode 100644 index 00000000000..04c68748eca --- /dev/null +++ b/src/test/codegen-units/partitioning/aux/cgu_generic_function.rs @@ -0,0 +1,37 @@ +// Copyright 2012-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. + +#![crate_type = "lib"] + +struct Struct(u32); + +#[inline(never)] +pub fn foo<T>(x: T) -> (T, u32, i8) { + let (x, Struct(y)) = bar(x); + (x, y, 2) +} + +#[inline(never)] +fn bar<T>(x: T) -> (T, Struct) { + let _ = not_exported_and_not_generic(0); + (x, Struct(1)) +} + +// These should not contribute to the codegen items of other crates. +#[inline(never)] +pub fn exported_but_not_generic(x: i32) -> i64 { + x as i64 +} + +#[inline(never)] +fn not_exported_and_not_generic(x: u32) -> u64 { + x as u64 +} + |
