Skip to content

Commit f3eead1

Browse files
committed
Auto merge of #80453 - petrochenkov:nocfail, r=Mark-Simulacrum
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.
2 parents 158f8d0 + 4d2d0ba commit f3eead1

File tree

116 files changed

+516
-196
lines changed

Some content is hidden

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

116 files changed

+516
-196
lines changed

compiler/rustc_hir/src/hir.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ pub struct Crate<'hir> {
607607
// over the ids in increasing order. In principle it should not
608608
// matter what order we visit things in, but in *practice* it
609609
// does, because it can affect the order in which errors are
610-
// detected, which in turn can make compile-fail tests yield
610+
// detected, which in turn can make UI tests yield
611611
// slightly different results.
612612
pub items: BTreeMap<HirId, Item<'hir>>,
613613

compiler/rustc_incremental/src/assert_dep_graph.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//! In this code, we report errors on each `rustc_if_this_changed`
1313
//! annotation. If a path exists in all cases, then we would report
1414
//! "all path(s) exist". Otherwise, we report: "no path to `foo`" for
15-
//! each case where no path exists. `compile-fail` tests can then be
15+
//! each case where no path exists. `ui` tests can then be
1616
//! used to check when paths exist or do not.
1717
//!
1818
//! The full form of the `rustc_if_this_changed` annotation is

