about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/allocator/alloc-shrink-oob-read.rs (renamed from tests/ui/realloc-16687.rs)10
-rw-r--r--tests/ui/auto-traits/auto-trait-phantom-data-bounds.rs (renamed from tests/ui/phantom-auto-trait.rs)6
-rw-r--r--tests/ui/auto-traits/auto-trait-phantom-data-bounds.stderr (renamed from tests/ui/phantom-auto-trait.stderr)18
-rw-r--r--tests/ui/binop/binop-evaluation-order-primitive.rs15
-rw-r--r--tests/ui/coercion/basic-ptr-coercions.rs24
-rw-r--r--tests/ui/coercion/ptr-mutability-errors.rs (renamed from tests/ui/ptr-coercion.rs)3
-rw-r--r--tests/ui/coercion/ptr-mutability-errors.stderr (renamed from tests/ui/ptr-coercion.stderr)6
-rw-r--r--tests/ui/io-checks/stdout-stderr-separation.rs (renamed from tests/ui/print-stdout-eprint-stderr.rs)3
-rw-r--r--tests/ui/mismatched_types/closure-parameter-type-inference-mismatch.rs25
-rw-r--r--tests/ui/mismatched_types/closure-parameter-type-inference-mismatch.stderr31
-rw-r--r--tests/ui/mismatched_types/type-error-diagnostic-in-complex-return.rs (renamed from tests/ui/point-to-type-err-cause-on-impl-trait-return-2.rs)6
-rw-r--r--tests/ui/mismatched_types/type-error-diagnostic-in-complex-return.stderr (renamed from tests/ui/point-to-type-err-cause-on-impl-trait-return-2.stderr)2
-rw-r--r--tests/ui/parser/doc-comment-in-generic.rs13
-rw-r--r--tests/ui/parser/raw/raw-string-literals.rsbin0 -> 998 bytes
-rw-r--r--tests/ui/pattern/move-ref-patterns/pattern-ref-bindings-reassignment.rs24
-rw-r--r--tests/ui/pattern/move-ref-patterns/pattern-ref-bindings-reassignment.stderr (renamed from tests/ui/reassign-ref-mut.stderr)5
-rw-r--r--tests/ui/pptypedef.rs13
-rw-r--r--tests/ui/pptypedef.stderr31
-rw-r--r--tests/ui/primitive-binop-lhs-mut.rs6
-rw-r--r--tests/ui/print-calling-conventions.rs2
-rw-r--r--tests/ui/print-request/print-calling-conventions.rs4
-rw-r--r--tests/ui/print-request/print-calling-conventions.stdout (renamed from tests/ui/print-calling-conventions.stdout)0
-rw-r--r--tests/ui/project-cache-issue-31849.rs65
-rw-r--r--tests/ui/ptr-coercion-rpass.rs29
-rw-r--r--tests/ui/query-visibility.rs9
-rw-r--r--tests/ui/raw-str.rsbin848 -> 0 bytes
-rw-r--r--tests/ui/reassign-ref-mut.rs16
-rw-r--r--tests/ui/std/fs-nul-byte-paths.rs (renamed from tests/ui/paths-containing-nul.rs)20
-rw-r--r--tests/ui/typeck/nested-generic-traits-performance.rs82
29 files changed, 264 insertions, 204 deletions
diff --git a/tests/ui/realloc-16687.rs b/tests/ui/allocator/alloc-shrink-oob-read.rs
index 43810a469df..b9edfca3b7b 100644
--- a/tests/ui/realloc-16687.rs
+++ b/tests/ui/allocator/alloc-shrink-oob-read.rs
@@ -1,13 +1,13 @@
+//! Sanity check for out-of-bounds read caused by copying the entire original buffer on shrink.
+//!
+//! Regression test for: <https://github.com/rust-lang/rust/issues/16687>
+
 //@ run-pass
-// alloc::heap::reallocate test.
-//
-// Ideally this would be revised to use no_std, but for now it serves
-// well enough to reproduce (and illustrate) the bug from #16687.
 
 #![feature(allocator_api)]
 #![feature(slice_ptr_get)]
 
