-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #33228 - nikomatsakis:compiletest-gut, r=acrichto
Move auxiliary directories to live with the tests This is a step for enabling testing of cross-crate incremental compilation. The idea is that instead of having a central auxiliary directory, when you have a `// aux-build:foo.rs` annotation in the test `run-pass/bar.rs`, it will look in (e.g.) `run-pass/aux/foo.rs`. In general, it looks for an `aux` directory in the same directory as the test. We also ignore the `aux` directories when enumerating the set of tests. As part of this PR, also refactor `runtest.rs` to use methods on a context, which means we can stop passing around context everywhere. r? @alexcrichton
- Loading branch information
Showing
371 changed files
with
2,769 additions
and
2,004 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
37 changes: 37 additions & 0 deletions
37
src/test/codegen-units/partitioning/auxiliary/cgu_generic_function.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// 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. | ||
|
||
#![feature(associated_consts)] | ||
|
||
pub use self::sub::{Bar, Baz}; | ||
|
||
pub trait Trait { | ||
fn foo(&self); | ||
type Assoc; | ||
const CONST: u32; | ||
} | ||
|
||
struct Foo; | ||
|
||
impl Foo { | ||
pub fn new() {} | ||
|
||
pub const C: u32 = 0; | ||
} | ||
|
||
mod sub { | ||
pub struct Bar; | ||
|
||
impl Bar { | ||
pub fn new() {} | ||
} | ||
|
||
pub enum Baz {} | ||
|
||
impl Baz { | ||
pub fn new() {} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// 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. | ||
|
||
// force-host | ||
|
||
#![feature(plugin_registrar, rustc_private)] | ||
#![feature(box_syntax)] | ||
|
||
#[macro_use] extern crate rustc; | ||
extern crate rustc_plugin; | ||
extern crate syntax; | ||
|
||
use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray}; | ||
use rustc_plugin::Registry; | ||
use rustc::hir; | ||
use syntax::attr; | ||
|
||
declare_lint!(CRATE_NOT_OKAY, Warn, "crate not marked with #![crate_okay]"); | ||
|
||
struct Pass; | ||
|
||
impl LintPass for Pass { | ||
fn get_lints(&self) -> LintArray { | ||
lint_array!(CRATE_NOT_OKAY) | ||
} | ||
} | ||
|
||
impl LateLintPass for Pass { | ||
fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) { | ||
if !attr::contains_name(&krate.attrs, "crate_okay") { | ||
cx.span_lint(CRATE_NOT_OKAY, krate.span, | ||
"crate is not marked with #![crate_okay]"); | ||
} | ||
} | ||
} | ||
|
||
#[plugin_registrar] | ||
pub fn plugin_registrar(reg: &mut Registry) { | ||
reg.register_late_lint_pass(box Pass as LateLintPassObject); | ||
} |
51 changes: 51 additions & 0 deletions
51
src/test/run-pass-fulldeps/auxiliary/lint_group_plugin_test.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// 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. | ||
|
||
// force-host | ||
|
||
#![feature(plugin_registrar)] | ||
#![feature(box_syntax, rustc_private)] | ||
|
||
// Load rustc as a plugin to get macros | ||
#[macro_use] | ||
extern crate rustc; | ||
extern crate rustc_plugin; | ||
|
||
use rustc::hir; | ||
use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray}; | ||
use rustc_plugin::Registry; | ||
|
||
declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'"); | ||
|
||
declare_lint!(PLEASE_LINT, Warn, "Warn about items named 'pleaselintme'"); | ||
|
||
struct Pass; | ||
|
||
impl LintPass for Pass { | ||
fn get_lints(&self) -> LintArray { | ||
lint_array!(TEST_LINT, PLEASE_LINT) | ||
} | ||
} | ||
|
||
impl LateLintPass for Pass { | ||
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) { | ||
match &*it.name.as_str() { | ||
"lintme" => cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"), | ||
"pleaselintme" => cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'"), | ||
_ => {} | ||
} | ||
} | ||
} | ||
|
||
#[plugin_registrar] | ||
pub fn plugin_registrar(reg: &mut Registry) { | ||
reg.register_late_lint_pass(box Pass as LateLintPassObject); | ||
reg.register_lint_group("lint_me", vec![TEST_LINT, PLEASE_LINT]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// 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. | ||
|
||
// force-host | ||
|
||
#![feature(plugin_registrar)] | ||
#![feature(box_syntax, rustc_private)] | ||
|
||
extern crate syntax; | ||
|
||
// Load rustc as a plugin to get macros | ||
#[macro_use] | ||
extern crate rustc; | ||
extern crate rustc_plugin; | ||
|
||
use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass, | ||
EarlyLintPassObject, LintArray}; | ||
use rustc_plugin::Registry; | ||
use syntax::ast; | ||
declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'"); | ||
|
||
struct Pass; | ||
|
||
impl LintPass for Pass { | ||
fn get_lints(&self) -> LintArray { | ||
lint_array!(TEST_LINT) | ||
} | ||
} | ||
|
||
impl EarlyLintPass for Pass { | ||
fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) { | ||
if it.ident.name.as_str() == "lintme" { | ||
cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"); | ||
} | ||
} | ||
} | ||
|
||
#[plugin_registrar] | ||
pub fn plugin_registrar(reg: &mut Registry) { | ||
reg.register_early_lint_pass(box Pass as EarlyLintPassObject); | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.