Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiletest: Introduce // {check,build,run}-pass pass modes #61778

Merged
merged 4 commits into from
Jun 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// rustc_on_unimplemented, but with this bug we are seeing it fire (on
// subsequent runs) if incremental compilation is enabled.

// revisions: rpass1 rpass2
// revisions: cfail1 cfail2
// compile-pass

#![feature(on_unimplemented)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// seeing it fire (on subsequent runs) if incremental compilation is
// enabled.

// revisions: rpass1 rpass2
// revisions: cfail1 cfail2
// compile-pass

#![feature(rustc_attrs)]
Expand Down
4 changes: 2 additions & 2 deletions src/test/incremental/no_mangle.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// revisions:rpass1 rpass2
// revisions:cfail1 cfail2
// check-pass
// compile-flags: --crate-type cdylib
// skip-codegen

#![deny(unused_attributes)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// compile-pass
// error-pattern:returned Box<dyn Error> from main()
// failure-status: 1

use std::error::Error;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// compile-pass
// error-pattern:returned Box<Error> from main()
// failure-status: 1

use std::io::{Error, ErrorKind};
Expand Down
7 changes: 0 additions & 7 deletions src/test/run-pass/compiletest-skip-codegen.rs

This file was deleted.

6 changes: 2 additions & 4 deletions src/test/ui/asm/asm-misplaced-option.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// check-pass
// ignore-android
// ignore-arm
// ignore-aarch64
Expand All @@ -11,14 +12,11 @@
// ignore-mips
// ignore-mips64

// compile-pass
// skip-codegen
#![feature(asm)]
#![allow(dead_code, non_upper_case_globals)]

#[cfg(any(target_arch = "x86",
target_arch = "x86_64"))]
pub fn main() {
fn main() {
// assignment not dead
let mut x: isize = 0;
unsafe {
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/asm/asm-misplaced-option.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
warning: unrecognized option
--> $DIR/asm-misplaced-option.rs:26:64
--> $DIR/asm-misplaced-option.rs:24:64
|
LL | asm!("mov $1, $0" : "=r"(x) : "r"(5_usize), "0"(x) : : "cc");
| ^^^^

warning: expected a clobber, found an option
--> $DIR/asm-misplaced-option.rs:33:80
--> $DIR/asm-misplaced-option.rs:31:80
|
LL | asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8_usize) : "cc", "volatile");
| ^^^^^^^^^^
Expand Down
17 changes: 8 additions & 9 deletions src/test/ui/associated-types/cache/chrono-scan.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// compile-pass
// skip-codegen
#![allow(warnings)]
// check-pass

pub type ParseResult<T> = Result<T, ()>;

pub enum Item<'a> { Literal(&'a str),
}
pub enum Item<'a> {
Literal(&'a str)
}

pub fn colon_or_space(s: &str) -> ParseResult<&str> {
unimplemented!()
Expand All @@ -20,10 +20,9 @@ pub fn parse<'a, I>(mut s: &str, items: I) -> ParseResult<()>
macro_rules! try_consume {
($e:expr) => ({ let (s_, v) = try!($e); s = s_; v })
}
let offset = try_consume!(timezone_offset_zulu(s.trim_left(), colon_or_space));
let offset = try_consume!(timezone_offset_zulu(s.trim_left(), colon_or_space));
let offset = try_consume!(timezone_offset_zulu(s.trim_start(), colon_or_space));
let offset = try_consume!(timezone_offset_zulu(s.trim_start(), colon_or_space));
Ok(())
}


fn main() { }
fn main() {}
5 changes: 2 additions & 3 deletions src/test/ui/associated-types/cache/elision.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// compile-pass
// skip-codegen
#![allow(warnings)]
// Check that you are allowed to implement using elision but write
// trait without elision (a bug in this cropped up during
// bootstrapping, so this is a regression test).

// check-pass

pub struct SplitWhitespace<'a> {
x: &'a u8
}
Expand Down
5 changes: 2 additions & 3 deletions src/test/ui/bad/bad-lint-cap3.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// check-pass
// compile-flags: --cap-lints warn

#![warn(unused)]
#![deny(warnings)]
// compile-pass
// skip-codegen
use std::option; //~ WARN

use std::option; //~ WARN

fn main() {}
2 changes: 1 addition & 1 deletion src/test/ui/bad/bad-lint-cap3.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | use std::option;
| ^^^^^^^^^^^
|
note: lint level defined here
--> $DIR/bad-lint-cap3.rs:4:9
--> $DIR/bad-lint-cap3.rs:5:9
|
LL | #![deny(warnings)]
| ^^^^^^^^
Expand Down
10 changes: 4 additions & 6 deletions src/test/ui/coherence/coherence-projection-ok-orphan.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// compile-pass
// skip-codegen
// Here we do not get a coherence conflict because `Baz: Iterator`
// does not hold and (due to the orphan rules), we can rely on that.

// check-pass
petrochenkov marked this conversation as resolved.
Show resolved Hide resolved
// revisions: old re

#![cfg_attr(re, feature(re_rebalance_coherence))]
#![allow(dead_code)]
// Here we do not get a coherence conflict because `Baz: Iterator`
// does not hold and (due to the orphan rules), we can rely on that.

pub trait Foo<P> {}

Expand All @@ -18,5 +17,4 @@ impl Foo<i32> for Baz { }

impl<A:Iterator> Foo<A::Item> for A { }


fn main() {}
5 changes: 2 additions & 3 deletions src/test/ui/coherence/coherence-projection-ok.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// compile-pass
// skip-codegen
// check-pass
// revisions: old re

#![cfg_attr(re, feature(re_rebalance_coherence))]

pub trait Foo<P> {}

