Skip to content

Commit

Permalink
Auto merge of #80453 - petrochenkov:nocfail, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
Remove `compile-fail` test suite

By moving all of its tests to `ui` test suite.
Now we have directives like `// dont-check-compiler-stderr` that allow to disable `.stderr` comparison for platform-dependent tests without introducing a whole new test suite.
  • Loading branch information
bors committed Dec 29, 2020
2 parents 158f8d0 + 4d2d0ba commit f3eead1
Show file tree
Hide file tree
Showing 116 changed files with 516 additions and 196 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ pub struct Crate<'hir> {
// over the ids in increasing order. In principle it should not
// matter what order we visit things in, but in *practice* it
// does, because it can affect the order in which errors are
// detected, which in turn can make compile-fail tests yield
// detected, which in turn can make UI tests yield
// slightly different results.
pub items: BTreeMap<HirId, Item<'hir>>,

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_incremental/src/assert_dep_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//! In this code, we report errors on each `rustc_if_this_changed`
//! annotation. If a path exists in all cases, then we would report
//! "all path(s) exist". Otherwise, we report: "no path to `foo`" for
//! each case where no path exists. `compile-fail` tests can then be
//! each case where no path exists. `ui` tests can then be
//! used to check when paths exist or do not.
//!
//! The full form of the `rustc_if_this_changed` annotation is
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ fn analysis(tcx: TyCtxt<'_>, cnum: CrateNum) -> Result<()> {

// Avoid overwhelming user with errors if borrow checking failed.
// I'm not sure how helpful this is, to be honest, but it avoids a
// lot of annoying errors in the compile-fail tests (basically,
// lot of annoying errors in the ui tests (basically,
// lint warnings and so on -- kindck used to do this abort, but
// kindck is gone now). -nmatsakis
if sess.has_errors() {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_interface/src/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ impl<'tcx> Queries<'tcx> {
// Don't do code generation if there were any errors
self.session().compile_status()?;

// Hook for compile-fail tests.
// Hook for UI tests.
Self::check_for_rustc_errors_attr(tcx);

Ok(passes::start_codegen(&***self.codegen_backend(), tcx, &*outputs.peek()))
Expand All @@ -289,7 +289,7 @@ impl<'tcx> Queries<'tcx> {
}

/// Check for the `#[rustc_error]` annotation, which forces an error in codegen. This is used
/// to write compile-fail tests that actually test that compilation succeeds without reporting
/// to write UI tests that actually test that compilation succeeds without reporting
/// an error.
fn check_for_rustc_errors_attr(tcx: TyCtxt<'_>) {
let def_id = match tcx.entry_fn(LOCAL_CRATE) {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/transform/rustc_peek.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl<'tcx> MirPass<'tcx> for SanityCheck {
/// "rustc_peek: bit not set".
///
/// The intention is that one can write unit tests for dataflow by
/// putting code into a compile-fail test and using `rustc_peek` to
/// putting code into an UI test and using `rustc_peek` to
/// make observations about the results of dataflow static analyses.
///
/// (If there are any calls to `rustc_peek` that do not match the
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/build_reduced_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
ModuleKind::Block(..) => unreachable!(),
};
// HACK(eddyb) unclear how good this is, but keeping `$crate`
// in `source` breaks `src/test/compile-fail/import-crate-var.rs`,
// in `source` breaks `src/test/ui/imports/import-crate-var.rs`,
// while the current crate doesn't have a valid `crate_name`.
if crate_name != kw::Invalid {
// `crate_name` should not be interpreted as relative.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/infer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ impl<'tcx> OutlivesEnvironmentExt<'tcx> for OutlivesEnvironment<'tcx> {
/// 'b` (and hence, transitively, that `T: 'a`). This method would
/// add those assumptions into the outlives-environment.
///
/// Tests: `src/test/compile-fail/regions-free-region-ordering-*.rs`
/// Tests: `src/test/ui/regions/regions-free-region-ordering-*.rs`
fn add_implied_bounds(
&mut self,
infcx: &InferCtxt<'a, 'tcx>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// where-clause or, in the case of an object type,
// it could be that the object type lists the
// trait (e.g., `Foo+Send : Send`). See
// `compile-fail/typeck-default-trait-impl-send-param.rs`
// `ui/typeck/typeck-default-trait-impl-send-param.rs`
// for an example of a test case that exercises
// this path.
}
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_typeck/src/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1767,8 +1767,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
const NO_GENERICS: &hir::Generics<'_> = &hir::Generics::empty();

// We use an `IndexSet` to preserves order of insertion.
// Preserving the order of insertion is important here so as not to break
// compile-fail UI tests.
// Preserving the order of insertion is important here so as not to break UI tests.
let mut predicates: FxIndexSet<(ty::Predicate<'_>, Span)> = FxIndexSet::default();

let ast_generics = match node {
Expand Down
1 change: 0 additions & 1 deletion src/bootstrap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ build/
# Output for all compiletest-based test suites
test/
ui/
compile-fail/
debuginfo/
...

Expand Down
1 change: 0 additions & 1 deletion src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ impl<'a> Builder<'a> {
test::ExpandYamlAnchors,
test::Tidy,
test::Ui,
test::CompileFail,
test::RunPassValgrind,
test::MirOpt,
test::Codegen,
Expand Down
4 changes: 1 addition & 3 deletions src/bootstrap/mk/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ check-stage2-T-x86_64-unknown-linux-musl-H-x86_64-unknown-linux-gnu:

TESTS_IN_2 := \
src/test/ui \
src/test/compile-fail \
src/tools/linkchecker

ci-subset-1:
Expand All @@ -75,8 +74,7 @@ ci-subset-2:
$(Q)$(BOOTSTRAP) test --stage 2 $(TESTS_IN_2)

TESTS_IN_MINGW_2 := \
src/test/ui \
src/test/compile-fail
src/test/ui

ci-mingw-subset-1:
$(Q)$(BOOTSTRAP) test --stage 2 $(TESTS_IN_MINGW_2:%=--exclude %)
Expand Down
6 changes: 0 additions & 6 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -869,12 +869,6 @@ default_test_with_compare_mode!(Ui {
compare_mode: "nll"
});

default_test!(CompileFail {
path: "src/test/compile-fail",
mode: "compile-fail",
suite: "compile-fail"
});

default_test!(RunPassValgrind {
path: "src/test/run-pass-valgrind",
mode: "run-pass-valgrind",
Expand Down
1 change: 0 additions & 1 deletion src/ci/docker/host-x86_64/test-various/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ ENV WASM_TARGETS=wasm32-unknown-unknown
ENV WASM_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $WASM_TARGETS \
src/test/run-make \
src/test/ui \
src/test/compile-fail \
src/test/mir-opt \
src/test/codegen-units \
library/core
Expand Down
2 changes: 1 addition & 1 deletion src/etc/generate-deriving-span-tests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

"""
This script creates a pile of compile-fail tests check that all the
This script creates a pile of UI tests check that all the
derives have spans that point to the fields, rather than the
#[derive(...)] line.
Expand Down
15 changes: 0 additions & 15 deletions src/test/compile-fail/auxiliary/panic-runtime-lang-items.rs

This file was deleted.

17 changes: 0 additions & 17 deletions src/test/compile-fail/auxiliary/panic-runtime-unwind.rs

This file was deleted.

17 changes: 0 additions & 17 deletions src/test/compile-fail/auxiliary/panic-runtime-unwind2.rs

This file was deleted.

11 changes: 0 additions & 11 deletions src/test/compile-fail/auxiliary/some-panic-impl.rs

This file was deleted.

6 changes: 0 additions & 6 deletions src/test/compile-fail/auxiliary/wants-panic-runtime-unwind.rs

This file was deleted.

4 changes: 0 additions & 4 deletions src/test/compile-fail/runtime-depend-on-needs-runtime.stderr

This file was deleted.

7 changes: 3 additions & 4 deletions src/test/run-make-fulldeps/many-crates-but-no-match/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
-include ../tools.mk

# Modelled after compile-fail/changing-crates test, but this one puts
# Modelled after ui/changing-crates.rs test, but this one puts
# more than one (mismatching) candidate crate into the search path,
# which did not appear directly expressible in compile-fail/aux-build
# infrastructure.
# which did not appear directly expressible in UI testing infrastructure.
#
# Note that we move the built libraries into target direcrtories rather than
# use the `--out-dir` option because the `../tools.mk` file already bakes a
Expand Down Expand Up @@ -33,4 +32,4 @@ all:
'crate `crateA`:' \
'crate `crateB`:' \
< $(LOG)
# the 'crate `crateA`' will match two entries.
# the 'crate `crateA`' will match two entries.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// causing a type mismatch.

// The test is nearly the same as the one in
// compile-fail/type-mismatch-same-crate-name.rs
// ui/type/type-mismatch-same-crate-name.rs
// but deals with the case where one of the crates
// is only introduced as an indirect dependency.
// and the type is accessed via a re-export.
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui-fulldeps/dropck-tarena-cycle-checked.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Reject mixing cyclic structure and Drop when using TypedArena.
//
// (Compare against compile-fail/dropck_vec_cycle_checked.rs)
// (Compare against dropck-vec-cycle-checked.rs)
//
// (Also compare against compile-fail/dropck_tarena_unsound_drop.rs,
// (Also compare against ui-fulldeps/dropck-tarena-unsound-drop.rs,
// which is a reduction of this code to more directly show the reason
// for the error message we see here.)

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/dropck_tarena_sound_drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// methods might access borrowed data, as long as the borrowed data
// has lifetime that strictly outlives the arena itself.
//
// Compare against compile-fail/dropck_tarena_unsound_drop.rs, which
// Compare against ui-fulldeps/dropck-tarena-unsound-drop.rs, which
// shows a similar setup, but restricts `f` so that the struct `C<'a>`
// is force-fed a lifetime equal to that of the borrowed arena.

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/array-slice-vec/copy-out-of-array-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Ensure that we can copy out of a fixed-size array.
//
// (Compare with compile-fail/move-out-of-array-1.rs)
// (Compare with ui/moves/move-out-of-array-1.rs)

#[derive(Copy, Clone)]
struct C { _x: u8 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// the trait definition if there is no default method and for every impl,
// `Self` does implement `Get`.
//
// See also compile-fail tests associated-types-no-suitable-supertrait
// See also tests associated-types-no-suitable-supertrait
// and associated-types-no-suitable-supertrait-2, which show how small
// variants of the code below can fail.

Expand Down
File renamed without changes.
16 changes: 16 additions & 0 deletions src/test/ui/associated-types/issue-23595-1.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
error[E0191]: the value of the associated types `ChildKey` (from trait `Hierarchy`), `Children` (from trait `Hierarchy`), `Value` (from trait `Hierarchy`) must be specified
--> $DIR/issue-23595-1.rs:8:58
|
LL | type Value;
| ----------- `Value` defined here
LL | type ChildKey;
| -------------- `ChildKey` defined here
LL | type Children = dyn Index<Self::ChildKey, Output=dyn Hierarchy>;
| -----------------------------------------------------^^^^^^^^^--
| | |
| | help: specify the associated types: `Hierarchy<Value = Type, ChildKey = Type, Children = Type>`
| `Children` defined here

error: aborting due to previous error

For more information about this error, try `rustc --explain E0191`.
17 changes: 17 additions & 0 deletions src/test/ui/associated-types/issue-27675-unchecked-bounds.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/issue-27675-unchecked-bounds.rs:15:31
|
LL | fn copy<U: Setup + ?Sized>(from: &U::From) -> U::From {
| ----- required by this bound in `copy`
...
LL | copy::<dyn Setup<From=T>>(t)
| ^ the trait `Copy` is not implemented for `T`
|
help: consider restricting type parameter `T`
|
LL | pub fn copy_any<T: Copy>(t: &T) -> T {
| ^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
11 changes: 11 additions & 0 deletions src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/coerce-unsafe-closure-to-unsafe-fn-ptr.rs:2:31
|
LL | let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior

error: aborting due to previous error

For more information about this error, try `rustc --explain E0133`.
11 changes: 11 additions & 0 deletions src/test/ui/closures/coerce-unsafe-to-closure.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0277]: expected a `FnOnce<(&str,)>` closure, found `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}`
--> $DIR/coerce-unsafe-to-closure.rs:2:44
|
LL | let x: Option<&[u8]> = Some("foo").map(std::mem::transmute);
| ^^^^^^^^^^^^^^^^^^^ expected an `FnOnce<(&str,)>` closure, found `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}`
|
= help: the trait `FnOnce<(&str,)>` is not implemented for `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
File renamed without changes.
Loading

0 comments on commit f3eead1

Please sign in to comment.