Skip to content

Commit fbc082d

Browse files
committed
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.
1 parent 77ae759 commit fbc082d

File tree

360 files changed

+9641
-44
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

360 files changed

+9641
-44
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright 2012-2015 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.
4+
//
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.
10+
11+
#![crate_type = "lib"]
12+
13+
pub trait Trait : Sized {
14+
fn without_self() -> u32;
15+
fn without_self_default() -> u32 { 0 }
16+
17+
fn with_default_impl(self) -> Self { self }
18+
fn with_default_impl_generic<T>(self, x: T) -> (Self, T) { (self, x) }
19+
20+
fn without_default_impl(x: u32) -> (Self, u32);
21+
fn without_default_impl_generic<T>(x: T) -> (Self, T);
22+
}
23+
24+
impl Trait for char {
25+
fn without_self() -> u32 { 2 }
26+
fn without_default_impl(x: u32) -> (Self, u32) { ('c', x) }
27+
fn without_default_impl_generic<T>(x: T) -> (Self, T) { ('c', x) }
28+
}
29+
30+
impl Trait for u32 {
31+
fn without_self() -> u32 { 1 }
32+
fn without_default_impl(x: u32) -> (Self, u32) { (0, x) }
33+
fn without_default_impl_generic<T>(x: T) -> (Self, T) { (0, x) }
34+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright 2012-2015 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.
4+
//
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.
10+
11+
#![crate_type = "lib"]
12+
13+
#[inline]
14+
pub fn inlined_fn(x: i32, y: i32) -> i32 {
15+
16+
let closure = |a, b| { a + b };
17+
18+
closure(x, y)
19+
}
20+
21+
pub fn inlined_fn_generic<T>(x: i32, y: i32, z: T) -> (i32, T) {
22+
23+
let closure = |a, b| { a + b };
24+
25+
(closure(x, y), z)
26+
}
27+
28+
pub fn non_inlined_fn(x: i32, y: i32) -> i32 {
29+
30+
let closure = |a, b| { a + b };
31+
32+
closure(x, y)
33+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2012-2015 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.
4+
//
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.
10+
11+
#![crate_type = "lib"]
12+
13+
struct Struct(u32);
14+
15+
#[inline(never)]
16+
pub fn foo<T>(x: T) -> (T, u32, i8) {
17+
let (x, Struct(y)) = bar(x);
18+
(x, y, 2)
19+
}
20+
21+
#[inline(never)]
22+
fn bar<T>(x: T) -> (T, Struct) {
23+
let _ = not_exported_and_not_generic(0);
24+
(x, Struct(1))
25+
}
26+
27+
// These should not contribute to the codegen items of other crates.
28+
#[inline(never)]
29+
pub fn exported_but_not_generic(x: i32) -> i64 {
30+
x as i64
31+
}
32+
33+
#[inline(never)]
34+
fn not_exported_and_not_generic(x: u32) -> u64 {
35+
x as u64
36+
}
37+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2012-2015 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.
4+
//
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.
10+
11+
#![crate_type = "lib"]
12+
13+
#[inline]
14+
pub fn inlined() {}
15+
16+
#[inline(always)]
17+
pub fn always_inlined() {}
18+
19+
#[inline(never)]
20+
pub fn never_inlined() {}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2012-2015 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.
4+
//
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.
10+
11+
#![crate_type = "lib"]
12+
13+
pub struct Struct(pub u32);
14+
15+
impl Drop for Struct {
16+
fn drop(&mut self) {}
17+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2012-2015 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.
4+
//
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.
10+
11+
#![crate_type = "lib"]
12+
13+
struct Struct(u32);
14+
15+
#[inline(never)]
16+
pub fn foo<T>(x: T) -> (T, u32, i8) {
17+
let (x, Struct(y)) = bar(x);
18+
(x, y, 2)
19+
}
20+
21+
#[inline(never)]
22+
fn bar<T>(x: T) -> (T, Struct) {
23+
let _ = not_exported_and_not_generic(0);
24+
(x, Struct(1))
25+
}
26+
27+
// These should not contribute to the codegen items of other crates.
28+
#[inline(never)]
29+
pub fn exported_but_not_generic(x: i32) -> i64 {
30+
x as i64
31+
}
32+
33+
#[inline(never)]
34+
fn not_exported_and_not_generic(x: u32) -> u64 {
35+
x as u64
36+
}
37+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2014 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.
4+
//
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.
10+
11+
// force-host
12+
13+
#![feature(plugin_registrar)]
14+
#![feature(rustc_private)]
15+
16+
extern crate syntax;
17+
18+
extern crate rustc;
19+
extern crate rustc_plugin;
20+
21+
use syntax::feature_gate::AttributeType;
22+
use rustc_plugin::Registry;
23+
24+
25+
26+
#[plugin_registrar]
27+
pub fn plugin_registrar(reg: &mut Registry) {
28+
reg.register_attribute("foo".to_owned(), AttributeType::Normal);
29+
reg.register_attribute("bar".to_owned(), AttributeType::CrateLevel);
30+
reg.register_attribute("baz".to_owned(), AttributeType::Whitelisted);
31+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright 2015 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.
4+
//
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.
10+
11+
// force-host
12+
13+
#![feature(plugin_registrar, rustc_private)]
14+
#![feature(box_syntax)]
15+
16+
#[macro_use] extern crate rustc;
17+
extern crate rustc_plugin;
18+
extern crate syntax;
19+
20+
use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray};
21+
use rustc_plugin::Registry;
22+
use rustc::hir;
23+
use syntax::attr;
24+
25+
declare_lint!(CRATE_NOT_OKAY, Warn, "crate not marked with #![crate_okay]");
26+
27+
struct Pass;
28+
29+
impl LintPass for Pass {
30+
fn get_lints(&self) -> LintArray {
31+
lint_array!(CRATE_NOT_OKAY)
32+
}
33+
}
34+
35+
impl LateLintPass for Pass {
36+
fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) {
37+
if !attr::contains_name(&krate.attrs, "crate_okay") {
38+
cx.span_lint(CRATE_NOT_OKAY, krate.span,
39+
"crate is not marked with #![crate_okay]");
40+
}
41+
}
42+
}
43+
44+
#[plugin_registrar]
45+
pub fn plugin_registrar(reg: &mut Registry) {
46+
reg.register_late_lint_pass(box Pass as LateLintPassObject);
47+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Copyright 2014 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.
4+
//
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.
10+
11+
// force-host
12+
13+
#![feature(plugin_registrar)]
14+
#![feature(box_syntax, rustc_private)]
15+
16+
// Load rustc as a plugin to get macros
17+
#[macro_use]
18+
extern crate rustc;
19+
extern crate rustc_plugin;
20+
21+
use rustc::hir;
22+
use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray};
23+
use rustc_plugin::Registry;
24+
25+
declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
26+
27+
declare_lint!(PLEASE_LINT, Warn, "Warn about items named 'pleaselintme'");
28+
29+
struct Pass;
30+
31+
impl LintPass for Pass {
32+
fn get_lints(&self) -> LintArray {
33+
lint_array!(TEST_LINT, PLEASE_LINT)
34+
}
35+
}
36+
37+
impl LateLintPass for Pass {
38+
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
39+
match &*it.name.as_str() {
40+
"lintme" => cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"),
41+
"pleaselintme" => cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'"),
42+
_ => {}
43+
}
44+
}
45+
}
46+
47+
#[plugin_registrar]
48+
pub fn plugin_registrar(reg: &mut Registry) {
49+
reg.register_late_lint_pass(box Pass as LateLintPassObject);
50+
reg.register_lint_group("lint_me", vec![TEST_LINT, PLEASE_LINT]);
51+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Copyright 2014 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.
4+
//
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.
10+
11+
// force-host
12+
13+
#![feature(plugin_registrar)]
14+
#![feature(box_syntax, rustc_private)]
15+
16+
extern crate syntax;
17+
18+
// Load rustc as a plugin to get macros
19+
#[macro_use]
20+
extern crate rustc;
21+
extern crate rustc_plugin;
22+
23+
use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass,
24+
EarlyLintPassObject, LintArray};
25+
use rustc_plugin::Registry;
26+
use syntax::ast;
27+
declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
28+
29+
struct Pass;
30+
31+
impl LintPass for Pass {
32+
fn get_lints(&self) -> LintArray {
33+
lint_array!(TEST_LINT)
34+
}
35+
}
36+
37+
impl EarlyLintPass for Pass {
38+
fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) {
39+
if it.ident.name.as_str() == "lintme" {
40+
cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'");
41+
}
42+
}
43+
}
44+
45+
#[plugin_registrar]
46+
pub fn plugin_registrar(reg: &mut Registry) {
47+
reg.register_early_lint_pass(box Pass as EarlyLintPassObject);
48+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2014 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.
4+
//
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.
10+
11+
// force-host
12+
13+
#![feature(plugin_registrar, rustc_private)]
14+
15+
extern crate syntax;
16+
extern crate rustc;
17+
extern crate rustc_plugin;
18+
19+
use syntax::parse::token;
20+
use syntax::ext::base::MacroRulesTT;
21+
use rustc_plugin::Registry;
22+
23+
#[plugin_registrar]
24+
pub fn plugin_registrar(reg: &mut Registry) {
25+
reg.register_syntax_extension(token::intern("bogus"), MacroRulesTT);
26+
}

0 commit comments

Comments
 (0)