pub trait Bar {
Expand All @@ -17,5 +17,4 @@ impl Bar for i32 {
type Output = u32;
}


fn main() {}
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
// Test that we are able to introduce a negative constraint that
// `MyType: !MyTrait` along with other "fundamental" wrappers.

// check-pass
// aux-build:coherence_copy_like_lib.rs
// compile-pass
// skip-codegen
// revisions: old re

#![cfg_attr(re, feature(re_rebalance_coherence))]
#![allow(dead_code)]

extern crate coherence_copy_like_lib as lib;

Expand All @@ -23,5 +21,4 @@ impl<T: lib::MyCopy> MyTrait for T { }
// Huzzah.
impl<'a> MyTrait for lib::MyFundamentalStruct<&'a MyType> { }


fn main() { }
7 changes: 2 additions & 5 deletions src/test/ui/coherence/coherence_local.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
// Test that we are able to introduce a negative constraint that
// `MyType: !MyTrait` along with other "fundamental" wrappers.

// check-pass
// aux-build:coherence_copy_like_lib.rs
// compile-pass
// skip-codegen
// revisions: old re

#![cfg_attr(re, feature(re_rebalance_coherence))]
#![allow(dead_code)]

extern crate coherence_copy_like_lib as lib;

Expand All @@ -22,5 +20,4 @@ impl lib::MyCopy for Box<MyType> { }
impl lib::MyCopy for lib::MyFundamentalStruct<MyType> { }
impl lib::MyCopy for lib::MyFundamentalStruct<Box<MyType>> { }


fn main() { }
fn main() {}
5 changes: 1 addition & 4 deletions src/test/ui/coherence/coherence_local_ref.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
// Test that we are able to introduce a negative constraint that
// `MyType: !MyTrait` along with other "fundamental" wrappers.

// check-pass
// aux-build:coherence_copy_like_lib.rs
// compile-pass
// skip-codegen
// revisions: old re

#![cfg_attr(re, feature(re_rebalance_coherence))]
#![allow(dead_code)]

extern crate coherence_copy_like_lib as lib;

Expand All @@ -16,5 +14,4 @@ struct MyType { x: i32 }
// naturally, legal
impl lib::MyCopy for MyType { }


fn main() { }
7 changes: 3 additions & 4 deletions src/test/ui/conditional-compilation/cfg_attr_path.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// compile-pass
// skip-codegen
#![allow(dead_code)]
// check-pass

#![deny(unused_attributes)] // c.f #35584

mod auxiliary {
#[cfg_attr(any(), path = "nonexistent_file.rs")] pub mod namespaced_enums;
#[cfg_attr(all(), path = "namespaced_enums.rs")] pub mod nonexistent_file;
}


fn main() {
let _ = auxiliary::namespaced_enums::Foo::A;
let _ = auxiliary::nonexistent_file::Foo::A;
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/consts/const-eval/const_transmute.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// compile-pass
// run-pass
Centril marked this conversation as resolved.
Show resolved Hide resolved

#![feature(const_fn_union)]
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/consts/const-eval/enum_discr.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// compile-pass
// run-pass

enum Foo {
Expand Down
5 changes: 1 addition & 4 deletions src/test/ui/consts/const-fn-stability-calls-3.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
// Test use of const fn from another crate without a feature gate.

// compile-pass
// skip-codegen
#![allow(unused_variables)]
// check-pass
// aux-build:const_fn_lib.rs

extern crate const_fn_lib;

use const_fn_lib::foo;


fn main() {
let x = foo(); // use outside a constant is ok
}
4 changes: 1 addition & 3 deletions src/test/ui/expanded-cfg.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// skip-codegen
// compile-pass
// check-pass

macro_rules! mac {
{} => {
Expand All @@ -19,5 +18,4 @@ macro_rules! mac {

mac! {}


fn main() {}
19 changes: 10 additions & 9 deletions src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
// inputs are handled by each, and (2.) to ease searching for related
// occurrences in the source text.

// check-pass

#![warn(unused_attributes, unknown_lints)]
#![allow(stable_features)]

// UNGATED WHITE-LISTED BUILT-IN ATTRIBUTES

Expand Down Expand Up @@ -75,7 +76,7 @@
// see issue-43106-gating-of-stable.rs
// see issue-43106-gating-of-unstable.rs
// see issue-43106-gating-of-deprecated.rs
#![windows_subsystem = "1000"]
#![windows_subsystem = "windows"]

// UNGATED CRATE-LEVEL BUILT-IN ATTRIBUTES

Expand Down Expand Up @@ -539,7 +540,7 @@ mod export_name {
#[export_name = "2200"] impl S { }
}

// Note that this test has a `skip-codegen`, so it
// Note that this is a `check-pass` test, so it
// will never invoke the linker. These are here nonetheless to point
// out that we allow them at non-crate-level (though I do not know
// whether they have the same effect here as at crate-level).
Expand Down Expand Up @@ -611,17 +612,17 @@ mod must_use {
#[must_use] impl S { }
}

#[windows_subsystem = "1000"]
#[windows_subsystem = "windows"]
mod windows_subsystem {
mod inner { #![windows_subsystem="1000"] }
mod inner { #![windows_subsystem="windows"] }

#[windows_subsystem = "1000"] fn f() { }
#[windows_subsystem = "windows"] fn f() { }

#[windows_subsystem = "1000"] struct S;
#[windows_subsystem = "windows"] struct S;

#[windows_subsystem = "1000"] type T = S;
#[windows_subsystem = "windows"] type T = S;

#[windows_subsystem = "1000"] impl S { }
#[windows_subsystem = "windows"] impl S { }
}

// BROKEN USES OF CRATE-LEVEL BUILT-IN ATTRIBUTES
Expand Down
Loading