compiler/rustc_interface/src/passes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ fn analysis(tcx: TyCtxt<'_>, cnum: CrateNum) -> Result<()> {
889889

890890
// Avoid overwhelming user with errors if borrow checking failed.
891891
// I'm not sure how helpful this is, to be honest, but it avoids a
892-
// lot of annoying errors in the compile-fail tests (basically,
892+
// lot of annoying errors in the ui tests (basically,
893893
// lint warnings and so on -- kindck used to do this abort, but
894894
// kindck is gone now). -nmatsakis
895895
if sess.has_errors() {

compiler/rustc_interface/src/queries.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ impl<'tcx> Queries<'tcx> {
280280
// Don't do code generation if there were any errors
281281
self.session().compile_status()?;
282282

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

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

291291
/// Check for the `#[rustc_error]` annotation, which forces an error in codegen. This is used
292-
/// to write compile-fail tests that actually test that compilation succeeds without reporting
292+
/// to write UI tests that actually test that compilation succeeds without reporting
293293
/// an error.
294294
fn check_for_rustc_errors_attr(tcx: TyCtxt<'_>) {
295295
let def_id = match tcx.entry_fn(LOCAL_CRATE) {

compiler/rustc_mir/src/transform/rustc_peek.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl<'tcx> MirPass<'tcx> for SanityCheck {
9292
/// "rustc_peek: bit not set".
9393
///
9494
/// The intention is that one can write unit tests for dataflow by
95-
/// putting code into a compile-fail test and using `rustc_peek` to
95+
/// putting code into an UI test and using `rustc_peek` to
9696
/// make observations about the results of dataflow static analyses.
9797
///
9898
/// (If there are any calls to `rustc_peek` that do not match the

compiler/rustc_resolve/src/build_reduced_graph.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
525525
ModuleKind::Block(..) => unreachable!(),
526526
};
527527
// HACK(eddyb) unclear how good this is, but keeping `$crate`
528-
// in `source` breaks `src/test/compile-fail/import-crate-var.rs`,
528+
// in `source` breaks `src/test/ui/imports/import-crate-var.rs`,
529529
// while the current crate doesn't have a valid `crate_name`.
530530
if crate_name != kw::Invalid {
531531
// `crate_name` should not be interpreted as relative.

compiler/rustc_trait_selection/src/infer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl<'tcx> OutlivesEnvironmentExt<'tcx> for OutlivesEnvironment<'tcx> {
162162
/// 'b` (and hence, transitively, that `T: 'a`). This method would
163163
/// add those assumptions into the outlives-environment.
164164
///
165-
/// Tests: `src/test/compile-fail/regions-free-region-ordering-*.rs`
165+
/// Tests: `src/test/ui/regions/regions-free-region-ordering-*.rs`
166166
fn add_implied_bounds(
167167
&mut self,
168168
infcx: &InferCtxt<'a, 'tcx>,

compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
558558
// where-clause or, in the case of an object type,
559559
// it could be that the object type lists the
560560
// trait (e.g., `Foo+Send : Send`). See
561-
// `compile-fail/typeck-default-trait-impl-send-param.rs`
561+
// `ui/typeck/typeck-default-trait-impl-send-param.rs`
562562
// for an example of a test case that exercises
563563
// this path.
564564
}

compiler/rustc_typeck/src/collect.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1767,8 +1767,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
17671767
const NO_GENERICS: &hir::Generics<'_> = &hir::Generics::empty();
17681768

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

17741773
let ast_generics = match node {

src/bootstrap/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ build/
201201
# Output for all compiletest-based test suites
202202
test/
203203
ui/
204-
compile-fail/
205204
debuginfo/
206205
...
207206

src/bootstrap/builder.rs

-1
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,6 @@ impl<'a> Builder<'a> {
384384
test::ExpandYamlAnchors,
385385
test::Tidy,
386386
test::Ui,
387-
test::CompileFail,
388387
test::RunPassValgrind,
389388
test::MirOpt,
390389
test::Codegen,

src/bootstrap/mk/Makefile.in

+1-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ check-stage2-T-x86_64-unknown-linux-musl-H-x86_64-unknown-linux-gnu:
6666

6767
TESTS_IN_2 := \
6868
src/test/ui \
69-
src/test/compile-fail \
7069
src/tools/linkchecker
7170

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

7776
TESTS_IN_MINGW_2 := \
78-
src/test/ui \
79-
src/test/compile-fail
77+
src/test/ui
8078

8179
ci-mingw-subset-1:
8280
$(Q)$(BOOTSTRAP) test --stage 2 $(TESTS_IN_MINGW_2:%=--exclude %)

src/bootstrap/test.rs

-6
Original file line numberDiff line numberDiff line change
@@ -869,12 +869,6 @@ default_test_with_compare_mode!(Ui {
869869
compare_mode: "nll"
870870
});
871871

872-
default_test!(CompileFail {
873-
path: "src/test/compile-fail",
874-
mode: "compile-fail",
875-
suite: "compile-fail"
876-
});
877-
878872
default_test!(RunPassValgrind {
879873
path: "src/test/run-pass-valgrind",
880874
mode: "run-pass-valgrind",

src/ci/docker/host-x86_64/test-various/Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ ENV WASM_TARGETS=wasm32-unknown-unknown
4444
ENV WASM_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $WASM_TARGETS \
4545
src/test/run-make \
4646
src/test/ui \
47-
src/test/compile-fail \
4847
src/test/mir-opt \
4948
src/test/codegen-units \
5049
library/core

src/etc/generate-deriving-span-tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22

33
"""
4-
This script creates a pile of compile-fail tests check that all the
4+
This script creates a pile of UI tests check that all the
55
derives have spans that point to the fields, rather than the
66
#[derive(...)] line.
77

src/test/compile-fail/auxiliary/panic-runtime-lang-items.rs

-15
This file was deleted.

src/test/compile-fail/auxiliary/panic-runtime-unwind.rs

-17
This file was deleted.

src/test/compile-fail/auxiliary/panic-runtime-unwind2.rs

-17
This file was deleted.

src/test/compile-fail/auxiliary/some-panic-impl.rs

-11
This file was deleted.

src/test/compile-fail/auxiliary/wants-panic-runtime-unwind.rs

-6
This file was deleted.

src/test/compile-fail/runtime-depend-on-needs-runtime.stderr

-4
This file was deleted.

src/test/run-make-fulldeps/many-crates-but-no-match/Makefile

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
-include ../tools.mk
22

3-
# Modelled after compile-fail/changing-crates test, but this one puts
3+
# Modelled after ui/changing-crates.rs test, but this one puts
44
# more than one (mismatching) candidate crate into the search path,
5-
# which did not appear directly expressible in compile-fail/aux-build
6-
# infrastructure.
5+
# which did not appear directly expressible in UI testing infrastructure.
76
#
87
# Note that we move the built libraries into target direcrtories rather than
98
# use the `--out-dir` option because the `../tools.mk` file already bakes a
@@ -33,4 +32,4 @@ all:
3332
'crate `crateA`:' \
3433
'crate `crateB`:' \
3534
< $(LOG)
36-
# the 'crate `crateA`' will match two entries.
35+
# the 'crate `crateA`' will match two entries.

src/test/run-make-fulldeps/type-mismatch-same-crate-name/crateC.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// causing a type mismatch.
66

77
// The test is nearly the same as the one in
8-
// compile-fail/type-mismatch-same-crate-name.rs
8+
// ui/type/type-mismatch-same-crate-name.rs
99
// but deals with the case where one of the crates
1010
// is only introduced as an indirect dependency.
1111
// and the type is accessed via a re-export.

src/test/ui-fulldeps/dropck-tarena-cycle-checked.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Reject mixing cyclic structure and Drop when using TypedArena.
22
//
3-
// (Compare against compile-fail/dropck_vec_cycle_checked.rs)
3+
// (Compare against dropck-vec-cycle-checked.rs)
44
//
5-
// (Also compare against compile-fail/dropck_tarena_unsound_drop.rs,
5+
// (Also compare against ui-fulldeps/dropck-tarena-unsound-drop.rs,
66
// which is a reduction of this code to more directly show the reason
77
// for the error message we see here.)
88

src/test/ui-fulldeps/dropck_tarena_sound_drop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// methods might access borrowed data, as long as the borrowed data
66
// has lifetime that strictly outlives the arena itself.
77
//
8-
// Compare against compile-fail/dropck_tarena_unsound_drop.rs, which
8+
// Compare against ui-fulldeps/dropck-tarena-unsound-drop.rs, which
99
// shows a similar setup, but restricts `f` so that the struct `C<'a>`
1010
// is force-fed a lifetime equal to that of the borrowed arena.
1111

src/test/ui/array-slice-vec/copy-out-of-array-1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

77
#[derive(Copy, Clone)]
88
struct C { _x: u8 }

src/test/ui/associated-types/associated-types-projection-to-unrelated-trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// the trait definition if there is no default method and for every impl,
44
// `Self` does implement `Get`.
55
//
6-
// See also compile-fail tests associated-types-no-suitable-supertrait
6+
// See also tests associated-types-no-suitable-supertrait
77
// and associated-types-no-suitable-supertrait-2, which show how small
88
// variants of the code below can fail.
99

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error[E0191]: the value of the associated types `ChildKey` (from trait `Hierarchy`), `Children` (from trait `Hierarchy`), `Value` (from trait `Hierarchy`) must be specified
2+
--> $DIR/issue-23595-1.rs:8:58
3+
|
4+
LL | type Value;
5+
| ----------- `Value` defined here
6+
LL | type ChildKey;
7+
| -------------- `ChildKey` defined here
8+
LL | type Children = dyn Index<Self::ChildKey, Output=dyn Hierarchy>;
9+
| -----------------------------------------------------^^^^^^^^^--
10+
| | |
11+
| | help: specify the associated types: `Hierarchy<Value = Type, ChildKey = Type, Children = Type>`
12+
| `Children` defined here
13+
14+
error: aborting due to previous error
15+
16+
For more information about this error, try `rustc --explain E0191`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error[E0277]: the trait bound `T: Copy` is not satisfied
2+
--> $DIR/issue-27675-unchecked-bounds.rs:15:31
3+
|
4+
LL | fn copy<U: Setup + ?Sized>(from: &U::From) -> U::From {
5+
| ----- required by this bound in `copy`
6+
...
7+
LL | copy::<dyn Setup<From=T>>(t)
8+
| ^ the trait `Copy` is not implemented for `T`
9+
|
10+
help: consider restricting type parameter `T`
11+
|
12+
LL | pub fn copy_any<T: Copy>(t: &T) -> T {
13+
| ^^^^^^
14+
15+
error: aborting due to previous error
16+
17+
For more information about this error, try `rustc --explain E0277`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
2+
--> $DIR/coerce-unsafe-closure-to-unsafe-fn-ptr.rs:2:31
3+
|
4+
LL | let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); };
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
6+
|
7+
= note: consult the function's documentation for information on how to avoid undefined behavior
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0133`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0277]: expected a `FnOnce<(&str,)>` closure, found `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}`
2+
--> $DIR/coerce-unsafe-to-closure.rs:2:44
3+
|
4+
LL | let x: Option<&[u8]> = Some("foo").map(std::mem::transmute);
5+
| ^^^^^^^^^^^^^^^^^^^ expected an `FnOnce<(&str,)>` closure, found `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}`
6+
|
7+
= help: the trait `FnOnce<(&str,)>` is not implemented for `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}`
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)