-use std::alloc::{handle_alloc_error, Allocator, Global, Layout};
+use std::alloc::{Allocator, Global, Layout, handle_alloc_error};
 use std::ptr::{self, NonNull};
 
 fn main() {
diff --git a/tests/ui/phantom-auto-trait.rs b/tests/ui/auto-traits/auto-trait-phantom-data-bounds.rs
index 0172ca335c3..6d1c4c87fad 100644
--- a/tests/ui/phantom-auto-trait.rs
+++ b/tests/ui/auto-traits/auto-trait-phantom-data-bounds.rs
@@ -1,9 +1,9 @@
-// Ensure that auto trait checks `T` when it encounters a `PhantomData<T>` field, instead of
-// checking the `PhantomData<T>` type itself (which almost always implements an auto trait).
+//! Ensure that auto trait checks `T` when it encounters a `PhantomData<T>` field, instead of
+//! checking the `PhantomData<T>` type itself (which almost always implements an auto trait).
 
 #![feature(auto_traits)]
 
-use std::marker::{PhantomData};
+use std::marker::PhantomData;
 
 unsafe auto trait Zen {}
 
diff --git a/tests/ui/phantom-auto-trait.stderr b/tests/ui/auto-traits/auto-trait-phantom-data-bounds.stderr
index ffd4c3a0e1a..56c2e8ff257 100644
--- a/tests/ui/phantom-auto-trait.stderr
+++ b/tests/ui/auto-traits/auto-trait-phantom-data-bounds.stderr
@@ -1,5 +1,5 @@
 error[E0277]: `T` cannot be shared between threads safely
-  --> $DIR/phantom-auto-trait.rs:21:12
+  --> $DIR/auto-trait-phantom-data-bounds.rs:21:12
    |
 LL |     is_zen(x)
    |     ------ ^ `T` cannot be shared between threads safely
@@ -7,19 +7,19 @@ LL |     is_zen(x)
    |     required by a bound introduced by this call
    |
 note: required for `&T` to implement `Zen`
-  --> $DIR/phantom-auto-trait.rs:10:24
+  --> $DIR/auto-trait-phantom-data-bounds.rs:10:24
    |
 LL | unsafe impl<'a, T: 'a> Zen for &'a T where T: Sync {}
    |                        ^^^     ^^^^^          ---- unsatisfied trait bound introduced here
 note: required because it appears within the type `PhantomData<&T>`
   --> $SRC_DIR/core/src/marker.rs:LL:COL
 note: required because it appears within the type `Guard<'_, T>`
-  --> $DIR/phantom-auto-trait.rs:12:8
+  --> $DIR/auto-trait-phantom-data-bounds.rs:12:8
    |
 LL | struct Guard<'a, T: 'a> {
    |        ^^^^^
 note: required by a bound in `is_zen`
-  --> $DIR/phantom-auto-trait.rs:18:14
+  --> $DIR/auto-trait-phantom-data-bounds.rs:18:14
    |
 LL | fn is_zen<T: Zen>(_: T) {}
    |              ^^^ required by this bound in `is_zen`
@@ -29,7 +29,7 @@ LL | fn not_sync<T: std::marker::Sync>(x: Guard<T>) {
    |              +++++++++++++++++++
 
 error[E0277]: `T` cannot be shared between threads safely
-  --> $DIR/phantom-auto-trait.rs:26:12
+  --> $DIR/auto-trait-phantom-data-bounds.rs:26:12
    |
 LL |     is_zen(x)
    |     ------ ^ `T` cannot be shared between threads safely
@@ -37,24 +37,24 @@ LL |     is_zen(x)
    |     required by a bound introduced by this call
    |
 note: required for `&T` to implement `Zen`
-  --> $DIR/phantom-auto-trait.rs:10:24
+  --> $DIR/auto-trait-phantom-data-bounds.rs:10:24
    |
 LL | unsafe impl<'a, T: 'a> Zen for &'a T where T: Sync {}
    |                        ^^^     ^^^^^          ---- unsatisfied trait bound introduced here
 note: required because it appears within the type `PhantomData<&T>`
   --> $SRC_DIR/core/src/marker.rs:LL:COL
 note: required because it appears within the type `Guard<'_, T>`
-  --> $DIR/phantom-auto-trait.rs:12:8
+  --> $DIR/auto-trait-phantom-data-bounds.rs:12:8
    |
 LL | struct Guard<'a, T: 'a> {
    |        ^^^^^
 note: required because it appears within the type `Nested<Guard<'_, T>>`
-  --> $DIR/phantom-auto-trait.rs:16:8
+  --> $DIR/auto-trait-phantom-data-bounds.rs:16:8
    |
 LL | struct Nested<T>(T);
    |        ^^^^^^
 note: required by a bound in `is_zen`
-  --> $DIR/phantom-auto-trait.rs:18:14
+  --> $DIR/auto-trait-phantom-data-bounds.rs:18:14
    |
 LL | fn is_zen<T: Zen>(_: T) {}
    |              ^^^ required by this bound in `is_zen`
diff --git a/tests/ui/binop/binop-evaluation-order-primitive.rs b/tests/ui/binop/binop-evaluation-order-primitive.rs
new file mode 100644
index 00000000000..33266d1c047
--- /dev/null
+++ b/tests/ui/binop/binop-evaluation-order-primitive.rs
@@ -0,0 +1,15 @@
+//! Test evaluation order in binary operations with primitive types.
+
+//@ run-pass
+
+fn main() {
+    let x = Box::new(0);
+    assert_eq!(
+        0,
+        *x + {
+            drop(x);
+            let _ = Box::new(main);
+            0
+        }
+    );
+}
diff --git a/tests/ui/coercion/basic-ptr-coercions.rs b/tests/ui/coercion/basic-ptr-coercions.rs
new file mode 100644
index 00000000000..4229d1fb274
--- /dev/null
+++ b/tests/ui/coercion/basic-ptr-coercions.rs
@@ -0,0 +1,24 @@
+//! Tests basic pointer coercions
+
+//@ run-pass
+
+pub fn main() {
+    // &mut -> &
+    let x: &mut isize = &mut 42;
+    let _x: &isize = x;
+    let _x: &isize = &mut 42;
+
+    // & -> *const
+    let x: &isize = &42;
+    let _x: *const isize = x;
+    let _x: *const isize = &42;
+
+    // &mut -> *const
+    let x: &mut isize = &mut 42;
+    let _x: *const isize = x;
+    let _x: *const isize = &mut 42;
+
+    // *mut -> *const
+    let _x: *mut isize = &mut 42;
+    let _x: *const isize = x;
+}
diff --git a/tests/ui/ptr-coercion.rs b/tests/ui/coercion/ptr-mutability-errors.rs
index 2549bd6f134..391eaf0b913 100644
--- a/tests/ui/ptr-coercion.rs
+++ b/tests/ui/coercion/ptr-mutability-errors.rs
@@ -1,5 +1,4 @@
-// Test coercions between pointers which don't do anything fancy like unsizing.
-// These are testing that we don't lose mutability when converting to raw pointers.
+//! Tests that pointer coercions preserving mutability are enforced:
 
 //@ dont-require-annotations: NOTE
 
diff --git a/tests/ui/ptr-coercion.stderr b/tests/ui/coercion/ptr-mutability-errors.stderr
index 8de41d2c382..b4ded821c79 100644
--- a/tests/ui/ptr-coercion.stderr
+++ b/tests/ui/coercion/ptr-mutability-errors.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/ptr-coercion.rs:9:25
+  --> $DIR/ptr-mutability-errors.rs:8:25
    |
 LL |     let x: *mut isize = x;
    |            ----------   ^ types differ in mutability
@@ -10,7 +10,7 @@ LL |     let x: *mut isize = x;
               found raw pointer `*const isize`
 
 error[E0308]: mismatched types
-  --> $DIR/ptr-coercion.rs:15:25
+  --> $DIR/ptr-mutability-errors.rs:14:25
    |
 LL |     let x: *mut isize = &42;
    |            ----------   ^^^ types differ in mutability
@@ -21,7 +21,7 @@ LL |     let x: *mut isize = &42;
                 found reference `&isize`
 
 error[E0308]: mismatched types
-  --> $DIR/ptr-coercion.rs:21:25
+  --> $DIR/ptr-mutability-errors.rs:20:25
    |
 LL |     let x: *mut isize = x;
    |            ----------   ^ types differ in mutability
diff --git a/tests/ui/print-stdout-eprint-stderr.rs b/tests/ui/io-checks/stdout-stderr-separation.rs
index 4b356e2fe61..1bb3f16d3a1 100644
--- a/tests/ui/print-stdout-eprint-stderr.rs
+++ b/tests/ui/io-checks/stdout-stderr-separation.rs
@@ -1,3 +1,6 @@
+//! Test that print!/println! output to stdout and eprint!/eprintln!
+//! output to stderr correctly.
+
 //@ run-pass
 //@ needs-subprocess
 
diff --git a/tests/ui/mismatched_types/closure-parameter-type-inference-mismatch.rs b/tests/ui/mismatched_types/closure-parameter-type-inference-mismatch.rs
new file mode 100644
index 00000000000..1cd41114bbd
--- /dev/null
+++ b/tests/ui/mismatched_types/closure-parameter-type-inference-mismatch.rs
@@ -0,0 +1,25 @@
+//! Test closure parameter type inference and type mismatch errors.
+//!
+//! Related to <https://github.com/rust-lang/rust/issues/2093>.
+
+//@ dont-require-annotations: NOTE
+
+fn let_in<T, F>(x: T, f: F)
+where
+    F: FnOnce(T),
+{
+}
+
+fn main() {
+    let_in(3u32, |i| {
+        assert!(i == 3i32);
+        //~^ ERROR mismatched types
+        //~| NOTE expected `u32`, found `i32`
+    });
+
+    let_in(3i32, |i| {
+        assert!(i == 3u32);
+        //~^ ERROR mismatched types
+        //~| NOTE expected `i32`, found `u32`
+    });
+}
diff --git a/tests/ui/mismatched_types/closure-parameter-type-inference-mismatch.stderr b/tests/ui/mismatched_types/closure-parameter-type-inference-mismatch.stderr
new file mode 100644
index 00000000000..c75e90ce4ef
--- /dev/null
+++ b/tests/ui/mismatched_types/closure-parameter-type-inference-mismatch.stderr
@@ -0,0 +1,31 @@
+error[E0308]: mismatched types
+  --> $DIR/closure-parameter-type-inference-mismatch.rs:15:22
+   |
+LL |         assert!(i == 3i32);
+   |                 -    ^^^^ expected `u32`, found `i32`
+   |                 |
+   |                 expected because this is `u32`
+   |
+help: change the type of the numeric literal from `i32` to `u32`
+   |
+LL -         assert!(i == 3i32);
+LL +         assert!(i == 3u32);
+   |
+
+error[E0308]: mismatched types
+  --> $DIR/closure-parameter-type-inference-mismatch.rs:21:22
+   |
+LL |         assert!(i == 3u32);
+   |                 -    ^^^^ expected `i32`, found `u32`
+   |                 |
+   |                 expected because this is `i32`
+   |
+help: change the type of the numeric literal from `u32` to `i32`
+   |
+LL -         assert!(i == 3u32);
+LL +         assert!(i == 3i32);
+   |
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/point-to-type-err-cause-on-impl-trait-return-2.rs b/tests/ui/mismatched_types/type-error-diagnostic-in-complex-return.rs
index 50f1fe873cb..6711d303eb3 100644
--- a/tests/ui/point-to-type-err-cause-on-impl-trait-return-2.rs
+++ b/tests/ui/mismatched_types/type-error-diagnostic-in-complex-return.rs
@@ -1,4 +1,8 @@
-fn unrelated() -> Result<(), std::string::ParseError> {  // #57664
+//! Regression test for <https://github.com/rust-lang/rust/issues/57664>.
+//! Checks that compiler doesn't get confused by `?` operator and complex
+//! return types when reporting type mismatches.
+
+fn unrelated() -> Result<(), std::string::ParseError> {
     let x = 0;
 
     match x {
diff --git a/tests/ui/point-to-type-err-cause-on-impl-trait-return-2.stderr b/tests/ui/mismatched_types/type-error-diagnostic-in-complex-return.stderr
index 34aaea5b70b..38392fe99d6 100644
--- a/tests/ui/point-to-type-err-cause-on-impl-trait-return-2.stderr
+++ b/tests/ui/mismatched_types/type-error-diagnostic-in-complex-return.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/point-to-type-err-cause-on-impl-trait-return-2.rs:9:41
+  --> $DIR/type-error-diagnostic-in-complex-return.rs:13:41
    |
 LL |             let value: &bool = unsafe { &42 };
    |                                         ^^^ expected `&bool`, found `&{integer}`
diff --git a/tests/ui/parser/doc-comment-in-generic.rs b/tests/ui/parser/doc-comment-in-generic.rs
new file mode 100644
index 00000000000..2596496763b
--- /dev/null
+++ b/tests/ui/parser/doc-comment-in-generic.rs
@@ -0,0 +1,13 @@
+//! Tests correct parsing of doc comments on generic parameters in traits.
+//! Checks that compiler doesn't panic when processing this.
+
+//@ check-pass
+
+#![crate_type = "lib"]
+
+pub trait Layer<
+    /// Documentation for generic parameter.
+    Input,
+>
+{
+}
diff --git a/tests/ui/parser/raw/raw-string-literals.rs b/tests/ui/parser/raw/raw-string-literals.rs
new file mode 100644
index 00000000000..2272f268b36
--- /dev/null
+++ b/tests/ui/parser/raw/raw-string-literals.rs
Binary files differdiff --git a/tests/ui/pattern/move-ref-patterns/pattern-ref-bindings-reassignment.rs b/tests/ui/pattern/move-ref-patterns/pattern-ref-bindings-reassignment.rs
new file mode 100644
index 00000000000..42b0b9ac44d
--- /dev/null
+++ b/tests/ui/pattern/move-ref-patterns/pattern-ref-bindings-reassignment.rs
@@ -0,0 +1,24 @@
+//! Tests how we behave when the user attempts to mutate an immutable
+//! binding that was introduced by either `ref` or `ref mut`
+//! patterns.
+//!
+//! Such bindings cannot be made mutable via the mere addition of the
+//! `mut` keyword, and thus we want to check that the compiler does not
+//! suggest doing so.
+
+fn main() {
+    let (mut one_two, mut three_four) = ((1, 2), (3, 4));
+
+    // Bind via pattern:
+    // - `a` as immutable reference (`ref`)
+    // - `b` as mutable reference (`ref mut`)
+    let &mut (ref a, ref mut b) = &mut one_two;
+
+    // Attempt to reassign immutable `ref`-bound variable
+    a = &three_four.0;
+    //~^ ERROR cannot assign twice to immutable variable `a`
+
+    // Attempt to reassign mutable `ref mut`-bound variable
+    b = &mut three_four.1;
+    //~^ ERROR cannot assign twice to immutable variable `b`
+}
diff --git a/tests/ui/reassign-ref-mut.stderr b/tests/ui/pattern/move-ref-patterns/pattern-ref-bindings-reassignment.stderr
index e623578e025..e04eb1dd25c 100644
--- a/tests/ui/reassign-ref-mut.stderr
+++ b/tests/ui/pattern/move-ref-patterns/pattern-ref-bindings-reassignment.stderr
@@ -1,13 +1,14 @@
 error[E0384]: cannot assign twice to immutable variable `a`
-  --> $DIR/reassign-ref-mut.rs:12:5
+  --> $DIR/pattern-ref-bindings-reassignment.rs:18:5
    |
 LL |     let &mut (ref a, ref mut b) = &mut one_two;
    |               ----- first assignment to `a`
+...
 LL |     a = &three_four.0;
    |     ^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
 
 error[E0384]: cannot assign twice to immutable variable `b`
-  --> $DIR/reassign-ref-mut.rs:14:5
+  --> $DIR/pattern-ref-bindings-reassignment.rs:22:5
    |
 LL |     let &mut (ref a, ref mut b) = &mut one_two;
    |                      --------- first assignment to `b`
diff --git a/tests/ui/pptypedef.rs b/tests/ui/pptypedef.rs
deleted file mode 100644
index d5f43df9d85..00000000000
--- a/tests/ui/pptypedef.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-//@ dont-require-annotations: NOTE
-
-fn let_in<T, F>(x: T, f: F) where F: FnOnce(T) {}
-
-fn main() {
-    let_in(3u32, |i| { assert!(i == 3i32); });
-    //~^ ERROR mismatched types
-    //~| NOTE expected `u32`, found `i32`
-
-    let_in(3i32, |i| { assert!(i == 3u32); });
-    //~^ ERROR mismatched types
-    //~| NOTE expected `i32`, found `u32`
-}
diff --git a/tests/ui/pptypedef.stderr b/tests/ui/pptypedef.stderr
deleted file mode 100644
index a6d673e61c6..00000000000
--- a/tests/ui/pptypedef.stderr
+++ /dev/null
@@ -1,31 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/pptypedef.rs:6:37
-   |
-LL |     let_in(3u32, |i| { assert!(i == 3i32); });
-   |                                -    ^^^^ expected `u32`, found `i32`
-   |                                |
-   |                                expected because this is `u32`
-   |
-help: change the type of the numeric literal from `i32` to `u32`
-   |
-LL -     let_in(3u32, |i| { assert!(i == 3i32); });
-LL +     let_in(3u32, |i| { assert!(i == 3u32); });
-   |
-
-error[E0308]: mismatched types
-  --> $DIR/pptypedef.rs:10:37
-   |
-LL |     let_in(3i32, |i| { assert!(i == 3u32); });
-   |                                -    ^^^^ expected `i32`, found `u32`
-   |                                |
-   |                                expected because this is `i32`
-   |
-help: change the type of the numeric literal from `u32` to `i32`
-   |
-LL -     let_in(3i32, |i| { assert!(i == 3u32); });
-LL +     let_in(3i32, |i| { assert!(i == 3i32); });
-   |
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/primitive-binop-lhs-mut.rs b/tests/ui/primitive-binop-lhs-mut.rs
deleted file mode 100644
index d988e2ed14f..00000000000
--- a/tests/ui/primitive-binop-lhs-mut.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-//@ run-pass
-
-fn main() {
-    let x = Box::new(0);
-    assert_eq!(0, *x + { drop(x); let _ = Box::new(main); 0 });
-}
diff --git a/tests/ui/print-calling-conventions.rs b/tests/ui/print-calling-conventions.rs
deleted file mode 100644
index 302ed088142..00000000000
--- a/tests/ui/print-calling-conventions.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-//@ compile-flags: --print calling-conventions
-//@ build-pass
diff --git a/tests/ui/print-request/print-calling-conventions.rs b/tests/ui/print-request/print-calling-conventions.rs
new file mode 100644
index 00000000000..cefaa0d9b6f
--- /dev/null
+++ b/tests/ui/print-request/print-calling-conventions.rs
@@ -0,0 +1,4 @@
+//! Test that `--print calling-conventions` outputs all supported calling conventions.
+
+//@ compile-flags: --print calling-conventions
+//@ build-pass
diff --git a/tests/ui/print-calling-conventions.stdout b/tests/ui/print-request/print-calling-conventions.stdout
index b8b939e1c04..b8b939e1c04 100644
--- a/tests/ui/print-calling-conventions.stdout
+++ b/tests/ui/print-request/print-calling-conventions.stdout
diff --git a/tests/ui/project-cache-issue-31849.rs b/tests/ui/project-cache-issue-31849.rs
deleted file mode 100644
index 29c278171a6..00000000000
--- a/tests/ui/project-cache-issue-31849.rs
+++ /dev/null
@@ -1,65 +0,0 @@
-//@ run-pass
-// Regression test for #31849: the problem here was actually a performance
-// cliff, but I'm adding the test for reference.
-
-pub trait Upcast<T> {
-    fn upcast(self) -> T;
-}
-
-impl<S1, S2, T1, T2> Upcast<(T1, T2)> for (S1,S2)
-    where S1: Upcast<T1>,
-          S2: Upcast<T2>,
-{
-    fn upcast(self) -> (T1, T2) { (self.0.upcast(), self.1.upcast()) }
-}
-
-impl Upcast<()> for ()
-{
-    fn upcast(self) -> () { () }
-}
-
-pub trait ToStatic {
-    type Static: 'static;
-    fn to_static(self) -> Self::Static where Self: Sized;
-}
-
-impl<T, U> ToStatic for (T, U)
-    where T: ToStatic,
-          U: ToStatic
-{
-    type Static = (T::Static, U::Static);
-    fn to_static(self) -> Self::Static { (self.0.to_static(), self.1.to_static()) }
-}
-
-impl ToStatic for ()
-{
-    type Static = ();
-    fn to_static(self) -> () { () }
-}
-
-
-trait Factory {
-    type Output;
-    fn build(&self) -> Self::Output;
-}
-
-impl<S,T> Factory for (S, T)
-    where S: Factory,
-          T: Factory,
-          S::Output: ToStatic,
-          <S::Output as ToStatic>::Static: Upcast<S::Output>,
-{
-    type Output = (S::Output, T::Output);
-    fn build(&self) -> Self::Output { (self.0.build().to_static().upcast(), self.1.build()) }
-}
-
-impl Factory for () {
-    type Output = ();
-    fn build(&self) -> Self::Output { () }
-}
-
-fn main() {
-    // More parens, more time.
-    let it = ((((((((((),()),()),()),()),()),()),()),()),());
-    it.build();
-}
diff --git a/tests/ui/ptr-coercion-rpass.rs b/tests/ui/ptr-coercion-rpass.rs
deleted file mode 100644
index 8cc4120328e..00000000000
--- a/tests/ui/ptr-coercion-rpass.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-//@ run-pass
-
-#![allow(unused_variables)]
-// Test coercions between pointers which don't do anything fancy like unsizing.
-
-
-pub fn main() {
-    // &mut -> &
-    let x: &mut isize = &mut 42;
-    let x: &isize = x;
-
-    let x: &isize = &mut 42;
-
-    // & -> *const
-    let x: &isize = &42;
-    let x: *const isize = x;
-
-    let x: *const isize = &42;
-
-    // &mut -> *const
-    let x: &mut isize = &mut 42;
-    let x: *const isize = x;
-
-    let x: *const isize = &mut 42;
-
-    // *mut -> *const
-    let x: *mut isize = &mut 42;
-    let x: *const isize = x;
-}
diff --git a/tests/ui/query-visibility.rs b/tests/ui/query-visibility.rs
deleted file mode 100644
index 84abe875910..00000000000
--- a/tests/ui/query-visibility.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-//@ check-pass
-// Check that it doesn't panic when `Input` gets its visibility checked.
-
-#![crate_type = "lib"]
-
-pub trait Layer<
-    /// Hello.
-    Input,
-> {}
diff --git a/tests/ui/raw-str.rs b/tests/ui/raw-str.rs
deleted file mode 100644
index 23018403295..00000000000
--- a/tests/ui/raw-str.rs
+++ /dev/null
Binary files differdiff --git a/tests/ui/reassign-ref-mut.rs b/tests/ui/reassign-ref-mut.rs
deleted file mode 100644
index d6d41e959d9..00000000000
--- a/tests/ui/reassign-ref-mut.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Tests how we behave when the user attempts to mutate an immutable
-// binding that was introduced by either `ref` or `ref mut`
-// patterns.
-//
-// Such bindings cannot be made mutable via the mere addition of the
-// `mut` keyword, and thus we want to check that the compiler does not
-// suggest doing so.
-
-fn main() {
-    let (mut one_two, mut three_four) = ((1, 2), (3, 4));
-    let &mut (ref a, ref mut b) = &mut one_two;
-    a = &three_four.0;
-    //~^ ERROR cannot assign twice to immutable variable `a` [E0384]
-    b = &mut three_four.1;
-    //~^ ERROR cannot assign twice to immutable variable `b` [E0384]
-}
diff --git a/tests/ui/paths-containing-nul.rs b/tests/ui/std/fs-nul-byte-paths.rs
index 5c37980127d..79012362347 100644
--- a/tests/ui/paths-containing-nul.rs
+++ b/tests/ui/std/fs-nul-byte-paths.rs
@@ -1,18 +1,22 @@
-//@ run-pass
+//! Test that `std::fs` functions properly reject paths containing NUL bytes.
 
+//@ run-pass
 #![allow(deprecated)]
 //@ ignore-wasm32 no cwd
 //@ ignore-sgx no files
 
-use std::fs;
-use std::io;
+use std::{fs, io};
 
 fn assert_invalid_input<T>(on: &str, result: io::Result<T>) {
     fn inner(on: &str, result: io::Result<()>) {
         match result {
             Ok(()) => panic!("{} didn't return an error on a path with NUL", on),
-            Err(e) => assert!(e.kind() == io::ErrorKind::InvalidInput,
-                              "{} returned a strange {:?} on a path with NUL", on, e.kind()),
+            Err(e) => assert!(
+                e.kind() == io::ErrorKind::InvalidInput,
+                "{} returned a strange {:?} on a path with NUL",
+                on,
+                e.kind()
+            ),
         }
     }
     inner(on, result.map(drop))
@@ -43,6 +47,8 @@ fn main() {
     assert_invalid_input("remove_dir", fs::remove_dir("\0"));
     assert_invalid_input("remove_dir_all", fs::remove_dir_all("\0"));
     assert_invalid_input("read_dir", fs::read_dir("\0"));
-    assert_invalid_input("set_permissions",
-                         fs::set_permissions("\0", fs::metadata(".").unwrap().permissions()));
+    assert_invalid_input(
+        "set_permissions",
+        fs::set_permissions("\0", fs::metadata(".").unwrap().permissions()),
+    );
 }
diff --git a/tests/ui/typeck/nested-generic-traits-performance.rs b/tests/ui/typeck/nested-generic-traits-performance.rs
new file mode 100644
index 00000000000..e029228c1b2
--- /dev/null
+++ b/tests/ui/typeck/nested-generic-traits-performance.rs
@@ -0,0 +1,82 @@
+//! Test that deeply nested generic traits with complex bounds
+//! don't cause excessive memory usage during type checking.
+//!
+//! Regression test for <https://github.com/rust-lang/rust/issues/31849>.
+
+//@ run-pass
+
+pub trait Upcast<T> {
+    fn upcast(self) -> T;
+}
+
+impl<S1, S2, T1, T2> Upcast<(T1, T2)> for (S1, S2)
+where
+    S1: Upcast<T1>,
+    S2: Upcast<T2>,
+{
+    fn upcast(self) -> (T1, T2) {
+        (self.0.upcast(), self.1.upcast())
+    }
+}
+
+impl Upcast<()> for () {
+    fn upcast(self) -> () {
+        ()
+    }
+}
+
+pub trait ToStatic {
+    type Static: 'static;
+    fn to_static(self) -> Self::Static
+    where
+        Self: Sized;
+}
+
+impl<T, U> ToStatic for (T, U)
+where
+    T: ToStatic,
+    U: ToStatic,
+{
+    type Static = (T::Static, U::Static);
+    fn to_static(self) -> Self::Static {
+        (self.0.to_static(), self.1.to_static())
+    }
+}
+
+impl ToStatic for () {
+    type Static = ();
+    fn to_static(self) -> () {
+        ()
+    }
+}
+
+trait Factory {
+    type Output;
+    fn build(&self) -> Self::Output;
+}
+
+impl<S, T> Factory for (S, T)
+where
+    S: Factory,
+    T: Factory,
+    S::Output: ToStatic,
+    <S::Output as ToStatic>::Static: Upcast<S::Output>,
+{
+    type Output = (S::Output, T::Output);
+    fn build(&self) -> Self::Output {
+        (self.0.build().to_static().upcast(), self.1.build())
+    }
+}
+
+impl Factory for () {
+    type Output = ();
+    fn build(&self) -> Self::Output {
+        ()
+    }
+}
+
+fn main() {
+    // Deeply nested tuple to trigger the original performance issue
+    let it = ((((((((((), ()), ()), ()), ()), ()), ()), ()), ()), ());
+    it.build();
+}