about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/codegen/slice-iter-nonnull.rs35
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir178
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir146
-rw-r--r--tests/run-make/coverage-llvmir/filecheck.testprog.txt2
-rw-r--r--tests/ui/associated-inherent-types/inference.rs1
-rw-r--r--tests/ui/associated-types/associated-types-eq-3.stderr2
-rw-r--r--tests/ui/associated-types/associated-types-overridden-binding-2.stderr2
-rw-r--r--tests/ui/associated-types/issue-65774-1.stderr2
-rw-r--r--tests/ui/associated-types/issue-65774-2.stderr2
-rw-r--r--tests/ui/async-await/async-block-control-flow-static-semantics.stderr4
-rw-r--r--tests/ui/async-await/issue-86507.drop_tracking.stderr2
-rw-r--r--tests/ui/async-await/issue-86507.drop_tracking_mir.stderr2
-rw-r--r--tests/ui/async-await/issue-86507.no_drop_tracking.stderr2
-rw-r--r--tests/ui/async-await/multiple-lifetimes/partial-relation.rs2
-rw-r--r--tests/ui/borrowck/borrowck-closures-slice-patterns-ok.rs1
-rw-r--r--tests/ui/borrowck/borrowck-field-sensitivity-rpass.rs1
-rw-r--r--tests/ui/borrowck/borrowck-use-mut-borrow-rpass.rs2
-rw-r--r--tests/ui/closure_context/issue-26046-fn-mut.stderr2
-rw-r--r--tests/ui/closure_context/issue-26046-fn-once.stderr2
-rw-r--r--tests/ui/closures/2229_closure_analysis/migrations/issue-78720.rs1
-rw-r--r--tests/ui/closures/2229_closure_analysis/migrations/issue-78720.stderr2
-rw-r--r--tests/ui/closures/2229_closure_analysis/optimization/edge_case_run_pass.rs1
-rw-r--r--tests/ui/closures/2229_closure_analysis/run_pass/drop_then_use_fake_reads.rs2
-rw-r--r--tests/ui/coercion/coerce-issue-49593-box-never-windows.nofallback.stderr4
-rw-r--r--tests/ui/coercion/coerce-issue-49593-box-never.nofallback.stderr4
-rw-r--r--tests/ui/const-generics/defaults/trait_objects_fail.stderr4
-rw-r--r--tests/ui/consts/const_forget.rs2
-rw-r--r--tests/ui/consts/issue-104155.rs3
-rw-r--r--tests/ui/crate-leading-sep.rs2
-rw-r--r--tests/ui/custom_test_frameworks/mismatch.stderr2
-rw-r--r--tests/ui/diagnostic-width/E0271.stderr4
-rw-r--r--tests/ui/drop/dropck-eyepatch-manuallydrop.rs22
-rw-r--r--tests/ui/drop/repeat-drop.rs2
-rw-r--r--tests/ui/dst/dst-bad-coerce1.stderr4
-rw-r--r--tests/ui/dst/dst-object-from-unsized-type.stderr8
-rw-r--r--tests/ui/enum-discriminant/auxiliary/discr-foreign-dep.rs7
-rw-r--r--tests/ui/enum-discriminant/discr-foreign.rs11
-rw-r--r--tests/ui/explicit/explicit-call-to-supertrait-dtor.fixed3
-rw-r--r--tests/ui/explicit/explicit-call-to-supertrait-dtor.rs3
-rw-r--r--tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-cfg_overflow_checks.rs6
-rw-r--r--tests/ui/feature-gates/feature-gate-cfg_overflow_checks.stderr12
-rw-r--r--tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr9
-rw-r--r--tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs1
-rw-r--r--tests/ui/generator/drop-env.rs1
-rw-r--r--tests/ui/generator/issue-57017.no_drop_tracking.stderr42
-rw-r--r--tests/ui/generator/issue-57017.rs1
-rw-r--r--tests/ui/generator/non-static-is-unpin.rs1
-rw-r--r--tests/ui/generator/resume-arg-size.rs1
-rw-r--r--tests/ui/generic-associated-types/issue-76535.base.stderr3
-rw-r--r--tests/ui/generic-associated-types/issue-79422.base.stderr3
-rw-r--r--tests/ui/generic-associated-types/issue-79422.extended.stderr2
-rw-r--r--tests/ui/generic-associated-types/issue-88595.rs1
-rw-r--r--tests/ui/generic-associated-types/issue-88595.stderr34
-rw-r--r--tests/ui/hygiene/stdlib-prelude-from-opaque-late.rs1
-rw-r--r--tests/ui/illegal-ufcs-drop.fixed3
-rw-r--r--tests/ui/illegal-ufcs-drop.rs3
-rw-r--r--tests/ui/illegal-ufcs-drop.stderr2
-rw-r--r--tests/ui/impl-trait/in-assoc-type-unconstrained.rs27
-rw-r--r--tests/ui/impl-trait/in-assoc-type-unconstrained.stderr59
-rw-r--r--tests/ui/impl-trait/in-assoc-type.rs21
-rw-r--r--tests/ui/impl-trait/in-assoc-type.stderr22
-rw-r--r--tests/ui/impl-trait/in-trait/object-safety.current.stderr3
-rw-r--r--tests/ui/impl-trait/in-trait/object-safety.next.stderr3
-rw-r--r--tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr5
-rw-r--r--tests/ui/issues/issue-14366.stderr4
-rw-r--r--tests/ui/issues/issue-22034.stderr2
-rw-r--r--tests/ui/issues/issue-22872.stderr2
-rw-r--r--tests/ui/kindck/kindck-impl-type-params.stderr12
-rw-r--r--tests/ui/kindck/kindck-inherited-copy-bound.curr.stderr3
-rw-r--r--tests/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr3
-rw-r--r--tests/ui/lint/drop_copy.rs79
-rw-r--r--tests/ui/lint/drop_copy.stderr108
-rw-r--r--tests/ui/lint/drop_ref.rs99
-rw-r--r--tests/ui/lint/drop_ref.stderr127
-rw-r--r--tests/ui/lint/forget_copy.rs56
-rw-r--r--tests/ui/lint/forget_copy.stderr88
-rw-r--r--tests/ui/lint/forget_ref.rs39
-rw-r--r--tests/ui/lint/forget_ref.stderr97
-rw-r--r--tests/ui/liveness/liveness-unused.rs2
-rw-r--r--tests/ui/macros/parse-complex-macro-invoc-op.rs1
-rw-r--r--tests/ui/mismatched_types/cast-rfc0401.stderr12
-rw-r--r--tests/ui/never_type/fallback-closure-wrap.fallback.stderr2
-rw-r--r--tests/ui/never_type/never-assign-dead-code.rs1
-rw-r--r--tests/ui/never_type/never-assign-dead-code.stderr8
-rw-r--r--tests/ui/nll/relate_tys/hr-fn-aba-as-aaa.rs2
-rw-r--r--tests/ui/nll/ty-outlives/projection-body.rs2
-rw-r--r--tests/ui/numbers-arithmetic/overflow-attribute-works-1.rs19
-rw-r--r--tests/ui/numbers-arithmetic/overflow-attribute-works-2.rs19
-rw-r--r--tests/ui/object-safety/issue-19538.stderr3
-rw-r--r--tests/ui/object-safety/object-safety-associated-consts.object_safe_for_dispatch.stderr3
-rw-r--r--tests/ui/object-safety/object-safety-generics.object_safe_for_dispatch.stderr6
-rw-r--r--tests/ui/object-safety/object-safety-mentions-Self.object_safe_for_dispatch.stderr6
-rw-r--r--tests/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr3
-rw-r--r--tests/ui/object-safety/object-safety-sized-2.object_safe_for_dispatch.stderr3
-rw-r--r--tests/ui/object-safety/object-safety-sized.object_safe_for_dispatch.stderr3
-rw-r--r--tests/ui/or-patterns/or-patterns-default-binding-modes.rs2
-rw-r--r--tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box-pass.rs3
-rw-r--r--tests/ui/pattern/bindings-after-at/borrowck-pat-by-copy-bindings-in-at.rs2
-rw-r--r--tests/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern-pass.rs2
-rw-r--r--tests/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures-pass.rs2
-rw-r--r--tests/ui/print_type_sizes/async.rs2
-rw-r--r--tests/ui/print_type_sizes/async.stdout8
-rw-r--r--tests/ui/print_type_sizes/generator_discr_placement.rs1
-rw-r--r--tests/ui/print_type_sizes/generator_discr_placement.stdout2
-rw-r--r--tests/ui/regions/type-param-outlives-reempty-issue-74429-2.rs6
-rw-r--r--tests/ui/regions/type-param-outlives-reempty-issue-74429.rs2
-rw-r--r--tests/ui/rfc-2008-non-exhaustive/borrowck-exhaustive.rs2
-rw-r--r--tests/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs2
-rw-r--r--tests/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.run.stderr30
-rw-r--r--tests/ui/rust-2018/remove-extern-crate.fixed1
-rw-r--r--tests/ui/rust-2018/remove-extern-crate.rs1
-rw-r--r--tests/ui/rust-2018/remove-extern-crate.stderr6
-rw-r--r--tests/ui/self/arbitrary-self-types-not-object-safe.curr.stderr3
-rw-r--r--tests/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr3
-rw-r--r--tests/ui/statics/issue-91050-1.rs2
-rw-r--r--tests/ui/suggestions/derive-macro-missing-bounds.stderr8
-rw-r--r--tests/ui/suggestions/suggest-borrow-to-dyn-object.rs16
-rw-r--r--tests/ui/suggestions/suggest-borrow-to-dyn-object.stderr18
-rw-r--r--tests/ui/traits/coercion-generic-bad.stderr2
-rw-r--r--tests/ui/traits/copy-guessing.rs3
-rw-r--r--tests/ui/traits/impl-evaluation-order.rs2
-rw-r--r--tests/ui/traits/issue-20692.stderr3
-rw-r--r--tests/ui/traits/issue-38604.stderr3
-rw-r--r--tests/ui/traits/issue-7013.stderr2
-rw-r--r--tests/ui/traits/map-types.stderr2
-rw-r--r--tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr4
-rw-r--r--tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs1
-rw-r--r--tests/ui/traits/new-solver/temporary-ambiguity.rs2
-rw-r--r--tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr3
-rw-r--r--tests/ui/traits/object/safety.stderr3
-rw-r--r--tests/ui/traits/test-2.stderr3
-rw-r--r--tests/ui/traits/trait-upcasting/type-checking-test-1.stderr2
-rw-r--r--tests/ui/traits/trait-upcasting/type-checking-test-2.stderr4
-rw-r--r--tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs2
-rw-r--r--tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/associated-type-impl-trait-lifetime.rs9
-rw-r--r--tests/ui/type-alias-impl-trait/invalid_impl_trait_in_assoc_ty.rs16
-rw-r--r--tests/ui/type-alias-impl-trait/invalid_impl_trait_in_assoc_ty.stderr22
-rw-r--r--tests/ui/type-alias-impl-trait/issue-98604.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/issue-98608.stderr2
-rw-r--r--tests/ui/type/issue-58355.stderr2
-rw-r--r--tests/ui/unsized/unsized-fn-param.stderr16
-rw-r--r--tests/ui/wf/wf-convert-unsafe-trait-obj-box.stderr9
-rw-r--r--tests/ui/wf/wf-convert-unsafe-trait-obj.stderr9
-rw-r--r--tests/ui/wf/wf-unsafe-trait-obj-match.stderr6
146 files changed, 1522 insertions, 307 deletions
diff --git a/tests/codegen/slice-iter-nonnull.rs b/tests/codegen/slice-iter-nonnull.rs
index 392e4338076..997bdaf5636 100644
--- a/tests/codegen/slice-iter-nonnull.rs
+++ b/tests/codegen/slice-iter-nonnull.rs
@@ -40,3 +40,38 @@ pub fn slice_iter_next_back<'a>(it: &mut std::slice::Iter<'a, u32>) -> Option<&'
 
     it.next_back()
 }
+
+// The slice iterator `new` methods used to `assume` that the pointer is non-null,
+// but passing slices already requires that, to the extent that LLVM actually
+// removed the `call @llvm.assume` anyway.  These tests just demonstrate that the
+// attribute is there, and confirms adding the assume back doesn't do anything.
+
+// CHECK-LABEL: @slice_iter_new
+// CHECK-SAME: (ptr noalias noundef nonnull {{.+}} %slice.0, {{.+}} noundef %slice.1)
+#[no_mangle]
+pub fn slice_iter_new(slice: &[u32]) -> std::slice::Iter<'_, u32> {
+    // CHECK-NOT: slice
+    // CHECK: %[[END:.+]] = getelementptr inbounds i32{{.+}} %slice.0{{.+}} %slice.1
+    // CHECK-NOT: slice
+    // CHECK: insertvalue {{.+}} ptr %slice.0, 0
+    // CHECK-NOT: slice
+    // CHECK: insertvalue {{.+}} ptr %[[END]], 1
+    // CHECK-NOT: slice
+    // CHECK: }
+    slice.iter()
+}
+
+// CHECK-LABEL: @slice_iter_mut_new
+// CHECK-SAME: (ptr noalias noundef nonnull {{.+}} %slice.0, {{.+}} noundef %slice.1)
+#[no_mangle]
+pub fn slice_iter_mut_new(slice: &mut [u32]) -> std::slice::IterMut<'_, u32> {
+    // CHECK-NOT: slice
+    // CHECK: %[[END:.+]] = getelementptr inbounds i32{{.+}} %slice.0{{.+}} %slice.1
+    // CHECK-NOT: slice
+    // CHECK: insertvalue {{.+}} ptr %slice.0, 0
+    // CHECK-NOT: slice
+    // CHECK: insertvalue {{.+}} ptr %[[END]], 1
+    // CHECK-NOT: slice
+    // CHECK: }
+    slice.iter_mut()
+}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir
index f27525bf3d9..0da7e5536ae 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir
@@ -6,58 +6,120 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     let mut _0: ();                      // return place in scope 0 at $DIR/slice_iter.rs:+0:60: +0:60
     let mut _3: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
     let mut _4: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
-    let mut _5: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
-    let _6: ();                          // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
-    let mut _7: std::option::Option<&T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
-    let mut _8: &mut std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
-    let mut _9: isize;                   // in scope 0 at $DIR/slice_iter.rs:+1:5: +3:6
-    let mut _11: &impl Fn(&T);           // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:10
-    let mut _12: (&T,);                  // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:13
+    let _5: ();                          // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
+    let mut _6: std::option::Option<&T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
+    let mut _7: &mut std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
+    let mut _8: isize;                   // in scope 0 at $DIR/slice_iter.rs:+1:5: +3:6
+    let mut _10: &impl Fn(&T);           // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:10
+    let mut _11: (&T,);                  // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:13
     scope 1 {
-        debug iter => _5;                // in scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
-        let _10: &T;                     // in scope 1 at $DIR/slice_iter.rs:+1:9: +1:10
+        debug iter => _4;                // in scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
+        let _9: &T;                      // in scope 1 at $DIR/slice_iter.rs:+1:9: +1:10
         scope 2 {
-            debug x => _10;              // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10
+            debug x => _9;               // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10
         }
     }
     scope 3 (inlined core::slice::<impl [T]>::iter) { // at $DIR/slice_iter.rs:28:20: 28:26
         debug self => _1;                // in scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        scope 4 (inlined std::slice::Iter::<'_, T>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+            debug slice => _1;           // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            let _12: *const T;           // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            let mut _14: bool;           // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            let mut _15: usize;          // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            let mut _16: usize;          // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            let mut _17: std::ptr::NonNull<T>; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            let mut _18: *mut T;         // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            let mut _19: *const T;       // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            scope 5 {
+                debug ptr => _12;        // in scope 5 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                scope 6 {
+                    let _13: *const T;   // in scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                    scope 7 {
+                        debug end => _13; // in scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                        scope 13 (inlined NonNull::<T>::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                            debug ptr => _18; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+                            let mut _21: *const T; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+                            let mut _22: *mut T; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+                            scope 14 {
+                                scope 15 (inlined NonNull::<T>::new_unchecked::runtime::<T>) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+                                    debug ptr => _22; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+                                    scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+                                        debug self => _22; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                        let mut _23: *mut u8; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                        scope 17 {
+                                            scope 18 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                                debug ptr => _23; // in scope 18 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                                scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                                    debug self => _23; // in scope 19 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                                    scope 20 {
+                                                        scope 21 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                                            debug self => _23; // in scope 21 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                                        }
+                                                    }
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                    scope 9 (inlined invalid::<T>) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                        debug addr => _15; // in scope 9 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+                        scope 10 {
+                        }
+                    }
+                    scope 11 (inlined ptr::const_ptr::<impl *const T>::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                        debug self => _12; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+                        debug count => _16; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+                        scope 12 {
+                        }
+                    }
+                }
+            }
+            scope 8 (inlined core::slice::<impl [T]>::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                debug self => _1;        // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+                let mut _20: *const [T]; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+            }
+        }
     }
-    scope 4 (inlined <std::slice::Iter<'_, T> as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:28:14: 28:26
-        debug self => _4;                // in scope 4 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    scope 22 (inlined <std::slice::Iter<'_, T> as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:28:14: 28:26
+        debug self => _3;                // in scope 22 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
     }
 
     bb0: {
-        StorageLive(_3);                 // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
-        StorageLive(_4);                 // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
-        _4 = std::slice::Iter::<'_, T>::new(_1) -> [return: bb10, unwind: bb8]; // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
-                                         // mir::Constant
-                                         // + span: $SRC_DIR/core/src/slice/mod.rs:LL:COL
-                                         // + user_ty: UserType(0)
-                                         // + literal: Const { ty: fn(&[T]) -> std::slice::Iter<'_, T> {std::slice::Iter::<'_, T>::new}, val: Value(<ZST>) }
+        StorageLive(_12);                // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        StorageLive(_20);                // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        _20 = &raw const (*_1);          // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        _12 = move _20 as *const T (PtrToPtr); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        StorageDead(_20);                // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        StorageLive(_13);                // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageLive(_14);                // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _14 = const _;                   // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        switchInt(move _14) -> [0: bb11, otherwise: bb10]; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
     }
 
     bb1: {
-        StorageLive(_7);                 // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
-        _8 = &mut _5;                    // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
-        _7 = <std::slice::Iter<'_, T> as Iterator>::next(_8) -> [return: bb2, unwind: bb8]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
+        StorageLive(_6);                 // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
+        _7 = &mut _4;                    // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
+        _6 = <std::slice::Iter<'_, T> as Iterator>::next(_7) -> [return: bb2, unwind: bb8]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
                                          // mir::Constant
                                          // + span: $DIR/slice_iter.rs:28:14: 28:26
                                          // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, T>) -> Option<<std::slice::Iter<'_, T> as Iterator>::Item> {<std::slice::Iter<'_, T> as Iterator>::next}, val: Value(<ZST>) }
     }
 
     bb2: {
-        _9 = discriminant(_7);           // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
-        switchInt(move _9) -> [0: bb5, 1: bb3, otherwise: bb4]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
+        _8 = discriminant(_6);           // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
+        switchInt(move _8) -> [0: bb5, 1: bb3, otherwise: bb4]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
     }
 
     bb3: {
-        _10 = ((_7 as Some).0: &T);      // scope 1 at $DIR/slice_iter.rs:+1:9: +1:10
-        StorageLive(_11);                // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10
-        _11 = &_2;                       // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10
-        StorageLive(_12);                // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13
-        _12 = (_10,);                    // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13
-        _6 = <impl Fn(&T) as Fn<(&T,)>>::call(move _11, move _12) -> [return: bb6, unwind: bb8]; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13
+        _9 = ((_6 as Some).0: &T);       // scope 1 at $DIR/slice_iter.rs:+1:9: +1:10
+        StorageLive(_10);                // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10
+        _10 = &_2;                       // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10
+        StorageLive(_11);                // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13
+        _11 = (_9,);                     // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13
+        _5 = <impl Fn(&T) as Fn<(&T,)>>::call(move _10, move _11) -> [return: bb6, unwind: bb8]; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13
                                          // mir::Constant
                                          // + span: $DIR/slice_iter.rs:29:9: 29:10
                                          // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(&T), (&T,)) -> <impl Fn(&T) as FnOnce<(&T,)>>::Output {<impl Fn(&T) as Fn<(&T,)>>::call}, val: Value(<ZST>) }
@@ -68,16 +130,15 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     }
 
     bb5: {
-        StorageDead(_7);                 // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6
-        StorageDead(_5);                 // scope 0 at $DIR/slice_iter.rs:+3:5: +3:6
-        StorageDead(_3);                 // scope 0 at $DIR/slice_iter.rs:+3:5: +3:6
+        StorageDead(_6);                 // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6
+        StorageDead(_4);                 // scope 0 at $DIR/slice_iter.rs:+3:5: +3:6
         drop(_2) -> bb7;                 // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2
     }
 
     bb6: {
-        StorageDead(_12);                // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13
         StorageDead(_11);                // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13
-        StorageDead(_7);                 // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6
+        StorageDead(_10);                // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13
+        StorageDead(_6);                 // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6
         goto -> bb1;                     // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6
     }
 
@@ -94,10 +155,49 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     }
 
     bb10: {
-        _3 = move _4;                    // scope 4 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-        StorageDead(_4);                 // scope 0 at $DIR/slice_iter.rs:+1:25: +1:26
-        StorageLive(_5);                 // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
-        _5 = move _3;                    // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
+        StorageLive(_15);                // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _15 = Len((*_1));                // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _13 = _15 as *const T (Transmute); // scope 10 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+        StorageDead(_15);                // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        goto -> bb12;                    // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+    }
+
+    bb11: {
+        StorageLive(_16);                // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _16 = Len((*_1));                // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _13 = Offset(_12, _16);          // scope 12 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+        StorageDead(_16);                // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        goto -> bb12;                    // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+    }
+
+    bb12: {
+        StorageDead(_14);                // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageLive(_17);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageLive(_18);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _18 = _12 as *mut T (PtrToPtr);  // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageLive(_21);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageLive(_22);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageLive(_23);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _21 = _18 as *const T (Pointer(MutToConstPointer)); // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+        _17 = NonNull::<T> { pointer: _21 }; // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+        StorageDead(_23);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageDead(_22);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageDead(_21);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageDead(_18);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageLive(_19);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _19 = _13;                       // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _3 = std::slice::Iter::<'_, T> { ptr: move _17, end: move _19, _marker: const ZeroSized: PhantomData<&T> }; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                                         // mir::Constant
+                                         // + span: no-location
+                                         // + literal: Const { ty: PhantomData<&T>, val: Value(<ZST>) }
+                                         // adt
+                                         // + user_ty: UserType(1)
+        StorageDead(_19);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageDead(_17);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageDead(_13);                // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageDead(_12);                // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        StorageLive(_4);                 // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
+        _4 = move _3;                    // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
         goto -> bb1;                     // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6
     }
 }
diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir
index 62dd9667d96..45b41b54c8b 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir
@@ -19,39 +19,104 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
         scope 2 {
             debug x => _10;              // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10
         }
-        scope 7 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) { // at $DIR/slice_iter.rs:35:14: 35:32
-            debug self => _8;            // in scope 7 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
-            let mut _13: &mut std::slice::Iter<'_, T>; // in scope 7 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
+        scope 25 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) { // at $DIR/slice_iter.rs:35:14: 35:32
+            debug self => _8;            // in scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
+            let mut _25: &mut std::slice::Iter<'_, T>; // in scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
         }
     }
     scope 3 (inlined core::slice::<impl [T]>::iter) { // at $DIR/slice_iter.rs:35:20: 35:26
         debug self => _1;                // in scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        scope 4 (inlined std::slice::Iter::<'_, T>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+            debug slice => _1;           // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            let _13: *const T;           // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            let mut _15: bool;           // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            let mut _16: usize;          // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            let mut _17: usize;          // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            let mut _18: std::ptr::NonNull<T>; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            let mut _19: *mut T;         // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            let mut _20: *const T;       // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+            scope 5 {
+                debug ptr => _13;        // in scope 5 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                scope 6 {
+                    let _14: *const T;   // in scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                    scope 7 {
+                        debug end => _14; // in scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                        scope 13 (inlined NonNull::<T>::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                            debug ptr => _19; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+                            let mut _22: *const T; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+                            let mut _23: *mut T; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+                            scope 14 {
+                                scope 15 (inlined NonNull::<T>::new_unchecked::runtime::<T>) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+                                    debug ptr => _23; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+                                    scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+                                        debug self => _23; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                        let mut _24: *mut u8; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                        scope 17 {
+                                            scope 18 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                                debug ptr => _24; // in scope 18 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                                scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                                    debug self => _24; // in scope 19 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                                    scope 20 {
+                                                        scope 21 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                                            debug self => _24; // in scope 21 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+                                                        }
+                                                    }
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                    scope 9 (inlined invalid::<T>) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                        debug addr => _16; // in scope 9 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+                        scope 10 {
+                        }
+                    }
+                    scope 11 (inlined ptr::const_ptr::<impl *const T>::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                        debug self => _13; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+                        debug count => _17; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+                        scope 12 {
+                        }
+                    }
+                }
+            }
+            scope 8 (inlined core::slice::<impl [T]>::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                debug self => _1;        // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+                let mut _21: *const [T]; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+            }
+        }
     }
-    scope 4 (inlined <std::slice::Iter<'_, T> as Iterator>::rev) { // at $DIR/slice_iter.rs:35:27: 35:32
-        debug self => _4;                // in scope 4 at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-        scope 5 (inlined Rev::<std::slice::Iter<'_, T>>::new) { // at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-            debug iter => _4;            // in scope 5 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
+    scope 22 (inlined <std::slice::Iter<'_, T> as Iterator>::rev) { // at $DIR/slice_iter.rs:35:27: 35:32
+        debug self => _4;                // in scope 22 at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+        scope 23 (inlined Rev::<std::slice::Iter<'_, T>>::new) { // at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+            debug iter => _4;            // in scope 23 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
         }
     }
-    scope 6 (inlined <Rev<std::slice::Iter<'_, T>> as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:35:14: 35:32
-        debug self => _3;                // in scope 6 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+    scope 24 (inlined <Rev<std::slice::Iter<'_, T>> as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:35:14: 35:32
+        debug self => _3;                // in scope 24 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
     }
 
     bb0: {
         StorageLive(_4);                 // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
-        _4 = std::slice::Iter::<'_, T>::new(_1) -> [return: bb9, unwind: bb7]; // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
-                                         // mir::Constant
-                                         // + span: $SRC_DIR/core/src/slice/mod.rs:LL:COL
-                                         // + user_ty: UserType(0)
-                                         // + literal: Const { ty: fn(&[T]) -> std::slice::Iter<'_, T> {std::slice::Iter::<'_, T>::new}, val: Value(<ZST>) }
+        StorageLive(_13);                // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        StorageLive(_21);                // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        _21 = &raw const (*_1);          // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        _13 = move _21 as *const T (PtrToPtr); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        StorageDead(_21);                // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        StorageLive(_14);                // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageLive(_15);                // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _15 = const _;                   // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        switchInt(move _15) -> [0: bb10, otherwise: bb9]; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
     }
 
     bb1: {
         StorageLive(_7);                 // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32
         _8 = &mut _5;                    // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32
-        StorageLive(_13);                // scope 7 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
-        _13 = &mut ((*_8).0: std::slice::Iter<'_, T>); // scope 7 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
-        _7 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _13) -> [return: bb10, unwind: bb7]; // scope 7 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
+        StorageLive(_25);                // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
+        _25 = &mut ((*_8).0: std::slice::Iter<'_, T>); // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
+        _7 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _25) -> [return: bb12, unwind: bb7]; // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
                                          // mir::Constant
                                          // + span: $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
                                          // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, T>) -> Option<<std::slice::Iter<'_, T> as Iterator>::Item> {<std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back}, val: Value(<ZST>) }
@@ -99,15 +164,56 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
     }
 
     bb9: {
-        _3 = Rev::<std::slice::Iter<'_, T>> { iter: move _4 }; // scope 5 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
+        StorageLive(_16);                // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _16 = Len((*_1));                // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _14 = _16 as *const T (Transmute); // scope 10 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+        StorageDead(_16);                // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        goto -> bb11;                    // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+    }
+
+    bb10: {
+        StorageLive(_17);                // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _17 = Len((*_1));                // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _14 = Offset(_13, _17);          // scope 12 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+        StorageDead(_17);                // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        goto -> bb11;                    // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+    }
+
+    bb11: {
+        StorageDead(_15);                // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageLive(_18);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageLive(_19);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _19 = _13 as *mut T (PtrToPtr);  // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageLive(_22);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageLive(_23);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageLive(_24);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _22 = _19 as *const T (Pointer(MutToConstPointer)); // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+        _18 = NonNull::<T> { pointer: _22 }; // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+        StorageDead(_24);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageDead(_23);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageDead(_22);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageDead(_19);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageLive(_20);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _20 = _14;                       // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        _4 = std::slice::Iter::<'_, T> { ptr: move _18, end: move _20, _marker: const ZeroSized: PhantomData<&T> }; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+                                         // mir::Constant
+                                         // + span: no-location
+                                         // + literal: Const { ty: PhantomData<&T>, val: Value(<ZST>) }
+                                         // adt
+                                         // + user_ty: UserType(1)
+        StorageDead(_20);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageDead(_18);                // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageDead(_14);                // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+        StorageDead(_13);                // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+        _3 = Rev::<std::slice::Iter<'_, T>> { iter: move _4 }; // scope 23 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
         StorageDead(_4);                 // scope 0 at $DIR/slice_iter.rs:+1:31: +1:32
         StorageLive(_5);                 // scope 0 at $DIR/slice_iter.rs:+1:14: +1:32
         _5 = move _3;                    // scope 0 at $DIR/slice_iter.rs:+1:14: +1:32
         goto -> bb1;                     // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6
     }
 
-    bb10: {
-        StorageDead(_13);                // scope 7 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
+    bb12: {
+        StorageDead(_25);                // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
         _9 = discriminant(_7);           // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32
         switchInt(move _9) -> [0: bb4, 1: bb2, otherwise: bb3]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32
     }
diff --git a/tests/run-make/coverage-llvmir/filecheck.testprog.txt b/tests/run-make/coverage-llvmir/filecheck.testprog.txt
index c943261d799..b3a8808df05 100644
--- a/tests/run-make/coverage-llvmir/filecheck.testprog.txt
+++ b/tests/run-make/coverage-llvmir/filecheck.testprog.txt
@@ -36,7 +36,7 @@ CHECK-SAME:   section "llvm.metadata"
 CHECK:        [[DEFINE_INTERNAL]] { {{.*}} } @_R{{[a-zA-Z0-9_]+}}testprog14will_be_called() unnamed_addr #{{[0-9]+}} {
 CHECK-NEXT:   start:
 CHECK-NOT:    [[DEFINE_INTERNAL]]
-CHECK:        %pgocount = load i64, {{i64\*|ptr}}
+CHECK:        atomicrmw add ptr
 CHECK-SAME:   @__profc__R{{[a-zA-Z0-9_]+}}testprog14will_be_called,
 
 CHECK:        declare void @llvm.instrprof.increment({{i8\*|ptr}}, i64, i32, i32) #[[LLVM_INSTRPROF_INCREMENT_ATTR:[0-9]+]]
diff --git a/tests/ui/associated-inherent-types/inference.rs b/tests/ui/associated-inherent-types/inference.rs
index 38179214fa1..7d6d26003f6 100644
--- a/tests/ui/associated-inherent-types/inference.rs
+++ b/tests/ui/associated-inherent-types/inference.rs
@@ -3,6 +3,7 @@
 
 #![feature(inherent_associated_types)]
 #![allow(incomplete_features)]
+#![allow(drop_copy)]
 
 use std::convert::identity;
 
diff --git a/tests/ui/associated-types/associated-types-eq-3.stderr b/tests/ui/associated-types/associated-types-eq-3.stderr
index 15ce4fc91cb..c3377eed20a 100644
--- a/tests/ui/associated-types/associated-types-eq-3.stderr
+++ b/tests/ui/associated-types/associated-types-eq-3.stderr
@@ -43,7 +43,7 @@ note: expected this to be `Bar`
    |
 LL |     type A = usize;
    |              ^^^^^
-   = note: required for the cast from `isize` to the object type `dyn Foo<A = Bar>`
+   = note: required for the cast from `&isize` to `&dyn Foo<A = Bar>`
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/associated-types/associated-types-overridden-binding-2.stderr b/tests/ui/associated-types/associated-types-overridden-binding-2.stderr
index a28a0b74e4a..fdec01b95e3 100644
--- a/tests/ui/associated-types/associated-types-overridden-binding-2.stderr
+++ b/tests/ui/associated-types/associated-types-overridden-binding-2.stderr
@@ -4,7 +4,7 @@ error[E0271]: expected `IntoIter<u32>` to be an iterator that yields `i32`, but
 LL |     let _: &dyn I32Iterator<Item = u32> = &vec![42].into_iter();
    |                                           ^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`
    |
-   = note: required for the cast from `std::vec::IntoIter<u32>` to the object type `dyn Iterator<Item = u32, Item = i32>`
+   = note: required for the cast from `&std::vec::IntoIter<u32>` to `&dyn Iterator<Item = u32, Item = i32>`
 
 error: aborting due to previous error
 
diff --git a/tests/ui/associated-types/issue-65774-1.stderr b/tests/ui/associated-types/issue-65774-1.stderr
index 91b557555d5..9c77a25c432 100644
--- a/tests/ui/associated-types/issue-65774-1.stderr
+++ b/tests/ui/associated-types/issue-65774-1.stderr
@@ -25,7 +25,7 @@ LL | impl<'a, T: MyDisplay> MyDisplay for &'a mut T { }
    |             ---------  ^^^^^^^^^     ^^^^^^^^^
    |             |
    |             unsatisfied trait bound introduced here
-   = note: required for the cast from `&mut T` to the object type `dyn MyDisplay`
+   = note: required for the cast from `&&mut T` to `&dyn MyDisplay`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/associated-types/issue-65774-2.stderr b/tests/ui/associated-types/issue-65774-2.stderr
index c22302cdc26..ca8a727f0fe 100644
--- a/tests/ui/associated-types/issue-65774-2.stderr
+++ b/tests/ui/associated-types/issue-65774-2.stderr
@@ -18,7 +18,7 @@ LL |         writer.my_write(valref)
    |                         ^^^^^^ the trait `MyDisplay` is not implemented for `T`
    |
    = help: the trait `MyDisplay` is implemented for `&'a mut T`
-   = note: required for the cast from `T` to the object type `dyn MyDisplay`
+   = note: required for the cast from `&mut T` to `&dyn MyDisplay`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/async-await/async-block-control-flow-static-semantics.stderr b/tests/ui/async-await/async-block-control-flow-static-semantics.stderr
index a6dbb071614..bbd5a822d8d 100644
--- a/tests/ui/async-await/async-block-control-flow-static-semantics.stderr
+++ b/tests/ui/async-await/async-block-control-flow-static-semantics.stderr
@@ -35,7 +35,7 @@ error[E0271]: expected `[async block@$DIR/async-block-control-flow-static-semant
 LL |     let _: &dyn Future<Output = ()> = &block;
    |                                       ^^^^^^ expected `()`, found `u8`
    |
-   = note: required for the cast from `[async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 25:6]` to the object type `dyn Future<Output = ()>`
+   = note: required for the cast from `&[async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 25:6]` to `&dyn Future<Output = ()>`
 
 error[E0308]: mismatched types
   --> $DIR/async-block-control-flow-static-semantics.rs:12:43
@@ -51,7 +51,7 @@ error[E0271]: expected `[async block@$DIR/async-block-control-flow-static-semant
 LL |     let _: &dyn Future<Output = ()> = &block;
    |                                       ^^^^^^ expected `()`, found `u8`
    |
-   = note: required for the cast from `[async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 16:6]` to the object type `dyn Future<Output = ()>`
+   = note: required for the cast from `&[async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 16:6]` to `&dyn Future<Output = ()>`
 
 error[E0308]: mismatched types
   --> $DIR/async-block-control-flow-static-semantics.rs:49:44
diff --git a/tests/ui/async-await/issue-86507.drop_tracking.stderr b/tests/ui/async-await/issue-86507.drop_tracking.stderr
index 5c8b7ef1b71..adb7b9bf4bf 100644
--- a/tests/ui/async-await/issue-86507.drop_tracking.stderr
+++ b/tests/ui/async-await/issue-86507.drop_tracking.stderr
@@ -13,7 +13,7 @@ note: captured value is not `Send` because `&` references cannot be sent unless
    |
 LL |                     let x = x;
    |                             ^ has type `&T` which is not `Send`, because `T` is not `Sync`
-   = note: required for the cast from `[async block@$DIR/issue-86507.rs:21:17: 23:18]` to the object type `dyn Future<Output = ()> + Send`
+   = note: required for the cast from `Pin<Box<[async block@$DIR/issue-86507.rs:21:17: 23:18]>>` to `Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>`
 help: consider further restricting this bound
    |
 LL |     fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T)
diff --git a/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr b/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr
index 5c8b7ef1b71..adb7b9bf4bf 100644
--- a/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr
@@ -13,7 +13,7 @@ note: captured value is not `Send` because `&` references cannot be sent unless
    |
 LL |                     let x = x;
    |                             ^ has type `&T` which is not `Send`, because `T` is not `Sync`
-   = note: required for the cast from `[async block@$DIR/issue-86507.rs:21:17: 23:18]` to the object type `dyn Future<Output = ()> + Send`
+   = note: required for the cast from `Pin<Box<[async block@$DIR/issue-86507.rs:21:17: 23:18]>>` to `Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>`
 help: consider further restricting this bound
    |
 LL |     fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T)
diff --git a/tests/ui/async-await/issue-86507.no_drop_tracking.stderr b/tests/ui/async-await/issue-86507.no_drop_tracking.stderr
index 5c8b7ef1b71..adb7b9bf4bf 100644
--- a/tests/ui/async-await/issue-86507.no_drop_tracking.stderr
+++ b/tests/ui/async-await/issue-86507.no_drop_tracking.stderr
@@ -13,7 +13,7 @@ note: captured value is not `Send` because `&` references cannot be sent unless
    |
 LL |                     let x = x;
    |                             ^ has type `&T` which is not `Send`, because `T` is not `Sync`
-   = note: required for the cast from `[async block@$DIR/issue-86507.rs:21:17: 23:18]` to the object type `dyn Future<Output = ()> + Send`
+   = note: required for the cast from `Pin<Box<[async block@$DIR/issue-86507.rs:21:17: 23:18]>>` to `Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>`
 help: consider further restricting this bound
    |
 LL |     fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T)
diff --git a/tests/ui/async-await/multiple-lifetimes/partial-relation.rs b/tests/ui/async-await/multiple-lifetimes/partial-relation.rs
index 02b105999f5..7375cb6d3a0 100644
--- a/tests/ui/async-await/multiple-lifetimes/partial-relation.rs
+++ b/tests/ui/async-await/multiple-lifetimes/partial-relation.rs
@@ -4,7 +4,7 @@
 async fn lotsa_lifetimes<'a, 'b, 'c>(a: &'a u32, b: &'b u32, c: &'c u32) -> (&'a u32, &'b u32)
     where 'b: 'a
 {
-    drop((a, c));
+    let _ = (a, c);
     (b, b)
 }
 
diff --git a/tests/ui/borrowck/borrowck-closures-slice-patterns-ok.rs b/tests/ui/borrowck/borrowck-closures-slice-patterns-ok.rs
index 0229ca37a69..9163c8ed6fb 100644
--- a/tests/ui/borrowck/borrowck-closures-slice-patterns-ok.rs
+++ b/tests/ui/borrowck/borrowck-closures-slice-patterns-ok.rs
@@ -1,6 +1,7 @@
 // Check that closure captures for slice patterns are inferred correctly
 
 #![allow(unused_variables)]
+#![allow(drop_ref)]
 
 // run-pass
 
diff --git a/tests/ui/borrowck/borrowck-field-sensitivity-rpass.rs b/tests/ui/borrowck/borrowck-field-sensitivity-rpass.rs
index dd6708582c1..a88b323e0bf 100644
--- a/tests/ui/borrowck/borrowck-field-sensitivity-rpass.rs
+++ b/tests/ui/borrowck/borrowck-field-sensitivity-rpass.rs
@@ -1,6 +1,7 @@
 // run-pass
 #![allow(unused_mut)]
 #![allow(unused_variables)]
+#![allow(drop_copy)]
 // pretty-expanded FIXME #23616
 
 struct A { a: isize, b: Box<isize> }
diff --git a/tests/ui/borrowck/borrowck-use-mut-borrow-rpass.rs b/tests/ui/borrowck/borrowck-use-mut-borrow-rpass.rs
index 1cf763f66fd..40c6bfeeb43 100644
--- a/tests/ui/borrowck/borrowck-use-mut-borrow-rpass.rs
+++ b/tests/ui/borrowck/borrowck-use-mut-borrow-rpass.rs
@@ -1,6 +1,8 @@
 // run-pass
 // pretty-expanded FIXME #23616
 
+#![allow(drop_copy)]
+
 struct A { a: isize, b: Box<isize> }
 
 fn field_copy_after_field_borrow() {
diff --git a/tests/ui/closure_context/issue-26046-fn-mut.stderr b/tests/ui/closure_context/issue-26046-fn-mut.stderr
index f744b71c284..e468f6be791 100644
--- a/tests/ui/closure_context/issue-26046-fn-mut.stderr
+++ b/tests/ui/closure_context/issue-26046-fn-mut.stderr
@@ -9,7 +9,7 @@ LL |         num += 1;
 LL |     Box::new(closure)
    |     ----------------- the requirement to implement `Fn` derives from here
    |
-   = note: required for the cast from `[closure@$DIR/issue-26046-fn-mut.rs:4:19: 4:21]` to the object type `dyn Fn()`
+   = note: required for the cast from `Box<[closure@$DIR/issue-26046-fn-mut.rs:4:19: 4:21]>` to `Box<(dyn Fn() + 'static)>`
 
 error: aborting due to previous error
 
diff --git a/tests/ui/closure_context/issue-26046-fn-once.stderr b/tests/ui/closure_context/issue-26046-fn-once.stderr
index 34f94f9dca6..41f60327ce0 100644
--- a/tests/ui/closure_context/issue-26046-fn-once.stderr
+++ b/tests/ui/closure_context/issue-26046-fn-once.stderr
@@ -9,7 +9,7 @@ LL |         vec
 LL |     Box::new(closure)
    |     ----------------- the requirement to implement `Fn` derives from here
    |
-   = note: required for the cast from `[closure@$DIR/issue-26046-fn-once.rs:4:19: 4:26]` to the object type `dyn Fn() -> Vec<u8>`
+   = note: required for the cast from `Box<[closure@$DIR/issue-26046-fn-once.rs:4:19: 4:26]>` to `Box<(dyn Fn() -> Vec<u8> + 'static)>`
 
 error: aborting due to previous error
 
diff --git a/tests/ui/closures/2229_closure_analysis/migrations/issue-78720.rs b/tests/ui/closures/2229_closure_analysis/migrations/issue-78720.rs
index ff5d284614b..bc7295a0826 100644
--- a/tests/ui/closures/2229_closure_analysis/migrations/issue-78720.rs
+++ b/tests/ui/closures/2229_closure_analysis/migrations/issue-78720.rs
@@ -1,6 +1,7 @@
 // run-pass
 
 #![warn(rust_2021_incompatible_closure_captures)]
+#![allow(drop_ref, drop_copy)]
 
 fn main() {
     if let a = "" {
diff --git a/tests/ui/closures/2229_closure_analysis/migrations/issue-78720.stderr b/tests/ui/closures/2229_closure_analysis/migrations/issue-78720.stderr
index 36a80e694e8..2609e2951ec 100644
--- a/tests/ui/closures/2229_closure_analysis/migrations/issue-78720.stderr
+++ b/tests/ui/closures/2229_closure_analysis/migrations/issue-78720.stderr
@@ -1,5 +1,5 @@
 warning: irrefutable `if let` pattern
-  --> $DIR/issue-78720.rs:6:8
+  --> $DIR/issue-78720.rs:7:8
    |
 LL |     if let a = "" {
    |        ^^^^^^^^^^
diff --git a/tests/ui/closures/2229_closure_analysis/optimization/edge_case_run_pass.rs b/tests/ui/closures/2229_closure_analysis/optimization/edge_case_run_pass.rs
index 033fd6f1775..0f15f664e75 100644
--- a/tests/ui/closures/2229_closure_analysis/optimization/edge_case_run_pass.rs
+++ b/tests/ui/closures/2229_closure_analysis/optimization/edge_case_run_pass.rs
@@ -3,6 +3,7 @@
 
 #![allow(unused)]
 #![allow(dead_code)]
+#![allow(drop_ref)]
 
 struct Int(i32);
 struct B<'a>(&'a i32);
diff --git a/tests/ui/closures/2229_closure_analysis/run_pass/drop_then_use_fake_reads.rs b/tests/ui/closures/2229_closure_analysis/run_pass/drop_then_use_fake_reads.rs
index 477fdd613f5..a097424a021 100644
--- a/tests/ui/closures/2229_closure_analysis/run_pass/drop_then_use_fake_reads.rs
+++ b/tests/ui/closures/2229_closure_analysis/run_pass/drop_then_use_fake_reads.rs
@@ -1,6 +1,8 @@
 // edition:2021
 // check-pass
+
 #![feature(rustc_attrs)]
+#![allow(drop_ref)]
 
 fn main() {
     let mut x = 1;
diff --git a/tests/ui/coercion/coerce-issue-49593-box-never-windows.nofallback.stderr b/tests/ui/coercion/coerce-issue-49593-box-never-windows.nofallback.stderr
index 980da536034..b976f70acf7 100644
--- a/tests/ui/coercion/coerce-issue-49593-box-never-windows.nofallback.stderr
+++ b/tests/ui/coercion/coerce-issue-49593-box-never-windows.nofallback.stderr
@@ -4,7 +4,7 @@ error[E0277]: the trait bound `(): std::error::Error` is not satisfied
 LL |     /* *mut $0 is coerced to Box<dyn Error> here */ Box::<_ /* ! */>::new(x)
    |                                                     ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()`
    |
-   = note: required for the cast from `()` to the object type `dyn std::error::Error`
+   = note: required for the cast from `Box<()>` to `Box<(dyn std::error::Error + 'static)>`
 
 error[E0277]: the trait bound `(): std::error::Error` is not satisfied
   --> $DIR/coerce-issue-49593-box-never-windows.rs:23:49
@@ -12,7 +12,7 @@ error[E0277]: the trait bound `(): std::error::Error` is not satisfied
 LL |     /* *mut $0 is coerced to *mut Error here */ raw_ptr_box::<_ /* ! */>(x)
    |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()`
    |
-   = note: required for the cast from `()` to the object type `(dyn std::error::Error + 'static)`
+   = note: required for the cast from `*mut ()` to `*mut (dyn std::error::Error + 'static)`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/coercion/coerce-issue-49593-box-never.nofallback.stderr b/tests/ui/coercion/coerce-issue-49593-box-never.nofallback.stderr
index 322681b97bc..0d98fa93e5a 100644
--- a/tests/ui/coercion/coerce-issue-49593-box-never.nofallback.stderr
+++ b/tests/ui/coercion/coerce-issue-49593-box-never.nofallback.stderr
@@ -4,7 +4,7 @@ error[E0277]: the trait bound `(): std::error::Error` is not satisfied
 LL |     /* *mut $0 is coerced to Box<dyn Error> here */ Box::<_ /* ! */>::new(x)
    |                                                     ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()`
    |
-   = note: required for the cast from `()` to the object type `dyn std::error::Error`
+   = note: required for the cast from `Box<()>` to `Box<(dyn std::error::Error + 'static)>`
 
 error[E0277]: the trait bound `(): std::error::Error` is not satisfied
   --> $DIR/coerce-issue-49593-box-never.rs:23:49
@@ -12,7 +12,7 @@ error[E0277]: the trait bound `(): std::error::Error` is not satisfied
 LL |     /* *mut $0 is coerced to *mut Error here */ raw_ptr_box::<_ /* ! */>(x)
    |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()`
    |
-   = note: required for the cast from `()` to the object type `(dyn std::error::Error + 'static)`
+   = note: required for the cast from `*mut ()` to `*mut (dyn std::error::Error + 'static)`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/const-generics/defaults/trait_objects_fail.stderr b/tests/ui/const-generics/defaults/trait_objects_fail.stderr
index 0e8334d0338..481d77728b9 100644
--- a/tests/ui/const-generics/defaults/trait_objects_fail.stderr
+++ b/tests/ui/const-generics/defaults/trait_objects_fail.stderr
@@ -5,7 +5,7 @@ LL |     foo(&10_u32);
    |         ^^^^^^^ the trait `Trait` is not implemented for `u32`
    |
    = help: the trait `Trait<2>` is implemented for `u32`
-   = note: required for the cast from `u32` to the object type `dyn Trait`
+   = note: required for the cast from `&u32` to `&dyn Trait`
 
 error[E0277]: the trait bound `bool: Traitor<_>` is not satisfied
   --> $DIR/trait_objects_fail.rs:28:9
@@ -14,7 +14,7 @@ LL |     bar(&true);
    |         ^^^^^ the trait `Traitor<_>` is not implemented for `bool`
    |
    = help: the trait `Traitor<2, 3>` is implemented for `bool`
-   = note: required for the cast from `bool` to the object type `dyn Traitor<_>`
+   = note: required for the cast from `&bool` to `&dyn Traitor<_>`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/consts/const_forget.rs b/tests/ui/consts/const_forget.rs
index ec7dde8c9ec..acdd6a54cf4 100644
--- a/tests/ui/consts/const_forget.rs
+++ b/tests/ui/consts/const_forget.rs
@@ -1,5 +1,7 @@
 // check-pass
 
+#![allow(forget_copy)]
+
 use std::mem::forget;
 
 const _: () = forget(0i32);
diff --git a/tests/ui/consts/issue-104155.rs b/tests/ui/consts/issue-104155.rs
index 1cc8f81b0d2..b3821f467b6 100644
--- a/tests/ui/consts/issue-104155.rs
+++ b/tests/ui/consts/issue-104155.rs
@@ -1,4 +1,7 @@
 // check-pass
+
+#![allow(forget_copy)]
+
 const _: () = core::mem::forget(Box::<u32>::default);
 const _: () = core::mem::forget(|| Box::<u32>::default());
 
diff --git a/tests/ui/crate-leading-sep.rs b/tests/ui/crate-leading-sep.rs
index ca5905fab41..8d1d0b4fcdf 100644
--- a/tests/ui/crate-leading-sep.rs
+++ b/tests/ui/crate-leading-sep.rs
@@ -1,6 +1,8 @@
 // run-pass
 // pretty-expanded FIXME #23616
 
+#![allow(drop_copy)]
+
 fn main() {
     use ::std::mem;
     mem::drop(2_usize);
diff --git a/tests/ui/custom_test_frameworks/mismatch.stderr b/tests/ui/custom_test_frameworks/mismatch.stderr
index 61061ae529d..31b18b2df98 100644
--- a/tests/ui/custom_test_frameworks/mismatch.stderr
+++ b/tests/ui/custom_test_frameworks/mismatch.stderr
@@ -6,7 +6,7 @@ LL | #[test]
 LL | fn wrong_kind(){}
    | ^^^^^^^^^^^^^^^^^ the trait `Testable` is not implemented for `TestDescAndFn`
    |
-   = note: required for the cast from `TestDescAndFn` to the object type `dyn Testable`
+   = note: required for the cast from `&TestDescAndFn` to `&dyn Testable`
    = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
diff --git a/tests/ui/diagnostic-width/E0271.stderr b/tests/ui/diagnostic-width/E0271.stderr
index ed7b6651d01..52f415037d3 100644
--- a/tests/ui/diagnostic-width/E0271.stderr
+++ b/tests/ui/diagnostic-width/E0271.stderr
@@ -15,8 +15,8 @@ note: expected this to be `Foo`
    |
 LL |     type Error = E;
    |                  ^
-   = note: required for the cast from `Result<Result<..., ...>, ...>` to the object type `dyn Future<Error = Foo>`
-   = note: the full name for the casted type has been written to '$TEST_BUILD_DIR/diagnostic-width/E0271/E0271.long-type-hash.txt'
+   = note: required for the cast from `Box<Result<..., ...>>` to `Box<(dyn Future<Error = Foo> + 'static)>`
+   = note: the full name for the source type has been written to '$TEST_BUILD_DIR/diagnostic-width/E0271/E0271.long-type-hash.txt'
 
 error: aborting due to previous error
 
diff --git a/tests/ui/drop/dropck-eyepatch-manuallydrop.rs b/tests/ui/drop/dropck-eyepatch-manuallydrop.rs
new file mode 100644
index 00000000000..ff100cd941f
--- /dev/null
+++ b/tests/ui/drop/dropck-eyepatch-manuallydrop.rs
@@ -0,0 +1,22 @@
+// check-pass
+//! This test checks that dropck knows that ManuallyDrop does not drop its field.
+#![feature(dropck_eyepatch)]
+
+use std::mem::ManuallyDrop;
+
+struct S<T>(ManuallyDrop<T>);
+
+unsafe impl<#[may_dangle] T> Drop for S<T> {
+    fn drop(&mut self) {}
+}
+
+struct NonTrivialDrop<'a>(&'a str);
+impl<'a> Drop for NonTrivialDrop<'a> {
+    fn drop(&mut self) {}
+}
+
+fn main() {
+    let s = String::from("string");
+    let _t = S(ManuallyDrop::new(NonTrivialDrop(&s)));
+    drop(s);
+}
diff --git a/tests/ui/drop/repeat-drop.rs b/tests/ui/drop/repeat-drop.rs
index 8fd46ecaf44..659d35db657 100644
--- a/tests/ui/drop/repeat-drop.rs
+++ b/tests/ui/drop/repeat-drop.rs
@@ -1,6 +1,8 @@
 // run-pass
 // needs-unwind
 
+#![allow(drop_ref, drop_copy)]
+
 static mut CHECK: usize = 0;
 
 struct DropChecker(usize);
diff --git a/tests/ui/dst/dst-bad-coerce1.stderr b/tests/ui/dst/dst-bad-coerce1.stderr
index ff77bd4cef8..2c75518c298 100644
--- a/tests/ui/dst/dst-bad-coerce1.stderr
+++ b/tests/ui/dst/dst-bad-coerce1.stderr
@@ -15,7 +15,7 @@ error[E0277]: the trait bound `Foo: Bar` is not satisfied
 LL |     let f3: &Fat<dyn Bar> = f2;
    |                             ^^ the trait `Bar` is not implemented for `Foo`
    |
-   = note: required for the cast from `Foo` to the object type `dyn Bar`
+   = note: required for the cast from `&Fat<Foo>` to `&Fat<dyn Bar>`
 
 error[E0308]: mismatched types
   --> $DIR/dst-bad-coerce1.rs:28:27
@@ -34,7 +34,7 @@ error[E0277]: the trait bound `Foo: Bar` is not satisfied
 LL |     let f3: &(dyn Bar,) = f2;
    |                           ^^ the trait `Bar` is not implemented for `Foo`
    |
-   = note: required for the cast from `Foo` to the object type `dyn Bar`
+   = note: required for the cast from `&(Foo,)` to `&(dyn Bar,)`
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/dst/dst-object-from-unsized-type.stderr b/tests/ui/dst/dst-object-from-unsized-type.stderr
index e24c96ebed6..d5e464aed4b 100644
--- a/tests/ui/dst/dst-object-from-unsized-type.stderr
+++ b/tests/ui/dst/dst-object-from-unsized-type.stderr
@@ -6,7 +6,7 @@ LL | fn test1<T: ?Sized + Foo>(t: &T) {
 LL |     let u: &dyn Foo = t;
    |                       ^ doesn't have a size known at compile-time
    |
-   = note: required for the cast from `T` to the object type `dyn Foo`
+   = note: required for the cast from `&T` to `&dyn Foo`
 help: consider removing the `?Sized` bound to make the type parameter `Sized`
    |
 LL - fn test1<T: ?Sized + Foo>(t: &T) {
@@ -21,7 +21,7 @@ LL | fn test2<T: ?Sized + Foo>(t: &T) {
 LL |     let v: &dyn Foo = t as &dyn Foo;
    |                       ^ doesn't have a size known at compile-time
    |
-   = note: required for the cast from `T` to the object type `dyn Foo`
+   = note: required for the cast from `&T` to `&dyn Foo`
 help: consider removing the `?Sized` bound to make the type parameter `Sized`
    |
 LL - fn test2<T: ?Sized + Foo>(t: &T) {
@@ -35,7 +35,7 @@ LL |     let _: &[&dyn Foo] = &["hi"];
    |                            ^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `Sized` is not implemented for `str`
-   = note: required for the cast from `str` to the object type `dyn Foo`
+   = note: required for the cast from `&'static str` to `&dyn Foo`
 
 error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
   --> $DIR/dst-object-from-unsized-type.rs:23:23
@@ -44,7 +44,7 @@ LL |     let _: &dyn Foo = x as &dyn Foo;
    |                       ^ doesn't have a size known at compile-time
    |
    = help: the trait `Sized` is not implemented for `[u8]`
-   = note: required for the cast from `[u8]` to the object type `dyn Foo`
+   = note: required for the cast from `&[u8]` to `&dyn Foo`
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/enum-discriminant/auxiliary/discr-foreign-dep.rs b/tests/ui/enum-discriminant/auxiliary/discr-foreign-dep.rs
new file mode 100644
index 00000000000..a2cc10a4b22
--- /dev/null
+++ b/tests/ui/enum-discriminant/auxiliary/discr-foreign-dep.rs
@@ -0,0 +1,7 @@
+#[derive(Default)]
+pub enum Foo {
+    A(u32),
+    #[default]
+    B,
+    C(u32),
+}
diff --git a/tests/ui/enum-discriminant/discr-foreign.rs b/tests/ui/enum-discriminant/discr-foreign.rs
new file mode 100644
index 00000000000..e7123b34452
--- /dev/null
+++ b/tests/ui/enum-discriminant/discr-foreign.rs
@@ -0,0 +1,11 @@
+// aux-build:discr-foreign-dep.rs
+// build-pass
+
+extern crate discr_foreign_dep;
+
+fn main() {
+    match Default::default() {
+        discr_foreign_dep::Foo::A(_) => {}
+        _ => {}
+    }
+}
diff --git a/tests/ui/explicit/explicit-call-to-supertrait-dtor.fixed b/tests/ui/explicit/explicit-call-to-supertrait-dtor.fixed
index 47c4c9f67b6..0bc4feed329 100644
--- a/tests/ui/explicit/explicit-call-to-supertrait-dtor.fixed
+++ b/tests/ui/explicit/explicit-call-to-supertrait-dtor.fixed
@@ -1,4 +1,7 @@
 // run-rustfix
+
+#![allow(drop_ref)]
+
 struct Foo {
     x: isize
 }
diff --git a/tests/ui/explicit/explicit-call-to-supertrait-dtor.rs b/tests/ui/explicit/explicit-call-to-supertrait-dtor.rs
index c698de50c75..26ae6698d66 100644
--- a/tests/ui/explicit/explicit-call-to-supertrait-dtor.rs
+++ b/tests/ui/explicit/explicit-call-to-supertrait-dtor.rs
@@ -1,4 +1,7 @@
 // run-rustfix
+
+#![allow(drop_ref)]
+
 struct Foo {
     x: isize
 }
diff --git a/tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr b/tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr
index 7f5106eb57e..c7067117349 100644
--- a/tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr
+++ b/tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr
@@ -1,5 +1,5 @@
 error[E0040]: explicit use of destructor method
-  --> $DIR/explicit-call-to-supertrait-dtor.rs:19:14
+  --> $DIR/explicit-call-to-supertrait-dtor.rs:22:14
    |
 LL |         self.drop();
    |         -----^^^^--
diff --git a/tests/ui/feature-gates/feature-gate-cfg_overflow_checks.rs b/tests/ui/feature-gates/feature-gate-cfg_overflow_checks.rs
new file mode 100644
index 00000000000..cb265aa7f25
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-cfg_overflow_checks.rs
@@ -0,0 +1,6 @@
+#![crate_type = "lib"]
+
+#[cfg(overflow_checks)] //~ ERROR `cfg(overflow_checks)` is experimental
+pub fn cast(v: i64)->u32{
+    todo!()
+}
diff --git a/tests/ui/feature-gates/feature-gate-cfg_overflow_checks.stderr b/tests/ui/feature-gates/feature-gate-cfg_overflow_checks.stderr
new file mode 100644
index 00000000000..79aba7945f6
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-cfg_overflow_checks.stderr
@@ -0,0 +1,12 @@
+error[E0658]: `cfg(overflow_checks)` is experimental and subject to change
+  --> $DIR/feature-gate-cfg_overflow_checks.rs:3:7
+   |
+LL | #[cfg(overflow_checks)]
+   |       ^^^^^^^^^^^^^^^
+   |
+   = note: see issue #111466 <https://github.com/rust-lang/rust/issues/111466> for more information
+   = help: add `#![feature(cfg_overflow_checks)]` to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr
index d81eade8e9b..303700c7ab4 100644
--- a/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr
+++ b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr
@@ -31,14 +31,7 @@ LL | trait Trait {
    |       ----- this trait cannot be made into an object...
 LL |     fn ptr(self: Ptr<Self>);
    |                  ^^^^^^^^^ ...because method `ptr`'s `self` parameter cannot be dispatched on
-note: required for `Ptr<{integer}>` to implement `CoerceUnsized<Ptr<dyn Trait>>`
-  --> $DIR/feature-gate-dispatch-from-dyn-missing-impl.rs:20:40
-   |
-LL | impl<T: Unsize<U> + ?Sized, U: ?Sized> CoerceUnsized<Ptr<U>> for Ptr<T> {}
-   |         ---------                      ^^^^^^^^^^^^^^^^^^^^^     ^^^^^^
-   |         |
-   |         unsatisfied trait bound introduced here
-   = note: required by cast to type `Ptr<dyn Trait>`
+   = note: required for the cast from `Ptr<{integer}>` to `Ptr<dyn Trait>`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs b/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs
index 0680d234403..dce94c9eab2 100644
--- a/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs
+++ b/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs
@@ -13,5 +13,4 @@ fn non_unsafe_pin_new_unchecked<T>(pointer: &mut T) -> Pin<&mut T> {
 fn main() {
     let mut self_referential = PhantomPinned;
     let _: Pin<&mut PhantomPinned> = non_unsafe_pin_new_unchecked(&mut self_referential);
-    core::mem::forget(self_referential); // move and disable drop glue!
 }
diff --git a/tests/ui/generator/drop-env.rs b/tests/ui/generator/drop-env.rs
index 66dfb8c2c09..cb46953dac3 100644
--- a/tests/ui/generator/drop-env.rs
+++ b/tests/ui/generator/drop-env.rs
@@ -4,6 +4,7 @@
 //[nomiropt]compile-flags: -Z mir-opt-level=0
 
 #![feature(generators, generator_trait)]
+#![allow(drop_copy)]
 
 use std::ops::Generator;
 use std::pin::Pin;
diff --git a/tests/ui/generator/issue-57017.no_drop_tracking.stderr b/tests/ui/generator/issue-57017.no_drop_tracking.stderr
index 06d2d23b9ef..f7b8e198cc4 100644
--- a/tests/ui/generator/issue-57017.no_drop_tracking.stderr
+++ b/tests/ui/generator/issue-57017.no_drop_tracking.stderr
@@ -1,5 +1,5 @@
 error: generator cannot be sent between threads safely
-  --> $DIR/issue-57017.rs:31:25
+  --> $DIR/issue-57017.rs:32:25
    |
 LL |               assert_send(g);
    |                           ^ generator is not `Send`
@@ -15,7 +15,7 @@ LL | |     );
    |
    = help: the trait `Sync` is not implemented for `copy::unsync::Client`
 note: generator is not `Send` as this value is used across a yield
-  --> $DIR/issue-57017.rs:29:28
+  --> $DIR/issue-57017.rs:30:28
    |
 LL |               let g = move || match drop(&$name::unsync::Client::default()) {
    |                                          --------------------------------- has type `&copy::unsync::Client` which is not `Send`
@@ -33,14 +33,14 @@ LL | |         }
 LL | |     );
    | |_____- in this macro invocation
 note: required by a bound in `assert_send`
-  --> $DIR/issue-57017.rs:51:19
+  --> $DIR/issue-57017.rs:52:19
    |
 LL | fn assert_send<T: Send>(_thing: T) {}
    |                   ^^^^ required by this bound in `assert_send`
    = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: generator cannot be sent between threads safely
-  --> $DIR/issue-57017.rs:43:25
+  --> $DIR/issue-57017.rs:44:25
    |
 LL |               assert_send(g);
    |                           ^ generator is not `Send`
@@ -54,9 +54,9 @@ LL | |         }
 LL | |     );
    | |_____- in this macro invocation
    |
-   = help: within `[generator@$DIR/issue-57017.rs:40:21: 40:28]`, the trait `Send` is not implemented for `copy::unsend::Client`
+   = help: within `[generator@$DIR/issue-57017.rs:41:21: 41:28]`, the trait `Send` is not implemented for `copy::unsend::Client`
 note: generator is not `Send` as this value is used across a yield
-  --> $DIR/issue-57017.rs:41:28
+  --> $DIR/issue-57017.rs:42:28
    |
 LL |               let g = move || match drop($name::unsend::Client::default()) {
    |                                          -------------------------------- has type `copy::unsend::Client` which is not `Send`
@@ -74,14 +74,14 @@ LL | |         }
 LL | |     );
    | |_____- in this macro invocation
 note: required by a bound in `assert_send`
-  --> $DIR/issue-57017.rs:51:19
+  --> $DIR/issue-57017.rs:52:19
    |
 LL | fn assert_send<T: Send>(_thing: T) {}
    |                   ^^^^ required by this bound in `assert_send`
    = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: generator cannot be sent between threads safely
-  --> $DIR/issue-57017.rs:31:25
+  --> $DIR/issue-57017.rs:32:25
    |
 LL |               assert_send(g);
    |                           ^ generator is not `Send`
@@ -97,7 +97,7 @@ LL | |     );
    |
    = help: the trait `Sync` is not implemented for `derived_drop::unsync::Client`
 note: generator is not `Send` as this value is used across a yield
-  --> $DIR/issue-57017.rs:29:28
+  --> $DIR/issue-57017.rs:30:28
    |
 LL |               let g = move || match drop(&$name::unsync::Client::default()) {
    |                                          --------------------------------- has type `&derived_drop::unsync::Client` which is not `Send`
@@ -115,14 +115,14 @@ LL | |         }
 LL | |     );
    | |_____- in this macro invocation
 note: required by a bound in `assert_send`
-  --> $DIR/issue-57017.rs:51:19
+  --> $DIR/issue-57017.rs:52:19
    |
 LL | fn assert_send<T: Send>(_thing: T) {}
    |                   ^^^^ required by this bound in `assert_send`
    = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: generator cannot be sent between threads safely
-  --> $DIR/issue-57017.rs:43:25
+  --> $DIR/issue-57017.rs:44:25
    |
 LL |               assert_send(g);
    |                           ^ generator is not `Send`
@@ -136,9 +136,9 @@ LL | |         }
 LL | |     );
    | |_____- in this macro invocation
    |
-   = help: within `[generator@$DIR/issue-57017.rs:40:21: 40:28]`, the trait `Send` is not implemented for `derived_drop::unsend::Client`
+   = help: within `[generator@$DIR/issue-57017.rs:41:21: 41:28]`, the trait `Send` is not implemented for `derived_drop::unsend::Client`
 note: generator is not `Send` as this value is used across a yield
-  --> $DIR/issue-57017.rs:41:28
+  --> $DIR/issue-57017.rs:42:28
    |
 LL |               let g = move || match drop($name::unsend::Client::default()) {
    |                                          -------------------------------- has type `derived_drop::unsend::Client` which is not `Send`
@@ -156,14 +156,14 @@ LL | |         }
 LL | |     );
    | |_____- in this macro invocation
 note: required by a bound in `assert_send`
-  --> $DIR/issue-57017.rs:51:19
+  --> $DIR/issue-57017.rs:52:19
    |
 LL | fn assert_send<T: Send>(_thing: T) {}
    |                   ^^^^ required by this bound in `assert_send`
    = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: generator cannot be sent between threads safely
-  --> $DIR/issue-57017.rs:31:25
+  --> $DIR/issue-57017.rs:32:25
    |
 LL |               assert_send(g);
    |                           ^ generator is not `Send`
@@ -179,7 +179,7 @@ LL | |     );
    |
    = help: the trait `Sync` is not implemented for `significant_drop::unsync::Client`
 note: generator is not `Send` as this value is used across a yield
-  --> $DIR/issue-57017.rs:29:28
+  --> $DIR/issue-57017.rs:30:28
    |
 LL |               let g = move || match drop(&$name::unsync::Client::default()) {
    |                                          --------------------------------- has type `&significant_drop::unsync::Client` which is not `Send`
@@ -197,14 +197,14 @@ LL | |         }
 LL | |     );
    | |_____- in this macro invocation
 note: required by a bound in `assert_send`
-  --> $DIR/issue-57017.rs:51:19
+  --> $DIR/issue-57017.rs:52:19
    |
 LL | fn assert_send<T: Send>(_thing: T) {}
    |                   ^^^^ required by this bound in `assert_send`
    = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: generator cannot be sent between threads safely
-  --> $DIR/issue-57017.rs:43:25
+  --> $DIR/issue-57017.rs:44:25
    |
 LL |               assert_send(g);
    |                           ^ generator is not `Send`
@@ -218,9 +218,9 @@ LL | |         }
 LL | |     );
    | |_____- in this macro invocation
    |
-   = help: within `[generator@$DIR/issue-57017.rs:40:21: 40:28]`, the trait `Send` is not implemented for `significant_drop::unsend::Client`
+   = help: within `[generator@$DIR/issue-57017.rs:41:21: 41:28]`, the trait `Send` is not implemented for `significant_drop::unsend::Client`
 note: generator is not `Send` as this value is used across a yield
-  --> $DIR/issue-57017.rs:41:28
+  --> $DIR/issue-57017.rs:42:28
    |
 LL |               let g = move || match drop($name::unsend::Client::default()) {
    |                                          -------------------------------- has type `significant_drop::unsend::Client` which is not `Send`
@@ -238,7 +238,7 @@ LL | |         }
 LL | |     );
    | |_____- in this macro invocation
 note: required by a bound in `assert_send`
-  --> $DIR/issue-57017.rs:51:19
+  --> $DIR/issue-57017.rs:52:19
    |
 LL | fn assert_send<T: Send>(_thing: T) {}
    |                   ^^^^ required by this bound in `assert_send`
diff --git a/tests/ui/generator/issue-57017.rs b/tests/ui/generator/issue-57017.rs
index 03b00ac99ad..918d233bf4e 100644
--- a/tests/ui/generator/issue-57017.rs
+++ b/tests/ui/generator/issue-57017.rs
@@ -5,6 +5,7 @@
 // [drop_tracking_mir] build-pass
 
 #![feature(generators, negative_impls)]
+#![allow(drop_ref, drop_copy)]
 
 macro_rules! type_combinations {
     (
diff --git a/tests/ui/generator/non-static-is-unpin.rs b/tests/ui/generator/non-static-is-unpin.rs
index 17e23f5bcd2..adba800e25a 100644
--- a/tests/ui/generator/non-static-is-unpin.rs
+++ b/tests/ui/generator/non-static-is-unpin.rs
@@ -3,6 +3,7 @@
 // run-pass
 
 #![feature(generators, generator_trait)]
+#![allow(drop_copy)]
 
 use std::marker::{PhantomPinned, Unpin};
 
diff --git a/tests/ui/generator/resume-arg-size.rs b/tests/ui/generator/resume-arg-size.rs
index b93dc54f7a9..19618f8d0aa 100644
--- a/tests/ui/generator/resume-arg-size.rs
+++ b/tests/ui/generator/resume-arg-size.rs
@@ -1,4 +1,5 @@
 #![feature(generators)]
+#![allow(drop_copy)]
 
 // run-pass
 
diff --git a/tests/ui/generic-associated-types/issue-76535.base.stderr b/tests/ui/generic-associated-types/issue-76535.base.stderr
index 52c6e3eec60..370329b9f83 100644
--- a/tests/ui/generic-associated-types/issue-76535.base.stderr
+++ b/tests/ui/generic-associated-types/issue-76535.base.stderr
@@ -43,8 +43,7 @@ LL | pub trait SuperTrait {
 LL |     type SubType<'a>: SubTrait where Self: 'a;
    |          ^^^^^^^ ...because it contains the generic associated type `SubType`
    = help: consider moving `SubType` to another trait
-   = note: required for `Box<SuperStruct>` to implement `CoerceUnsized<Box<dyn SuperTrait<SubType = SubStruct<'_>>>>`
-   = note: required by cast to type `Box<dyn SuperTrait<SubType = SubStruct<'_>>>`
+   = note: required for the cast from `Box<SuperStruct>` to `Box<dyn SuperTrait<SubType = SubStruct<'_>>>`
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/generic-associated-types/issue-79422.base.stderr b/tests/ui/generic-associated-types/issue-79422.base.stderr
index f1de77bc3c0..ad704f5e9f0 100644
--- a/tests/ui/generic-associated-types/issue-79422.base.stderr
+++ b/tests/ui/generic-associated-types/issue-79422.base.stderr
@@ -43,8 +43,7 @@ LL | trait MapLike<K, V> {
 LL |     type VRefCont<'a>: RefCont<'a, V> where Self: 'a;
    |          ^^^^^^^^ ...because it contains the generic associated type `VRefCont`
    = help: consider moving `VRefCont` to another trait
-   = note: required for `Box<BTreeMap<u8, u8>>` to implement `CoerceUnsized<Box<dyn MapLike<u8, u8, VRefCont = (dyn RefCont<'_, u8> + 'static)>>>`
-   = note: required by cast to type `Box<dyn MapLike<u8, u8, VRefCont = (dyn RefCont<'_, u8> + 'static)>>`
+   = note: required for the cast from `Box<BTreeMap<u8, u8>>` to `Box<dyn MapLike<u8, u8, VRefCont = (dyn RefCont<'_, u8> + 'static)>>`
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/generic-associated-types/issue-79422.extended.stderr b/tests/ui/generic-associated-types/issue-79422.extended.stderr
index 04184fce921..14492266cda 100644
--- a/tests/ui/generic-associated-types/issue-79422.extended.stderr
+++ b/tests/ui/generic-associated-types/issue-79422.extended.stderr
@@ -27,7 +27,7 @@ LL |     type VRefCont<'a> = &'a V where Self: 'a;
    |                         ^^^^^
    = note: expected trait object `(dyn RefCont<'_, u8> + 'static)`
                  found reference `&u8`
-   = note: required for the cast from `BTreeMap<u8, u8>` to the object type `dyn MapLike<u8, u8, VRefCont = (dyn RefCont<'_, u8> + 'static)>`
+   = note: required for the cast from `Box<BTreeMap<u8, u8>>` to `Box<dyn MapLike<u8, u8, VRefCont = (dyn RefCont<'_, u8> + 'static)>>`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/generic-associated-types/issue-88595.rs b/tests/ui/generic-associated-types/issue-88595.rs
index 5a40a612972..7de906e7ef3 100644
--- a/tests/ui/generic-associated-types/issue-88595.rs
+++ b/tests/ui/generic-associated-types/issue-88595.rs
@@ -19,4 +19,5 @@ impl<'a> A<'a> for C {
     type B<'b> = impl Clone;
 
     fn a(&'a self) -> Self::B<'a> {} //~ ERROR: non-defining opaque type use in defining scope
+    //~^ ERROR: mismatched types
 }
diff --git a/tests/ui/generic-associated-types/issue-88595.stderr b/tests/ui/generic-associated-types/issue-88595.stderr
index 79d3479af8c..d6caed85459 100644
--- a/tests/ui/generic-associated-types/issue-88595.stderr
+++ b/tests/ui/generic-associated-types/issue-88595.stderr
@@ -1,16 +1,34 @@
 error: non-defining opaque type use in defining scope
-  --> $DIR/issue-88595.rs:21:35
+  --> $DIR/issue-88595.rs:21:5
    |
 LL |     fn a(&'a self) -> Self::B<'a> {}
-   |                                   ^^
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ generic argument `'a` used twice
    |
-note: lifetime used multiple times
-  --> $DIR/issue-88595.rs:18:6
+note: for this opaque type
+  --> $DIR/issue-88595.rs:19:18
    |
-LL | impl<'a> A<'a> for C {
-   |      ^^
 LL |     type B<'b> = impl Clone;
-   |            ^^
+   |                  ^^^^^^^^^^
 
-error: aborting due to previous error
+error[E0308]: mismatched types
+  --> $DIR/issue-88595.rs:21:23
+   |
+LL |     type B<'b> = impl Clone;
+   |                  ---------- the expected opaque type
+LL |
+LL |     fn a(&'a self) -> Self::B<'a> {}
+   |        -              ^^^^^^^^^^^ expected opaque type, found `()`
+   |        |
+   |        implicitly returns `()` as its body has no tail or `return` expression
+   |
+   = note: expected opaque type `<C as A<'a>>::B<'a>`
+                found unit type `()`
+note: this item must have the opaque type in its signature in order to be able to register hidden types
+  --> $DIR/issue-88595.rs:21:5
+   |
+LL |     fn a(&'a self) -> Self::B<'a> {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
 
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/hygiene/stdlib-prelude-from-opaque-late.rs b/tests/ui/hygiene/stdlib-prelude-from-opaque-late.rs
index cf65de2bc23..214267372bf 100644
--- a/tests/ui/hygiene/stdlib-prelude-from-opaque-late.rs
+++ b/tests/ui/hygiene/stdlib-prelude-from-opaque-late.rs
@@ -1,6 +1,7 @@
 // check-pass
 
 #![feature(decl_macro)]
+#![allow(drop_copy)]
 
 macro mac() {
     mod m {
diff --git a/tests/ui/illegal-ufcs-drop.fixed b/tests/ui/illegal-ufcs-drop.fixed
index d73b391be06..8783682dec4 100644
--- a/tests/ui/illegal-ufcs-drop.fixed
+++ b/tests/ui/illegal-ufcs-drop.fixed
@@ -1,4 +1,7 @@
 // run-rustfix
+
+#![allow(drop_ref)]
+
 struct Foo;
 
 impl Drop for Foo {
diff --git a/tests/ui/illegal-ufcs-drop.rs b/tests/ui/illegal-ufcs-drop.rs
index 11411f55494..29774306ec6 100644
--- a/tests/ui/illegal-ufcs-drop.rs
+++ b/tests/ui/illegal-ufcs-drop.rs
@@ -1,4 +1,7 @@
 // run-rustfix
+
+#![allow(drop_ref)]
+
 struct Foo;
 
 impl Drop for Foo {
diff --git a/tests/ui/illegal-ufcs-drop.stderr b/tests/ui/illegal-ufcs-drop.stderr
index 91f47d5e456..7a5c0612c07 100644
--- a/tests/ui/illegal-ufcs-drop.stderr
+++ b/tests/ui/illegal-ufcs-drop.stderr
@@ -1,5 +1,5 @@
 error[E0040]: explicit use of destructor method
-  --> $DIR/illegal-ufcs-drop.rs:9:5
+  --> $DIR/illegal-ufcs-drop.rs:12:5
    |
 LL |     Drop::drop(&mut Foo)
    |     ^^^^^^^^^^
diff --git a/tests/ui/impl-trait/in-assoc-type-unconstrained.rs b/tests/ui/impl-trait/in-assoc-type-unconstrained.rs
new file mode 100644
index 00000000000..c395b4195a0
--- /dev/null
+++ b/tests/ui/impl-trait/in-assoc-type-unconstrained.rs
@@ -0,0 +1,27 @@
+#![feature(impl_trait_in_assoc_type)]
+
+mod compare_ty {
+    trait Trait {
+        type Ty: IntoIterator<Item = ()>;
+    }
+    impl Trait for () {
+        type Ty = Option<impl Sized>;
+        //~^ ERROR: unconstrained opaque type
+        //~| ERROR: type mismatch resolving `<Option<<() as Trait>::Ty::{opaque#0}> as IntoIterator>::Item == ()`
+    }
+}
+
+mod compare_method {
+    trait Trait {
+        type Ty;
+        fn method() -> Self::Ty;
+    }
+    impl Trait for () {
+        type Ty = impl Sized;
+        //~^ ERROR: unconstrained opaque type
+        fn method() -> () {}
+        //~^ ERROR: method `method` has an incompatible type for trait
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr b/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr
new file mode 100644
index 00000000000..1097cd0f452
--- /dev/null
+++ b/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr
@@ -0,0 +1,59 @@
+error[E0271]: type mismatch resolving `<Option<<() as Trait>::Ty::{opaque#0}> as IntoIterator>::Item == ()`
+  --> $DIR/in-assoc-type-unconstrained.rs:8:19
+   |
+LL |         type Ty = Option<impl Sized>;
+   |                   ^^^^^^^^^^^^^^^^^^ expected `()`, found opaque type
+   |
+   = note: expected unit type `()`
+            found opaque type `<() as compare_ty::Trait>::Ty::{opaque#0}`
+note: required by a bound in `compare_ty::Trait::Ty`
+  --> $DIR/in-assoc-type-unconstrained.rs:5:31
+   |
+LL |         type Ty: IntoIterator<Item = ()>;
+   |                               ^^^^^^^^^ required by this bound in `Trait::Ty`
+
+error: unconstrained opaque type
+  --> $DIR/in-assoc-type-unconstrained.rs:8:26
+   |
+LL |         type Ty = Option<impl Sized>;
+   |                          ^^^^^^^^^^
+   |
+   = note: `Ty` must be used in combination with a concrete type within the same impl
+
+error[E0053]: method `method` has an incompatible type for trait
+  --> $DIR/in-assoc-type-unconstrained.rs:22:24
+   |
+LL |         type Ty = impl Sized;
+   |                   ---------- the expected opaque type
+LL |
+LL |         fn method() -> () {}
+   |                        ^^
+   |                        |
+   |                        expected opaque type, found `()`
+   |                        help: change the output type to match the trait: `<() as compare_method::Trait>::Ty`
+   |
+note: type in trait
+  --> $DIR/in-assoc-type-unconstrained.rs:17:24
+   |
+LL |         fn method() -> Self::Ty;
+   |                        ^^^^^^^^
+   = note: expected signature `fn() -> <() as compare_method::Trait>::Ty`
+              found signature `fn()`
+note: this item must have the opaque type in its signature in order to be able to register hidden types
+  --> $DIR/in-assoc-type-unconstrained.rs:22:9
+   |
+LL |         fn method() -> () {}
+   |         ^^^^^^^^^^^^^^^^^
+
+error: unconstrained opaque type
+  --> $DIR/in-assoc-type-unconstrained.rs:20:19
+   |
+LL |         type Ty = impl Sized;
+   |                   ^^^^^^^^^^
+   |
+   = note: `Ty` must be used in combination with a concrete type within the same impl
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0053, E0271.
+For more information about an error, try `rustc --explain E0053`.
diff --git a/tests/ui/impl-trait/in-assoc-type.rs b/tests/ui/impl-trait/in-assoc-type.rs
new file mode 100644
index 00000000000..36c54bdd6de
--- /dev/null
+++ b/tests/ui/impl-trait/in-assoc-type.rs
@@ -0,0 +1,21 @@
+#![feature(impl_trait_in_assoc_type)]
+
+trait Foo<T> {
+    type Bar;
+    fn foo(&self) -> <Self as Foo<()>>::Bar
+    where
+        Self: Foo<()>;
+}
+
+impl Foo<()> for () {
+    type Bar = impl std::fmt::Debug;
+    fn foo(&self) -> Self::Bar {}
+}
+
+impl Foo<i32> for () {
+    type Bar = u32;
+    fn foo(&self) -> <Self as Foo<()>>::Bar {}
+    //~^ ERROR: mismatched types
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-assoc-type.stderr b/tests/ui/impl-trait/in-assoc-type.stderr
new file mode 100644
index 00000000000..f0a272dc2d5
--- /dev/null
+++ b/tests/ui/impl-trait/in-assoc-type.stderr
@@ -0,0 +1,22 @@
+error[E0308]: mismatched types
+  --> $DIR/in-assoc-type.rs:17:22
+   |
+LL |     type Bar = impl std::fmt::Debug;
+   |                -------------------- the expected opaque type
+...
+LL |     fn foo(&self) -> <Self as Foo<()>>::Bar {}
+   |        ---           ^^^^^^^^^^^^^^^^^^^^^^ expected opaque type, found `()`
+   |        |
+   |        implicitly returns `()` as its body has no tail or `return` expression
+   |
+   = note: expected opaque type `<() as Foo<()>>::Bar`
+                found unit type `()`
+note: this item must have the opaque type in its signature in order to be able to register hidden types
+  --> $DIR/in-assoc-type.rs:17:5
+   |
+LL |     fn foo(&self) -> <Self as Foo<()>>::Bar {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/impl-trait/in-trait/object-safety.current.stderr b/tests/ui/impl-trait/in-trait/object-safety.current.stderr
index b7f2b019a77..2c340a02319 100644
--- a/tests/ui/impl-trait/in-trait/object-safety.current.stderr
+++ b/tests/ui/impl-trait/in-trait/object-safety.current.stderr
@@ -42,8 +42,7 @@ LL | trait Foo {
 LL |     fn baz(&self) -> impl Debug;
    |                      ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type
    = help: consider moving `baz` to another trait
-   = note: required for `Box<u32>` to implement `CoerceUnsized<Box<dyn Foo>>`
-   = note: required by cast to type `Box<dyn Foo>`
+   = note: required for the cast from `Box<u32>` to `Box<dyn Foo>`
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/impl-trait/in-trait/object-safety.next.stderr b/tests/ui/impl-trait/in-trait/object-safety.next.stderr
index b7f2b019a77..2c340a02319 100644
--- a/tests/ui/impl-trait/in-trait/object-safety.next.stderr
+++ b/tests/ui/impl-trait/in-trait/object-safety.next.stderr
@@ -42,8 +42,7 @@ LL | trait Foo {
 LL |     fn baz(&self) -> impl Debug;
    |                      ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type
    = help: consider moving `baz` to another trait
-   = note: required for `Box<u32>` to implement `CoerceUnsized<Box<dyn Foo>>`
-   = note: required by cast to type `Box<dyn Foo>`
+   = note: required for the cast from `Box<u32>` to `Box<dyn Foo>`
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr
index f7aff419544..fe62a8f3288 100644
--- a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr
+++ b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr
@@ -43,6 +43,11 @@ LL |         fn eq(&self, _other: &(Bar, i32)) -> bool {
    |
    = note: expected signature `fn(&b::Bar, &(b::Foo, i32)) -> _`
               found signature `fn(&b::Bar, &(b::Bar, i32)) -> _`
+note: this item must have the opaque type in its signature in order to be able to register hidden types
+  --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:24:9
+   |
+LL |         fn eq(&self, _other: &(Bar, i32)) -> bool {
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/issues/issue-14366.stderr b/tests/ui/issues/issue-14366.stderr
index 10a73b245ac..df61aabf00a 100644
--- a/tests/ui/issues/issue-14366.stderr
+++ b/tests/ui/issues/issue-14366.stderr
@@ -5,8 +5,8 @@ LL |     let _x = "test" as &dyn (::std::any::Any);
    |              ^^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `Sized` is not implemented for `str`
-   = note: required for the cast from `str` to the object type `dyn Any`
-help: consider borrowing the value, since `&str` can be coerced into `dyn Any`
+   = note: required for the cast from `&'static str` to `&(dyn Any + 'static)`
+help: consider borrowing the value, since `&&'static str` can be coerced into `&(dyn Any + 'static)`
    |
 LL |     let _x = &"test" as &dyn (::std::any::Any);
    |              +
diff --git a/tests/ui/issues/issue-22034.stderr b/tests/ui/issues/issue-22034.stderr
index b32de5b24b9..9833e559cbc 100644
--- a/tests/ui/issues/issue-22034.stderr
+++ b/tests/ui/issues/issue-22034.stderr
@@ -6,7 +6,7 @@ LL |         &mut *(ptr as *mut dyn Fn())
    |
    = help: the trait `Fn<()>` is not implemented for `()`
    = note: wrap the `()` in a closure with no arguments: `|| { /* code */ }`
-   = note: required for the cast from `()` to the object type `dyn Fn()`
+   = note: required for the cast from `*mut ()` to `*mut dyn Fn()`
 
 error: aborting due to previous error
 
diff --git a/tests/ui/issues/issue-22872.stderr b/tests/ui/issues/issue-22872.stderr
index 9510197197a..63222d25c01 100644
--- a/tests/ui/issues/issue-22872.stderr
+++ b/tests/ui/issues/issue-22872.stderr
@@ -13,7 +13,7 @@ LL | impl<'b, P> Wrap<'b> for Wrapper<P>
 LL | where P: Process<'b>,
 LL |       <P as Process<'b>>::Item: Iterator {
    |                                 -------- unsatisfied trait bound introduced here
-   = note: required for the cast from `Wrapper<P>` to the object type `dyn for<'b> Wrap<'b>`
+   = note: required for the cast from `Box<Wrapper<P>>` to `Box<dyn for<'b> Wrap<'b>>`
 help: consider further restricting the associated type
    |
 LL | fn push_process<P>(process: P) where P: Process<'static>, <P as Process<'_>>::Item: Iterator {
diff --git a/tests/ui/kindck/kindck-impl-type-params.stderr b/tests/ui/kindck/kindck-impl-type-params.stderr
index efb25bf83e1..53c1940491f 100644
--- a/tests/ui/kindck/kindck-impl-type-params.stderr
+++ b/tests/ui/kindck/kindck-impl-type-params.stderr
@@ -11,7 +11,7 @@ LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
    |         ----                   ^^^^^^^^^^^     ^^^^
    |         |
    |         unsatisfied trait bound introduced here
-   = note: required for the cast from `S<T>` to the object type `dyn Gettable<T>`
+   = note: required for the cast from `&S<T>` to `&dyn Gettable<T>`
 help: consider restricting type parameter `T`
    |
 LL | fn f<T: std::marker::Send>(val: T) {
@@ -30,7 +30,7 @@ LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
    |                ----            ^^^^^^^^^^^     ^^^^
    |                |
    |                unsatisfied trait bound introduced here
-   = note: required for the cast from `S<T>` to the object type `dyn Gettable<T>`
+   = note: required for the cast from `&S<T>` to `&dyn Gettable<T>`
 help: consider restricting type parameter `T`
    |
 LL | fn f<T: std::marker::Copy>(val: T) {
@@ -49,7 +49,7 @@ LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
    |         ----                   ^^^^^^^^^^^     ^^^^
    |         |
    |         unsatisfied trait bound introduced here
-   = note: required for the cast from `S<T>` to the object type `dyn Gettable<T>`
+   = note: required for the cast from `&S<T>` to `&dyn Gettable<T>`
 help: consider restricting type parameter `T`
    |
 LL | fn g<T: std::marker::Send>(val: T) {
@@ -68,7 +68,7 @@ LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
    |                ----            ^^^^^^^^^^^     ^^^^
    |                |
    |                unsatisfied trait bound introduced here
-   = note: required for the cast from `S<T>` to the object type `dyn Gettable<T>`
+   = note: required for the cast from `&S<T>` to `&dyn Gettable<T>`
 help: consider restricting type parameter `T`
    |
 LL | fn g<T: std::marker::Copy>(val: T) {
@@ -88,7 +88,7 @@ LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
    |                ----            ^^^^^^^^^^^     ^^^^
    |                |
    |                unsatisfied trait bound introduced here
-   = note: required for the cast from `S<String>` to the object type `dyn Gettable<String>`
+   = note: required for the cast from `Box<S<String>>` to `Box<dyn Gettable<String>>`
 
 error[E0277]: the trait bound `Foo: Copy` is not satisfied
   --> $DIR/kindck-impl-type-params.rs:43:37
@@ -104,7 +104,7 @@ LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
    |                ----            ^^^^^^^^^^^     ^^^^
    |                |
    |                unsatisfied trait bound introduced here
-   = note: required for the cast from `S<Foo>` to the object type `dyn Gettable<Foo>`
+   = note: required for the cast from `Box<S<Foo>>` to `Box<dyn Gettable<Foo>>`
 help: consider annotating `Foo` with `#[derive(Copy)]`
    |
 LL +     #[derive(Copy)]
diff --git a/tests/ui/kindck/kindck-inherited-copy-bound.curr.stderr b/tests/ui/kindck/kindck-inherited-copy-bound.curr.stderr
index 8d45748a6c4..29495176556 100644
--- a/tests/ui/kindck/kindck-inherited-copy-bound.curr.stderr
+++ b/tests/ui/kindck/kindck-inherited-copy-bound.curr.stderr
@@ -46,8 +46,7 @@ LL | trait Foo : Copy {
    |       ---   ^^^^ ...because it requires `Self: Sized`
    |       |
    |       this trait cannot be made into an object...
-   = note: required for `&Box<{integer}>` to implement `CoerceUnsized<&dyn Foo>`
-   = note: required by cast to type `&dyn Foo`
+   = note: required for the cast from `&Box<{integer}>` to `&dyn Foo`
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr b/tests/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr
index 2fbb5a98a8d..3e164ebf514 100644
--- a/tests/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr
+++ b/tests/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr
@@ -32,8 +32,7 @@ LL | trait Foo : Copy {
    |       ---   ^^^^ ...because it requires `Self: Sized`
    |       |
    |       this trait cannot be made into an object...
-   = note: required for `&Box<i32>` to implement `CoerceUnsized<&dyn Foo>`
-   = note: required by cast to type `&dyn Foo`
+   = note: required for the cast from `&Box<i32>` to `&dyn Foo`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/lint/drop_copy.rs b/tests/ui/lint/drop_copy.rs
new file mode 100644
index 00000000000..0adcd34505f
--- /dev/null
+++ b/tests/ui/lint/drop_copy.rs
@@ -0,0 +1,79 @@
+// check-pass
+
+#![warn(drop_copy)]
+
+use std::mem::drop;
+use std::vec::Vec;
+
+#[derive(Copy, Clone)]
+struct SomeStruct;
+
+struct AnotherStruct {
+    x: u8,
+    y: u8,
+    z: Vec<u8>,
+}
+
+impl Clone for AnotherStruct {
+    fn clone(&self) -> AnotherStruct {
+        AnotherStruct {
+            x: self.x,
+            y: self.y,
+            z: self.z.clone(),
+        }
+    }
+}
+
+fn main() {
+    let s1 = SomeStruct {};
+    let s2 = s1;
+    let s3 = &s1;
+    let mut s4 = s1;
+    let ref s5 = s1;
+
+    drop(s1); //~ WARN calls to `std::mem::drop`
+    drop(s2); //~ WARN calls to `std::mem::drop`
+    drop(s3); //~ WARN calls to `std::mem::drop`
+    drop(s4); //~ WARN calls to `std::mem::drop`
+    drop(s5); //~ WARN calls to `std::mem::drop`
+
+    let a1 = AnotherStruct {
+        x: 255,
+        y: 0,
+        z: vec![1, 2, 3],
+    };
+    let a2 = &a1;
+    let mut a3 = a1.clone();
+    let ref a4 = a1;
+    let a5 = a1.clone();
+
+    drop(a2); //~ WARN calls to `std::mem::drop`
+    drop(a3);
+    drop(a4); //~ WARN calls to `std::mem::drop`
+    drop(a5);
+}
+
+#[allow(unused)]
+#[allow(clippy::unit_cmp)]
+fn issue9482(x: u8) {
+    fn println_and<T>(t: T) -> T {
+        println!("foo");
+        t
+    }
+
+    match x {
+        // Don't lint (copy type), we only care about side-effects
+        0 => drop(println_and(12)),
+        // Don't lint (no copy type), we only care about side-effects
+        1 => drop(println_and(String::new())),
+        2 => {
+            // Lint, even if we only care about the side-effect, it's already in a block
+            drop(println_and(13)); //~ WARN calls to `std::mem::drop`
+        },
+         // Lint, idiomatic use is only in body of `Arm`
+        3 if drop(println_and(14)) == () => (), //~ WARN calls to `std::mem::drop`
+        // Lint, not a fn/method call
+        4 => drop(2),//~ WARN calls to `std::mem::drop`
+        _ => (),
+    }
+}
diff --git a/tests/ui/lint/drop_copy.stderr b/tests/ui/lint/drop_copy.stderr
new file mode 100644
index 00000000000..db8e89ad295
--- /dev/null
+++ b/tests/ui/lint/drop_copy.stderr
@@ -0,0 +1,108 @@
+warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
+  --> $DIR/drop_copy.rs:34:5
+   |
+LL |     drop(s1);
+   |     ^^^^^--^
+   |          |
+   |          argument has type `SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+note: the lint level is defined here
+  --> $DIR/drop_copy.rs:3:9
+   |
+LL | #![warn(drop_copy)]
+   |         ^^^^^^^^^
+
+warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
+  --> $DIR/drop_copy.rs:35:5
+   |
+LL |     drop(s2);
+   |     ^^^^^--^
+   |          |
+   |          argument has type `SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
+  --> $DIR/drop_copy.rs:36:5
+   |
+LL |     drop(s3);
+   |     ^^^^^--^
+   |          |
+   |          argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+   = note: `#[warn(drop_ref)]` on by default
+
+warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
+  --> $DIR/drop_copy.rs:37:5
+   |
+LL |     drop(s4);
+   |     ^^^^^--^
+   |          |
+   |          argument has type `SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
+  --> $DIR/drop_copy.rs:38:5
+   |
+LL |     drop(s5);
+   |     ^^^^^--^
+   |          |
+   |          argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
+  --> $DIR/drop_copy.rs:50:5
+   |
+LL |     drop(a2);
+   |     ^^^^^--^
+   |          |
+   |          argument has type `&AnotherStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
+  --> $DIR/drop_copy.rs:52:5
+   |
+LL |     drop(a4);
+   |     ^^^^^--^
+   |          |
+   |          argument has type `&AnotherStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
+  --> $DIR/drop_copy.rs:71:13
+   |
+LL |             drop(println_and(13));
+   |             ^^^^^---------------^
+   |                  |
+   |                  argument has type `i32`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
+  --> $DIR/drop_copy.rs:74:14
+   |
+LL |         3 if drop(println_and(14)) == () => (),
+   |              ^^^^^---------------^
+   |                   |
+   |                   argument has type `i32`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
+  --> $DIR/drop_copy.rs:76:14
+   |
+LL |         4 => drop(2),
+   |              ^^^^^-^
+   |                   |
+   |                   argument has type `i32`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: 10 warnings emitted
+
diff --git a/tests/ui/lint/drop_ref.rs b/tests/ui/lint/drop_ref.rs
new file mode 100644
index 00000000000..db4f7569f6f
--- /dev/null
+++ b/tests/ui/lint/drop_ref.rs
@@ -0,0 +1,99 @@
+// check-pass
+
+#![warn(drop_ref)]
+
+struct SomeStruct;
+
+fn main() {
+    drop(&SomeStruct); //~ WARN calls to `std::mem::drop`
+
+    let mut owned1 = SomeStruct;
+    drop(&owned1); //~ WARN calls to `std::mem::drop`
+    drop(&&owned1); //~ WARN calls to `std::mem::drop`
+    drop(&mut owned1); //~ WARN calls to `std::mem::drop`
+    drop(owned1);
+
+    let reference1 = &SomeStruct;
+    drop(reference1); //~ WARN calls to `std::mem::drop`
+
+    let reference2 = &mut SomeStruct;
+    drop(reference2); //~ WARN calls to `std::mem::drop`
+
+    let ref reference3 = SomeStruct;
+    drop(reference3); //~ WARN calls to `std::mem::drop`
+}
+
+#[allow(dead_code)]
+fn test_generic_fn_drop<T>(val: T) {
+    drop(&val); //~ WARN calls to `std::mem::drop`
+    drop(val);
+}
+
+#[allow(dead_code)]
+fn test_similarly_named_function() {
+    fn drop<T>(_val: T) {}
+    drop(&SomeStruct); //OK; call to unrelated function which happens to have the same name
+    std::mem::drop(&SomeStruct); //~ WARN calls to `std::mem::drop`
+}
+
+#[derive(Copy, Clone)]
+pub struct Error;
+fn produce_half_owl_error() -> Result<(), Error> {
+    Ok(())
+}
+
+fn produce_half_owl_ok() -> Result<bool, ()> {
+    Ok(true)
+}
+
+#[allow(dead_code)]
+fn test_owl_result() -> Result<(), ()> {
+    produce_half_owl_error().map_err(|_| ())?;
+    produce_half_owl_ok().map(|_| ())?;
+    // the following should not be linted,
+    // we should not force users to use toilet closures
+    // to produce owl results when drop is more convenient
+    produce_half_owl_error().map_err(drop)?;
+    produce_half_owl_ok().map_err(drop)?;
+    Ok(())
+}
+
+#[allow(dead_code)]
+fn test_owl_result_2() -> Result<u8, ()> {
+    produce_half_owl_error().map_err(|_| ())?;
+    produce_half_owl_ok().map(|_| ())?;
+    // the following should not be linted,
+    // we should not force users to use toilet closures
+    // to produce owl results when drop is more convenient
+    produce_half_owl_error().map_err(drop)?;
+    produce_half_owl_ok().map(drop)?;
+    Ok(1)
+}
+
+#[allow(unused)]
+#[allow(clippy::unit_cmp)]
+fn issue10122(x: u8) {
+    // This is a function which returns a reference and has a side-effect, which means
+    // that calling drop() on the function is considered an idiomatic way of achieving
+    // the side-effect in a match arm.
+    fn println_and<T>(t: &T) -> &T {
+        println!("foo");
+        t
+    }
+
+    match x {
+        // Don't lint (copy type), we only care about side-effects
+        0 => drop(println_and(&12)),
+        // Don't lint (no copy type), we only care about side-effects
+        1 => drop(println_and(&String::new())),
+        2 => {
+            // Lint, even if we only care about the side-effect, it's already in a block
+            drop(println_and(&13)); //~ WARN calls to `std::mem::drop`
+        },
+        // Lint, idiomatic use is only in body of `Arm`
+        3 if drop(println_and(&14)) == () => (), //~ WARN calls to `std::mem::drop`
+         // Lint, not a fn/method call
+        4 => drop(&2), //~ WARN calls to `std::mem::drop`
+        _ => (),
+    }
+}
diff --git a/tests/ui/lint/drop_ref.stderr b/tests/ui/lint/drop_ref.stderr
new file mode 100644
index 00000000000..04c988fe99d
--- /dev/null
+++ b/tests/ui/lint/drop_ref.stderr
@@ -0,0 +1,127 @@
+warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
+  --> $DIR/drop_ref.rs:8:5
+   |
+LL |     drop(&SomeStruct);
+   |     ^^^^^-----------^
+   |          |
+   |          argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+note: the lint level is defined here
+  --> $DIR/drop_ref.rs:3:9
+   |
+LL | #![warn(drop_ref)]
+   |         ^^^^^^^^
+
+warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
+  --> $DIR/drop_ref.rs:11:5
+   |
+LL |     drop(&owned1);
+   |     ^^^^^-------^
+   |          |
+   |          argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
+  --> $DIR/drop_ref.rs:12:5
+   |
+LL |     drop(&&owned1);
+   |     ^^^^^--------^
+   |          |
+   |          argument has type `&&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
+  --> $DIR/drop_ref.rs:13:5
+   |
+LL |     drop(&mut owned1);
+   |     ^^^^^-----------^
+   |          |
+   |          argument has type `&mut SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
+  --> $DIR/drop_ref.rs:17:5
+   |
+LL |     drop(reference1);
+   |     ^^^^^----------^
+   |          |
+   |          argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
+  --> $DIR/drop_ref.rs:20:5
+   |
+LL |     drop(reference2);
+   |     ^^^^^----------^
+   |          |
+   |          argument has type `&mut SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
+  --> $DIR/drop_ref.rs:23:5
+   |
+LL |     drop(reference3);
+   |     ^^^^^----------^
+   |          |
+   |          argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
+  --> $DIR/drop_ref.rs:28:5
+   |
+LL |     drop(&val);
+   |     ^^^^^----^
+   |          |
+   |          argument has type `&T`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
+  --> $DIR/drop_ref.rs:36:5
+   |
+LL |     std::mem::drop(&SomeStruct);
+   |     ^^^^^^^^^^^^^^^-----------^
+   |                    |
+   |                    argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
+  --> $DIR/drop_ref.rs:91:13
+   |
+LL |             drop(println_and(&13));
+   |             ^^^^^----------------^
+   |                  |
+   |                  argument has type `&i32`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
+  --> $DIR/drop_ref.rs:94:14
+   |
+LL |         3 if drop(println_and(&14)) == () => (),
+   |              ^^^^^----------------^
+   |                   |
+   |                   argument has type `&i32`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
+  --> $DIR/drop_ref.rs:96:14
+   |
+LL |         4 => drop(&2),
+   |              ^^^^^--^
+   |                   |
+   |                   argument has type `&i32`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: 12 warnings emitted
+
diff --git a/tests/ui/lint/forget_copy.rs b/tests/ui/lint/forget_copy.rs
new file mode 100644
index 00000000000..a6b17b76971
--- /dev/null
+++ b/tests/ui/lint/forget_copy.rs
@@ -0,0 +1,56 @@
+// check-pass
+
+#![warn(forget_copy)]
+
+use std::mem::forget;
+use std::vec::Vec;
+
+#[derive(Copy, Clone)]
+struct SomeStruct;
+
+struct AnotherStruct {
+    x: u8,
+    y: u8,
+    z: Vec<u8>,
+}
+
+impl Clone for AnotherStruct {
+    fn clone(&self) -> AnotherStruct {
+        AnotherStruct {
+            x: self.x,
+            y: self.y,
+            z: self.z.clone(),
+        }
+    }
+}
+
+fn main() {
+    let s1 = SomeStruct {};
+    let s2 = s1;
+    let s3 = &s1;
+    let mut s4 = s1;
+    let ref s5 = s1;
+
+    forget(s1); //~ WARN calls to `std::mem::forget`
+    forget(s2); //~ WARN calls to `std::mem::forget`
+    forget(s3); //~ WARN calls to `std::mem::forget`
+    forget(s4); //~ WARN calls to `std::mem::forget`
+    forget(s5); //~ WARN calls to `std::mem::forget`
+
+    let a1 = AnotherStruct {
+        x: 255,
+        y: 0,
+        z: vec![1, 2, 3],
+    };
+    let a2 = &a1;
+    let mut a3 = a1.clone();
+    let ref a4 = a1;
+    let a5 = a1.clone();
+
+    forget(a2); //~ WARN calls to `std::mem::forget`
+    let a3 = &a1;
+    forget(a3); //~ WARN calls to `std::mem::forget`
+    forget(a4); //~ WARN calls to `std::mem::forget`
+    let a5 = a1.clone();
+    forget(a5);
+}
diff --git a/tests/ui/lint/forget_copy.stderr b/tests/ui/lint/forget_copy.stderr
new file mode 100644
index 00000000000..37bc8a8854e
--- /dev/null
+++ b/tests/ui/lint/forget_copy.stderr
@@ -0,0 +1,88 @@
+warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing
+  --> $DIR/forget_copy.rs:34:5
+   |
+LL |     forget(s1);
+   |     ^^^^^^^--^
+   |            |
+   |            argument has type `SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+note: the lint level is defined here
+  --> $DIR/forget_copy.rs:3:9
+   |
+LL | #![warn(forget_copy)]
+   |         ^^^^^^^^^^^
+
+warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing
+  --> $DIR/forget_copy.rs:35:5
+   |
+LL |     forget(s2);
+   |     ^^^^^^^--^
+   |            |
+   |            argument has type `SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
+  --> $DIR/forget_copy.rs:36:5
+   |
+LL |     forget(s3);
+   |     ^^^^^^^--^
+   |            |
+   |            argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+   = note: `#[warn(forget_ref)]` on by default
+
+warning: calls to `std::mem::forget` with a value that implements `Copy` does nothing
+  --> $DIR/forget_copy.rs:37:5
+   |
+LL |     forget(s4);
+   |     ^^^^^^^--^
+   |            |
+   |            argument has type `SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
+  --> $DIR/forget_copy.rs:38:5
+   |
+LL |     forget(s5);
+   |     ^^^^^^^--^
+   |            |
+   |            argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
+  --> $DIR/forget_copy.rs:50:5
+   |
+LL |     forget(a2);
+   |     ^^^^^^^--^
+   |            |
+   |            argument has type `&AnotherStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
+  --> $DIR/forget_copy.rs:52:5
+   |
+LL |     forget(a3);
+   |     ^^^^^^^--^
+   |            |
+   |            argument has type `&AnotherStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
+  --> $DIR/forget_copy.rs:53:5
+   |
+LL |     forget(a4);
+   |     ^^^^^^^--^
+   |            |
+   |            argument has type `&AnotherStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: 8 warnings emitted
+
diff --git a/tests/ui/lint/forget_ref.rs b/tests/ui/lint/forget_ref.rs
new file mode 100644
index 00000000000..13f6d4be3d1
--- /dev/null
+++ b/tests/ui/lint/forget_ref.rs
@@ -0,0 +1,39 @@
+// check-pass
+
+#![warn(forget_ref)]
+
+use std::mem::forget;
+
+struct SomeStruct;
+
+fn main() {
+    forget(&SomeStruct); //~ WARN calls to `std::mem::forget`
+
+    let mut owned = SomeStruct;
+    forget(&owned); //~ WARN calls to `std::mem::forget`
+    forget(&&owned); //~ WARN calls to `std::mem::forget`
+    forget(&mut owned); //~ WARN calls to `std::mem::forget`
+    forget(owned);
+
+    let reference1 = &SomeStruct;
+    forget(&*reference1); //~ WARN calls to `std::mem::forget`
+
+    let reference2 = &mut SomeStruct;
+    forget(reference2); //~ WARN calls to `std::mem::forget`
+
+    let ref reference3 = SomeStruct;
+    forget(reference3); //~ WARN calls to `std::mem::forget`
+}
+
+#[allow(dead_code)]
+fn test_generic_fn_forget<T>(val: T) {
+    forget(&val); //~ WARN calls to `std::mem::forget`
+    forget(val);
+}
+
+#[allow(dead_code)]
+fn test_similarly_named_function() {
+    fn forget<T>(_val: T) {}
+    forget(&SomeStruct); //OK; call to unrelated function which happens to have the same name
+    std::mem::forget(&SomeStruct); //~ WARN calls to `std::mem::forget`
+}
diff --git a/tests/ui/lint/forget_ref.stderr b/tests/ui/lint/forget_ref.stderr
new file mode 100644
index 00000000000..63fc7791980
--- /dev/null
+++ b/tests/ui/lint/forget_ref.stderr
@@ -0,0 +1,97 @@
+warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
+  --> $DIR/forget_ref.rs:10:5
+   |
+LL |     forget(&SomeStruct);
+   |     ^^^^^^^-----------^
+   |            |
+   |            argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+note: the lint level is defined here
+  --> $DIR/forget_ref.rs:3:9
+   |
+LL | #![warn(forget_ref)]
+   |         ^^^^^^^^^^
+
+warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
+  --> $DIR/forget_ref.rs:13:5
+   |
+LL |     forget(&owned);
+   |     ^^^^^^^------^
+   |            |
+   |            argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
+  --> $DIR/forget_ref.rs:14:5
+   |
+LL |     forget(&&owned);
+   |     ^^^^^^^-------^
+   |            |
+   |            argument has type `&&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
+  --> $DIR/forget_ref.rs:15:5
+   |
+LL |     forget(&mut owned);
+   |     ^^^^^^^----------^
+   |            |
+   |            argument has type `&mut SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
+  --> $DIR/forget_ref.rs:19:5
+   |
+LL |     forget(&*reference1);
+   |     ^^^^^^^------------^
+   |            |
+   |            argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
+  --> $DIR/forget_ref.rs:22:5
+   |
+LL |     forget(reference2);
+   |     ^^^^^^^----------^
+   |            |
+   |            argument has type `&mut SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
+  --> $DIR/forget_ref.rs:25:5
+   |
+LL |     forget(reference3);
+   |     ^^^^^^^----------^
+   |            |
+   |            argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
+  --> $DIR/forget_ref.rs:30:5
+   |
+LL |     forget(&val);
+   |     ^^^^^^^----^
+   |            |
+   |            argument has type `&T`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: calls to `std::mem::forget` with a reference instead of an owned value does nothing
+  --> $DIR/forget_ref.rs:38:5
+   |
+LL |     std::mem::forget(&SomeStruct);
+   |     ^^^^^^^^^^^^^^^^^-----------^
+   |                      |
+   |                      argument has type `&SomeStruct`
+   |
+   = note: use `let _ = ...` to ignore the expression or result
+
+warning: 9 warnings emitted
+
diff --git a/tests/ui/liveness/liveness-unused.rs b/tests/ui/liveness/liveness-unused.rs
index 9c7be15fcc8..8ef6ab1b6ff 100644
--- a/tests/ui/liveness/liveness-unused.rs
+++ b/tests/ui/liveness/liveness-unused.rs
@@ -1,7 +1,7 @@
 #![warn(unused)]
 #![deny(unused_variables)]
 #![deny(unused_assignments)]
-#![allow(dead_code, non_camel_case_types, trivial_numeric_casts)]
+#![allow(dead_code, non_camel_case_types, trivial_numeric_casts, drop_copy)]
 
 use std::ops::AddAssign;
 
diff --git a/tests/ui/macros/parse-complex-macro-invoc-op.rs b/tests/ui/macros/parse-complex-macro-invoc-op.rs
index 8fef9b0ed87..c50dfdf0116 100644
--- a/tests/ui/macros/parse-complex-macro-invoc-op.rs
+++ b/tests/ui/macros/parse-complex-macro-invoc-op.rs
@@ -4,6 +4,7 @@
 #![allow(unused_assignments)]
 #![allow(unused_variables)]
 #![allow(stable_features)]
+#![allow(drop_copy)]
 
 // Test parsing binary operators after macro invocations.
 
diff --git a/tests/ui/mismatched_types/cast-rfc0401.stderr b/tests/ui/mismatched_types/cast-rfc0401.stderr
index 2a36a352c73..6b9ac3c5852 100644
--- a/tests/ui/mismatched_types/cast-rfc0401.stderr
+++ b/tests/ui/mismatched_types/cast-rfc0401.stderr
@@ -220,11 +220,7 @@ LL |     let _ = fat_v as *const dyn Foo;
    |             ^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `Sized` is not implemented for `[u8]`
-   = note: required for the cast from `[u8]` to the object type `dyn Foo`
-help: consider borrowing the value, since `&[u8]` can be coerced into `dyn Foo`
-   |
-LL |     let _ = &fat_v as *const dyn Foo;
-   |             +
+   = note: required for the cast from `*const [u8]` to `*const dyn Foo`
 
 error[E0277]: the size for values of type `str` cannot be known at compilation time
   --> $DIR/cast-rfc0401.rs:62:13
@@ -233,11 +229,7 @@ LL |     let _ = a as *const dyn Foo;
    |             ^ doesn't have a size known at compile-time
    |
    = help: the trait `Sized` is not implemented for `str`
-   = note: required for the cast from `str` to the object type `dyn Foo`
-help: consider borrowing the value, since `&str` can be coerced into `dyn Foo`
-   |
-LL |     let _ = &a as *const dyn Foo;
-   |             +
+   = note: required for the cast from `*const str` to `*const dyn Foo`
 
 error[E0606]: casting `&{float}` as `f32` is invalid
   --> $DIR/cast-rfc0401.rs:71:30
diff --git a/tests/ui/never_type/fallback-closure-wrap.fallback.stderr b/tests/ui/never_type/fallback-closure-wrap.fallback.stderr
index a0f790dba15..5b6f0235123 100644
--- a/tests/ui/never_type/fallback-closure-wrap.fallback.stderr
+++ b/tests/ui/never_type/fallback-closure-wrap.fallback.stderr
@@ -10,7 +10,7 @@ LL | |     }) as Box<dyn FnMut()>);
    |
    = note: expected unit type `()`
                    found type `!`
-   = note: required for the cast from `[closure@$DIR/fallback-closure-wrap.rs:18:40: 18:47]` to the object type `dyn FnMut()`
+   = note: required for the cast from `Box<[closure@$DIR/fallback-closure-wrap.rs:18:40: 18:47]>` to `Box<dyn FnMut()>`
 
 error: aborting due to previous error
 
diff --git a/tests/ui/never_type/never-assign-dead-code.rs b/tests/ui/never_type/never-assign-dead-code.rs
index 7bb7c87097c..e95a992d780 100644
--- a/tests/ui/never_type/never-assign-dead-code.rs
+++ b/tests/ui/never_type/never-assign-dead-code.rs
@@ -3,6 +3,7 @@
 // check-pass
 
 #![feature(never_type)]
+#![allow(drop_copy)]
 #![warn(unused)]
 
 fn main() {
diff --git a/tests/ui/never_type/never-assign-dead-code.stderr b/tests/ui/never_type/never-assign-dead-code.stderr
index 521b82023c9..5660bde5c27 100644
--- a/tests/ui/never_type/never-assign-dead-code.stderr
+++ b/tests/ui/never_type/never-assign-dead-code.stderr
@@ -1,5 +1,5 @@
 warning: unreachable statement
-  --> $DIR/never-assign-dead-code.rs:10:5
+  --> $DIR/never-assign-dead-code.rs:11:5
    |
 LL |     let x: ! = panic!("aah");
    |                ------------- any code following this expression is unreachable
@@ -7,14 +7,14 @@ LL |     drop(x);
    |     ^^^^^^^^ unreachable statement
    |
 note: the lint level is defined here
-  --> $DIR/never-assign-dead-code.rs:6:9
+  --> $DIR/never-assign-dead-code.rs:7:9
    |
 LL | #![warn(unused)]
    |         ^^^^^^
    = note: `#[warn(unreachable_code)]` implied by `#[warn(unused)]`
 
 warning: unreachable call
-  --> $DIR/never-assign-dead-code.rs:10:5
+  --> $DIR/never-assign-dead-code.rs:11:5
    |
 LL |     drop(x);
    |     ^^^^ - any code following this expression is unreachable
@@ -22,7 +22,7 @@ LL |     drop(x);
    |     unreachable call
 
 warning: unused variable: `x`
-  --> $DIR/never-assign-dead-code.rs:9:9
+  --> $DIR/never-assign-dead-code.rs:10:9
    |
 LL |     let x: ! = panic!("aah");
    |         ^ help: if this is intentional, prefix it with an underscore: `_x`
diff --git a/tests/ui/nll/relate_tys/hr-fn-aba-as-aaa.rs b/tests/ui/nll/relate_tys/hr-fn-aba-as-aaa.rs
index 7cc0acf45f2..73ceaeeb875 100644
--- a/tests/ui/nll/relate_tys/hr-fn-aba-as-aaa.rs
+++ b/tests/ui/nll/relate_tys/hr-fn-aba-as-aaa.rs
@@ -5,6 +5,8 @@
 // check-pass
 // compile-flags:-Zno-leak-check
 
+#![allow(drop_copy)]
+
 fn make_it() -> for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32 {
     panic!()
 }
diff --git a/tests/ui/nll/ty-outlives/projection-body.rs b/tests/ui/nll/ty-outlives/projection-body.rs
index b03a539ebdb..bff9058a507 100644
--- a/tests/ui/nll/ty-outlives/projection-body.rs
+++ b/tests/ui/nll/ty-outlives/projection-body.rs
@@ -3,6 +3,8 @@
 //
 // check-pass
 
+#![allow(drop_ref)]
+
 trait MyTrait<'a> {
     type Output;
 }
diff --git a/tests/ui/numbers-arithmetic/overflow-attribute-works-1.rs b/tests/ui/numbers-arithmetic/overflow-attribute-works-1.rs
new file mode 100644
index 00000000000..318be2a6401
--- /dev/null
+++ b/tests/ui/numbers-arithmetic/overflow-attribute-works-1.rs
@@ -0,0 +1,19 @@
+// run-pass
+// compile-flags: -C overflow_checks=true
+
+#![feature(cfg_overflow_checks)]
+
+fn main() {
+    assert!(cfg!(overflow_checks));
+    assert!(compiles_differently());
+}
+
+#[cfg(overflow_checks)]
+fn compiles_differently()->bool {
+    true
+}
+
+#[cfg(not(overflow_checks))]
+fn compiles_differently()->bool {
+    false
+}
diff --git a/tests/ui/numbers-arithmetic/overflow-attribute-works-2.rs b/tests/ui/numbers-arithmetic/overflow-attribute-works-2.rs
new file mode 100644
index 00000000000..0367d980a64
--- /dev/null
+++ b/tests/ui/numbers-arithmetic/overflow-attribute-works-2.rs
@@ -0,0 +1,19 @@
+// run-pass
+// compile-flags: -C overflow_checks=false
+
+#![feature(cfg_overflow_checks)]
+
+fn main() {
+    assert!(!cfg!(overflow_checks));
+    assert!(!compiles_differently());
+}
+
+#[cfg(overflow_checks)]
+fn compiles_differently()->bool {
+    true
+}
+
+#[cfg(not(overflow_checks))]
+fn compiles_differently()->bool {
+    false
+}
diff --git a/tests/ui/object-safety/issue-19538.stderr b/tests/ui/object-safety/issue-19538.stderr
index 8420637b3de..183245b2322 100644
--- a/tests/ui/object-safety/issue-19538.stderr
+++ b/tests/ui/object-safety/issue-19538.stderr
@@ -29,8 +29,7 @@ LL |     fn foo<T>(&self, val: T);
 LL | trait Bar: Foo { }
    |       --- this trait cannot be made into an object...
    = help: consider moving `foo` to another trait
-   = note: required for `&mut Thing` to implement `CoerceUnsized<&mut dyn Bar>`
-   = note: required by cast to type `&mut dyn Bar`
+   = note: required for the cast from `&mut Thing` to `&mut dyn Bar`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/object-safety/object-safety-associated-consts.object_safe_for_dispatch.stderr b/tests/ui/object-safety/object-safety-associated-consts.object_safe_for_dispatch.stderr
index f44de07d5da..db3e0885a85 100644
--- a/tests/ui/object-safety/object-safety-associated-consts.object_safe_for_dispatch.stderr
+++ b/tests/ui/object-safety/object-safety-associated-consts.object_safe_for_dispatch.stderr
@@ -12,8 +12,7 @@ LL | trait Bar {
 LL |     const X: usize;
    |           ^ ...because it contains this associated `const`
    = help: consider moving `X` to another trait
-   = note: required for `&T` to implement `CoerceUnsized<&dyn Bar>`
-   = note: required by cast to type `&dyn Bar`
+   = note: required for the cast from `&T` to `&dyn Bar`
 
 error: aborting due to previous error
 
diff --git a/tests/ui/object-safety/object-safety-generics.object_safe_for_dispatch.stderr b/tests/ui/object-safety/object-safety-generics.object_safe_for_dispatch.stderr
index 9a2d472d5e7..b200b64a1f0 100644
--- a/tests/ui/object-safety/object-safety-generics.object_safe_for_dispatch.stderr
+++ b/tests/ui/object-safety/object-safety-generics.object_safe_for_dispatch.stderr
@@ -12,8 +12,7 @@ LL | trait Bar {
 LL |     fn bar<T>(&self, t: T);
    |        ^^^ ...because method `bar` has generic type parameters
    = help: consider moving `bar` to another trait
-   = note: required for `&T` to implement `CoerceUnsized<&dyn Bar>`
-   = note: required by cast to type `&dyn Bar`
+   = note: required for the cast from `&T` to `&dyn Bar`
 
 error[E0038]: the trait `Bar` cannot be made into an object
   --> $DIR/object-safety-generics.rs:26:5
@@ -29,8 +28,7 @@ LL | trait Bar {
 LL |     fn bar<T>(&self, t: T);
    |        ^^^ ...because method `bar` has generic type parameters
    = help: consider moving `bar` to another trait
-   = note: required for `&T` to implement `CoerceUnsized<&dyn Bar>`
-   = note: required by cast to type `&dyn Bar`
+   = note: required for the cast from `&T` to `&dyn Bar`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/object-safety/object-safety-mentions-Self.object_safe_for_dispatch.stderr b/tests/ui/object-safety/object-safety-mentions-Self.object_safe_for_dispatch.stderr
index 40a298bd1a7..414614d8d0b 100644
--- a/tests/ui/object-safety/object-safety-mentions-Self.object_safe_for_dispatch.stderr
+++ b/tests/ui/object-safety/object-safety-mentions-Self.object_safe_for_dispatch.stderr
@@ -12,8 +12,7 @@ LL | trait Bar {
 LL |     fn bar(&self, x: &Self);
    |                      ^^^^^ ...because method `bar` references the `Self` type in this parameter
    = help: consider moving `bar` to another trait
-   = note: required for `&T` to implement `CoerceUnsized<&dyn Bar>`
-   = note: required by cast to type `&dyn Bar`
+   = note: required for the cast from `&T` to `&dyn Bar`
 
 error[E0038]: the trait `Baz` cannot be made into an object
   --> $DIR/object-safety-mentions-Self.rs:30:5
@@ -29,8 +28,7 @@ LL | trait Baz {
 LL |     fn baz(&self) -> Self;
    |                      ^^^^ ...because method `baz` references the `Self` type in its return type
    = help: consider moving `baz` to another trait
-   = note: required for `&T` to implement `CoerceUnsized<&dyn Baz>`
-   = note: required by cast to type `&dyn Baz`
+   = note: required for the cast from `&T` to `&dyn Baz`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr b/tests/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr
index da87b58c9e2..befcef952a8 100644
--- a/tests/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr
+++ b/tests/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr
@@ -11,8 +11,7 @@ LL | trait Foo {
    |       --- this trait cannot be made into an object...
 LL |     fn foo() {}
    |        ^^^ ...because associated function `foo` has no `self` parameter
-   = note: required for `Box<Bar>` to implement `CoerceUnsized<Box<dyn Foo>>`
-   = note: required by cast to type `Box<dyn Foo>`
+   = note: required for the cast from `Box<Bar>` to `Box<dyn Foo>`
 help: consider turning `foo` into a method by giving it a `&self` argument
    |
 LL |     fn foo(&self) {}
diff --git a/tests/ui/object-safety/object-safety-sized-2.object_safe_for_dispatch.stderr b/tests/ui/object-safety/object-safety-sized-2.object_safe_for_dispatch.stderr
index 6c29c8d5f7c..90e5c59dd02 100644
--- a/tests/ui/object-safety/object-safety-sized-2.object_safe_for_dispatch.stderr
+++ b/tests/ui/object-safety/object-safety-sized-2.object_safe_for_dispatch.stderr
@@ -11,8 +11,7 @@ LL | trait Bar
    |       --- this trait cannot be made into an object...
 LL |     where Self : Sized
    |                  ^^^^^ ...because it requires `Self: Sized`
-   = note: required for `&T` to implement `CoerceUnsized<&dyn Bar>`
-   = note: required by cast to type `&dyn Bar`
+   = note: required for the cast from `&T` to `&dyn Bar`
 
 error: aborting due to previous error
 
diff --git a/tests/ui/object-safety/object-safety-sized.object_safe_for_dispatch.stderr b/tests/ui/object-safety/object-safety-sized.object_safe_for_dispatch.stderr
index 70a44ed6101..a6c22b8747e 100644
--- a/tests/ui/object-safety/object-safety-sized.object_safe_for_dispatch.stderr
+++ b/tests/ui/object-safety/object-safety-sized.object_safe_for_dispatch.stderr
@@ -11,8 +11,7 @@ LL | trait Bar : Sized {
    |       ---   ^^^^^ ...because it requires `Self: Sized`
    |       |
    |       this trait cannot be made into an object...
-   = note: required for `&T` to implement `CoerceUnsized<&dyn Bar>`
-   = note: required by cast to type `&dyn Bar`
+   = note: required for the cast from `&T` to `&dyn Bar`
 
 error: aborting due to previous error
 
diff --git a/tests/ui/or-patterns/or-patterns-default-binding-modes.rs b/tests/ui/or-patterns/or-patterns-default-binding-modes.rs
index e56f9ffe23c..c138d99d303 100644
--- a/tests/ui/or-patterns/or-patterns-default-binding-modes.rs
+++ b/tests/ui/or-patterns/or-patterns-default-binding-modes.rs
@@ -3,6 +3,8 @@
 // check-pass
 
 #![allow(irrefutable_let_patterns)]
+#![allow(drop_copy)]
+#![allow(drop_ref)]
 
 fn main() {
     // A regression test for a mistake we made at one point:
diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box-pass.rs b/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box-pass.rs
index fbdefd9d36c..965204bf240 100644
--- a/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box-pass.rs
+++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box-pass.rs
@@ -2,6 +2,9 @@
 
 // Test `@` patterns combined with `box` patterns.
 
+#![allow(drop_ref)]
+#![allow(drop_copy)]
+
 #![feature(box_patterns)]
 
 #[derive(Copy, Clone)]
diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-copy-bindings-in-at.rs b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-copy-bindings-in-at.rs
index 0108861cfce..3eb5d2cbf54 100644
--- a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-copy-bindings-in-at.rs
+++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-copy-bindings-in-at.rs
@@ -2,6 +2,8 @@
 
 // Test `Copy` bindings in the rhs of `@` patterns.
 
+#![allow(drop_copy)]
+
 #[derive(Copy, Clone)]
 struct C;
 
diff --git a/tests/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern-pass.rs b/tests/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern-pass.rs
index 5445696fdff..0550238549e 100644
--- a/tests/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern-pass.rs
+++ b/tests/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern-pass.rs
@@ -1,5 +1,7 @@
 // check-pass
 
+#![allow(drop_ref)]
+
 fn main() {}
 
 struct U;
diff --git a/tests/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures-pass.rs b/tests/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures-pass.rs
index 583f70f41aa..788975d960a 100644
--- a/tests/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures-pass.rs
+++ b/tests/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures-pass.rs
@@ -1,5 +1,7 @@
 // check-pass
 
+#![allow(drop_ref)]
+
 fn main() {
     struct U;
     fn accept_fn_once(_: impl FnOnce()) {}
diff --git a/tests/ui/print_type_sizes/async.rs b/tests/ui/print_type_sizes/async.rs
index 1598b069691..c73268dc46a 100644
--- a/tests/ui/print_type_sizes/async.rs
+++ b/tests/ui/print_type_sizes/async.rs
@@ -3,6 +3,8 @@
 // build-pass
 // ignore-pass
 
+#![allow(drop_copy)]
+
 async fn wait() {}
 
 pub async fn test(arg: [u8; 8192]) {
diff --git a/tests/ui/print_type_sizes/async.stdout b/tests/ui/print_type_sizes/async.stdout
index 1c6887412be..873def9031a 100644
--- a/tests/ui/print_type_sizes/async.stdout
+++ b/tests/ui/print_type_sizes/async.stdout
@@ -1,4 +1,4 @@
-print-type-size type: `[async fn body@$DIR/async.rs:8:36: 11:2]`: 16386 bytes, alignment: 1 bytes
+print-type-size type: `[async fn body@$DIR/async.rs:10:36: 13:2]`: 16386 bytes, alignment: 1 bytes
 print-type-size     discriminant: 1 bytes
 print-type-size     variant `Unresumed`: 8192 bytes
 print-type-size         upvar `.arg`: 8192 bytes
@@ -16,14 +16,14 @@ print-type-size type: `std::mem::MaybeUninit<[u8; 8192]>`: 8192 bytes, alignment
 print-type-size     variant `MaybeUninit`: 8192 bytes
 print-type-size         field `.uninit`: 0 bytes
 print-type-size         field `.value`: 8192 bytes
-print-type-size type: `[async fn body@$DIR/async.rs:6:17: 6:19]`: 1 bytes, alignment: 1 bytes
+print-type-size type: `[async fn body@$DIR/async.rs:8:17: 8:19]`: 1 bytes, alignment: 1 bytes
 print-type-size     discriminant: 1 bytes
 print-type-size     variant `Unresumed`: 0 bytes
 print-type-size     variant `Returned`: 0 bytes
 print-type-size     variant `Panicked`: 0 bytes
-print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/async.rs:6:17: 6:19]>`: 1 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/async.rs:8:17: 8:19]>`: 1 bytes, alignment: 1 bytes
 print-type-size     field `.value`: 1 bytes
-print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/async.rs:6:17: 6:19]>`: 1 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/async.rs:8:17: 8:19]>`: 1 bytes, alignment: 1 bytes
 print-type-size     variant `MaybeUninit`: 1 bytes
 print-type-size         field `.uninit`: 0 bytes
 print-type-size         field `.value`: 1 bytes
diff --git a/tests/ui/print_type_sizes/generator_discr_placement.rs b/tests/ui/print_type_sizes/generator_discr_placement.rs
index 1a85fe95bb6..a77a03f0a8a 100644
--- a/tests/ui/print_type_sizes/generator_discr_placement.rs
+++ b/tests/ui/print_type_sizes/generator_discr_placement.rs
@@ -6,6 +6,7 @@
 
 // Avoid emitting panic handlers, like the rest of these tests...
 #![feature(generators)]
+#![allow(drop_copy)]
 
 pub fn foo() {
     let a = || {
diff --git a/tests/ui/print_type_sizes/generator_discr_placement.stdout b/tests/ui/print_type_sizes/generator_discr_placement.stdout
index f2a11c7a33b..fe0022cf5f4 100644
--- a/tests/ui/print_type_sizes/generator_discr_placement.stdout
+++ b/tests/ui/print_type_sizes/generator_discr_placement.stdout
@@ -1,4 +1,4 @@
-print-type-size type: `[generator@$DIR/generator_discr_placement.rs:11:13: 11:15]`: 8 bytes, alignment: 4 bytes
+print-type-size type: `[generator@$DIR/generator_discr_placement.rs:12:13: 12:15]`: 8 bytes, alignment: 4 bytes
 print-type-size     discriminant: 1 bytes
 print-type-size     variant `Unresumed`: 0 bytes
 print-type-size     variant `Suspend0`: 7 bytes
diff --git a/tests/ui/regions/type-param-outlives-reempty-issue-74429-2.rs b/tests/ui/regions/type-param-outlives-reempty-issue-74429-2.rs
index a65c17e0efc..5ae5ebb450e 100644
--- a/tests/ui/regions/type-param-outlives-reempty-issue-74429-2.rs
+++ b/tests/ui/regions/type-param-outlives-reempty-issue-74429-2.rs
@@ -55,11 +55,11 @@ where
 }
 
 pub fn x<T: Copy>(a: Array<T>) {
-    // drop just avoids a must_use warning
-    drop((0..1).filter(|_| true));
+    // _ just avoids a must_use warning
+    let _ = (0..1).filter(|_| true);
     let y = a.index_axis();
     a.axis_iter().for_each(|_| {
-        drop(y);
+        let _ = y;
     });
 }
 
diff --git a/tests/ui/regions/type-param-outlives-reempty-issue-74429.rs b/tests/ui/regions/type-param-outlives-reempty-issue-74429.rs
index d463f311c34..af2bb09805a 100644
--- a/tests/ui/regions/type-param-outlives-reempty-issue-74429.rs
+++ b/tests/ui/regions/type-param-outlives-reempty-issue-74429.rs
@@ -3,6 +3,8 @@
 
 // check-pass
 
+#![allow(drop_copy)]
+
 use std::marker::PhantomData;
 
 fn apply<T, F: FnOnce(T)>(_: T, _: F) {}
diff --git a/tests/ui/rfc-2008-non-exhaustive/borrowck-exhaustive.rs b/tests/ui/rfc-2008-non-exhaustive/borrowck-exhaustive.rs
index be775b37f7b..8f45b989f13 100644
--- a/tests/ui/rfc-2008-non-exhaustive/borrowck-exhaustive.rs
+++ b/tests/ui/rfc-2008-non-exhaustive/borrowck-exhaustive.rs
@@ -3,6 +3,8 @@
 
 // check-pass
 
+#![allow(drop_ref)]
+
 // aux-build:monovariants.rs
 extern crate monovariants;
 
diff --git a/tests/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs b/tests/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs
index 04d924a9aed..4c1562790d5 100644
--- a/tests/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs
+++ b/tests/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs
@@ -4,6 +4,8 @@
 // Tests ensuring that `dbg!(expr)` has the expected run-time behavior.
 // as well as some compile time properties we expect.
 
+#![allow(drop_copy)]
+
 #[derive(Copy, Clone, Debug)]
 struct Unit;
 
diff --git a/tests/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.run.stderr b/tests/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.run.stderr
index 49d72158e92..a20a6062c13 100644
--- a/tests/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.run.stderr
+++ b/tests/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.run.stderr
@@ -1,28 +1,28 @@
-[$DIR/dbg-macro-expected-behavior.rs:20] Unit = Unit
-[$DIR/dbg-macro-expected-behavior.rs:21] a = Unit
-[$DIR/dbg-macro-expected-behavior.rs:27] Point { x: 42, y: 24 } = Point {
+[$DIR/dbg-macro-expected-behavior.rs:22] Unit = Unit
+[$DIR/dbg-macro-expected-behavior.rs:23] a = Unit
+[$DIR/dbg-macro-expected-behavior.rs:29] Point { x: 42, y: 24 } = Point {
     x: 42,
     y: 24,
 }
-[$DIR/dbg-macro-expected-behavior.rs:28] b = Point {
+[$DIR/dbg-macro-expected-behavior.rs:30] b = Point {
     x: 42,
     y: 24,
 }
-[$DIR/dbg-macro-expected-behavior.rs:36]
-[$DIR/dbg-macro-expected-behavior.rs:40] &a = NoCopy(
+[$DIR/dbg-macro-expected-behavior.rs:38]
+[$DIR/dbg-macro-expected-behavior.rs:42] &a = NoCopy(
     1337,
 )
-[$DIR/dbg-macro-expected-behavior.rs:40] dbg!(& a) = NoCopy(
+[$DIR/dbg-macro-expected-behavior.rs:42] dbg!(& a) = NoCopy(
     1337,
 )
-[$DIR/dbg-macro-expected-behavior.rs:45] f(&42) = 42
+[$DIR/dbg-macro-expected-behavior.rs:47] f(&42) = 42
 before
-[$DIR/dbg-macro-expected-behavior.rs:50] { foo += 1; eprintln!("before"); 7331 } = 7331
-[$DIR/dbg-macro-expected-behavior.rs:58] ("Yeah",) = (
+[$DIR/dbg-macro-expected-behavior.rs:52] { foo += 1; eprintln!("before"); 7331 } = 7331
+[$DIR/dbg-macro-expected-behavior.rs:60] ("Yeah",) = (
     "Yeah",
 )
-[$DIR/dbg-macro-expected-behavior.rs:61] 1 = 1
-[$DIR/dbg-macro-expected-behavior.rs:61] 2 = 2
-[$DIR/dbg-macro-expected-behavior.rs:65] 1u8 = 1
-[$DIR/dbg-macro-expected-behavior.rs:65] 2u32 = 2
-[$DIR/dbg-macro-expected-behavior.rs:65] "Yeah" = "Yeah"
+[$DIR/dbg-macro-expected-behavior.rs:63] 1 = 1
+[$DIR/dbg-macro-expected-behavior.rs:63] 2 = 2
+[$DIR/dbg-macro-expected-behavior.rs:67] 1u8 = 1
+[$DIR/dbg-macro-expected-behavior.rs:67] 2u32 = 2
+[$DIR/dbg-macro-expected-behavior.rs:67] "Yeah" = "Yeah"
diff --git a/tests/ui/rust-2018/remove-extern-crate.fixed b/tests/ui/rust-2018/remove-extern-crate.fixed
index 15e0ccc5256..4ed4d610025 100644
--- a/tests/ui/rust-2018/remove-extern-crate.fixed
+++ b/tests/ui/rust-2018/remove-extern-crate.fixed
@@ -5,6 +5,7 @@
 // compile-flags:--extern remove_extern_crate
 
 #![warn(rust_2018_idioms)]
+#![allow(drop_copy)]
 
  //~ WARNING unused extern crate
 // Shouldn't suggest changing to `use`, as `another_name`
diff --git a/tests/ui/rust-2018/remove-extern-crate.rs b/tests/ui/rust-2018/remove-extern-crate.rs
index aec0bc7c374..5dafdb2b7b7 100644
--- a/tests/ui/rust-2018/remove-extern-crate.rs
+++ b/tests/ui/rust-2018/remove-extern-crate.rs
@@ -5,6 +5,7 @@
 // compile-flags:--extern remove_extern_crate
 
 #![warn(rust_2018_idioms)]
+#![allow(drop_copy)]
 
 extern crate core; //~ WARNING unused extern crate
 // Shouldn't suggest changing to `use`, as `another_name`
diff --git a/tests/ui/rust-2018/remove-extern-crate.stderr b/tests/ui/rust-2018/remove-extern-crate.stderr
index d07358e471b..f752cac8ed6 100644
--- a/tests/ui/rust-2018/remove-extern-crate.stderr
+++ b/tests/ui/rust-2018/remove-extern-crate.stderr
@@ -1,5 +1,5 @@
 warning: unused extern crate
-  --> $DIR/remove-extern-crate.rs:9:1
+  --> $DIR/remove-extern-crate.rs:10:1
    |
 LL | extern crate core;
    | ^^^^^^^^^^^^^^^^^^ help: remove it
@@ -12,7 +12,7 @@ LL | #![warn(rust_2018_idioms)]
    = note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]`
 
 warning: `extern crate` is not idiomatic in the new edition
-  --> $DIR/remove-extern-crate.rs:33:5
+  --> $DIR/remove-extern-crate.rs:34:5
    |
 LL |     extern crate core;
    |     ^^^^^^^^^^^^^^^^^^
@@ -23,7 +23,7 @@ LL |     use core;
    |     ~~~
 
 warning: `extern crate` is not idiomatic in the new edition
-  --> $DIR/remove-extern-crate.rs:43:5
+  --> $DIR/remove-extern-crate.rs:44:5
    |
 LL |     pub extern crate core;
    |     ^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/self/arbitrary-self-types-not-object-safe.curr.stderr b/tests/ui/self/arbitrary-self-types-not-object-safe.curr.stderr
index 0ec0d4be5f2..13591f5b635 100644
--- a/tests/ui/self/arbitrary-self-types-not-object-safe.curr.stderr
+++ b/tests/ui/self/arbitrary-self-types-not-object-safe.curr.stderr
@@ -31,8 +31,7 @@ LL | trait Foo {
    |       --- this trait cannot be made into an object...
 LL |     fn foo(self: &Rc<Self>) -> usize;
    |                  ^^^^^^^^^ ...because method `foo`'s `self` parameter cannot be dispatched on
-   = note: required for `Rc<usize>` to implement `CoerceUnsized<Rc<dyn Foo>>`
-   = note: required by cast to type `Rc<dyn Foo>`
+   = note: required for the cast from `Rc<usize>` to `Rc<dyn Foo>`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr b/tests/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr
index b494b448e2e..593f705353a 100644
--- a/tests/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr
+++ b/tests/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr
@@ -14,8 +14,7 @@ LL | trait Foo {
    |       --- this trait cannot be made into an object...
 LL |     fn foo(self: &Rc<Self>) -> usize;
    |                  ^^^^^^^^^ ...because method `foo`'s `self` parameter cannot be dispatched on
-   = note: required for `Rc<usize>` to implement `CoerceUnsized<Rc<dyn Foo>>`
-   = note: required by cast to type `Rc<dyn Foo>`
+   = note: required for the cast from `Rc<usize>` to `Rc<dyn Foo>`
 
 error: aborting due to previous error
 
diff --git a/tests/ui/statics/issue-91050-1.rs b/tests/ui/statics/issue-91050-1.rs
index 403a41462ef..f59bcf0b803 100644
--- a/tests/ui/statics/issue-91050-1.rs
+++ b/tests/ui/statics/issue-91050-1.rs
@@ -12,6 +12,8 @@
 //
 // In regular builds, the bad cast was UB, like "Invalid LLVMRustVisibility value!"
 
+#![allow(drop_copy)]
+
 pub mod before {
     #[no_mangle]
     pub static GLOBAL1: [u8; 1] = [1];
diff --git a/tests/ui/suggestions/derive-macro-missing-bounds.stderr b/tests/ui/suggestions/derive-macro-missing-bounds.stderr
index c3f305c1770..bffcb1af487 100644
--- a/tests/ui/suggestions/derive-macro-missing-bounds.stderr
+++ b/tests/ui/suggestions/derive-macro-missing-bounds.stderr
@@ -36,7 +36,7 @@ LL |     impl<T: Debug + Trait> Debug for Inner<T> {
    |                     unsatisfied trait bound introduced here
    = note: 1 redundant requirement hidden
    = note: required for `&c::Inner<T>` to implement `Debug`
-   = note: required for the cast from `&c::Inner<T>` to the object type `dyn Debug`
+   = note: required for the cast from `&&c::Inner<T>` to `&dyn Debug`
    = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider restricting type parameter `T`
    |
@@ -58,7 +58,7 @@ LL |     impl<T> Debug for Inner<T> where T: Debug, T: Trait {
    |             ^^^^^     ^^^^^^^^                    ----- unsatisfied trait bound introduced here
    = note: 1 redundant requirement hidden
    = note: required for `&d::Inner<T>` to implement `Debug`
-   = note: required for the cast from `&d::Inner<T>` to the object type `dyn Debug`
+   = note: required for the cast from `&&d::Inner<T>` to `&dyn Debug`
    = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider restricting type parameter `T`
    |
@@ -80,7 +80,7 @@ LL |     impl<T> Debug for Inner<T> where T: Debug + Trait {
    |             ^^^^^     ^^^^^^^^                  ----- unsatisfied trait bound introduced here
    = note: 1 redundant requirement hidden
    = note: required for `&e::Inner<T>` to implement `Debug`
-   = note: required for the cast from `&e::Inner<T>` to the object type `dyn Debug`
+   = note: required for the cast from `&&e::Inner<T>` to `&dyn Debug`
    = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider restricting type parameter `T`
    |
@@ -102,7 +102,7 @@ LL |     impl<T: Debug> Debug for Inner<T> where T: Trait {
    |                    ^^^^^     ^^^^^^^^          ----- unsatisfied trait bound introduced here
    = note: 1 redundant requirement hidden
    = note: required for `&f::Inner<T>` to implement `Debug`
-   = note: required for the cast from `&f::Inner<T>` to the object type `dyn Debug`
+   = note: required for the cast from `&&f::Inner<T>` to `&dyn Debug`
    = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider restricting type parameter `T`
    |
diff --git a/tests/ui/suggestions/suggest-borrow-to-dyn-object.rs b/tests/ui/suggestions/suggest-borrow-to-dyn-object.rs
deleted file mode 100644
index 120fc538307..00000000000
--- a/tests/ui/suggestions/suggest-borrow-to-dyn-object.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-use std::ffi::{OsStr, OsString};
-use std::path::Path;
-
-fn check(p: &dyn AsRef<Path>) {
-    let m = std::fs::metadata(&p);
-    println!("{:?}", &m);
-}
-
-fn main() {
-    let s: OsString = ".".into();
-    let s: &OsStr = &s;
-    check(s);
-    //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
-    //~| HELP within `OsStr`, the trait `Sized` is not implemented for `[u8]`
-    //~| HELP consider borrowing the value, since `&OsStr` can be coerced into `dyn AsRef<Path>`
-}
diff --git a/tests/ui/suggestions/suggest-borrow-to-dyn-object.stderr b/tests/ui/suggestions/suggest-borrow-to-dyn-object.stderr
deleted file mode 100644
index 365c1016eb3..00000000000
--- a/tests/ui/suggestions/suggest-borrow-to-dyn-object.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
-  --> $DIR/suggest-borrow-to-dyn-object.rs:12:11
-   |
-LL |     check(s);
-   |           ^ doesn't have a size known at compile-time
-   |
-   = help: within `OsStr`, the trait `Sized` is not implemented for `[u8]`
-note: required because it appears within the type `OsStr`
-  --> $SRC_DIR/std/src/ffi/os_str.rs:LL:COL
-   = note: required for the cast from `OsStr` to the object type `dyn AsRef<Path>`
-help: consider borrowing the value, since `&OsStr` can be coerced into `dyn AsRef<Path>`
-   |
-LL |     check(&s);
-   |           +
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/coercion-generic-bad.stderr b/tests/ui/traits/coercion-generic-bad.stderr
index 93d6770eb47..e7e8a796796 100644
--- a/tests/ui/traits/coercion-generic-bad.stderr
+++ b/tests/ui/traits/coercion-generic-bad.stderr
@@ -5,7 +5,7 @@ LL |     let s: Box<dyn Trait<isize>> = Box::new(Struct { person: "Fred" });
    |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<isize>` is not implemented for `Struct`
    |
    = help: the trait `Trait<&'static str>` is implemented for `Struct`
-   = note: required for the cast from `Struct` to the object type `dyn Trait<isize>`
+   = note: required for the cast from `Box<Struct>` to `Box<dyn Trait<isize>>`
 
 error: aborting due to previous error
 
diff --git a/tests/ui/traits/copy-guessing.rs b/tests/ui/traits/copy-guessing.rs
index f031dd9ca48..558303c2e40 100644
--- a/tests/ui/traits/copy-guessing.rs
+++ b/tests/ui/traits/copy-guessing.rs
@@ -1,5 +1,8 @@
 // run-pass
+
 #![allow(dead_code)]
+#![allow(drop_copy)]
+
 // "guessing" in trait selection can affect `copy_or_move`. Check that this
 // is correctly handled. I am not sure what is the "correct" behaviour,
 // but we should at least not ICE.
diff --git a/tests/ui/traits/impl-evaluation-order.rs b/tests/ui/traits/impl-evaluation-order.rs
index 57809d89aa6..256ce992eef 100644
--- a/tests/ui/traits/impl-evaluation-order.rs
+++ b/tests/ui/traits/impl-evaluation-order.rs
@@ -6,6 +6,8 @@
 
 // check-pass
 
+#![allow(drop_copy)]
+
 trait A {
     type B;
 }
diff --git a/tests/ui/traits/issue-20692.stderr b/tests/ui/traits/issue-20692.stderr
index 2028994cdaa..30e3c9da1a0 100644
--- a/tests/ui/traits/issue-20692.stderr
+++ b/tests/ui/traits/issue-20692.stderr
@@ -27,8 +27,7 @@ LL | trait Array: Sized + Copy {}
    |       |      |
    |       |      ...because it requires `Self: Sized`
    |       this trait cannot be made into an object...
-   = note: required for `&T` to implement `CoerceUnsized<&dyn Array>`
-   = note: required by cast to type `&dyn Array`
+   = note: required for the cast from `&T` to `&dyn Array`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/traits/issue-38604.stderr b/tests/ui/traits/issue-38604.stderr
index 50d6fb05465..d5327602430 100644
--- a/tests/ui/traits/issue-38604.stderr
+++ b/tests/ui/traits/issue-38604.stderr
@@ -25,8 +25,7 @@ LL | trait Foo where u32: Q<Self> {
    |       ---            ^^^^^^^ ...because it uses `Self` as a type parameter
    |       |
    |       this trait cannot be made into an object...
-   = note: required for `Box<()>` to implement `CoerceUnsized<Box<dyn Foo>>`
-   = note: required by cast to type `Box<dyn Foo>`
+   = note: required for the cast from `Box<()>` to `Box<dyn Foo>`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/traits/issue-7013.stderr b/tests/ui/traits/issue-7013.stderr
index 9ac5c4725ab..1c0e8bcf185 100644
--- a/tests/ui/traits/issue-7013.stderr
+++ b/tests/ui/traits/issue-7013.stderr
@@ -12,7 +12,7 @@ note: required because it appears within the type `B`
    |
 LL | struct B {
    |        ^
-   = note: required for the cast from `B` to the object type `dyn Foo + Send`
+   = note: required for the cast from `Box<B>` to `Box<dyn Foo + Send>`
 
 error: aborting due to previous error
 
diff --git a/tests/ui/traits/map-types.stderr b/tests/ui/traits/map-types.stderr
index f685c50b07d..4315056f206 100644
--- a/tests/ui/traits/map-types.stderr
+++ b/tests/ui/traits/map-types.stderr
@@ -5,7 +5,7 @@ LL |     let y: Box<dyn Map<usize, isize>> = Box::new(x);
    |                                         ^^^^^^^^^^^ the trait `Map<usize, isize>` is not implemented for `Box<dyn Map<isize, isize>>`
    |
    = help: the trait `Map<K, V>` is implemented for `HashMap<K, V>`
-   = note: required for the cast from `Box<dyn Map<isize, isize>>` to the object type `dyn Map<usize, isize>`
+   = note: required for the cast from `Box<Box<dyn Map<isize, isize>>>` to `Box<dyn Map<usize, isize>>`
 
 error: aborting due to previous error
 
diff --git a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr
index 6a926534e07..4aefdd6bb07 100644
--- a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr
+++ b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr
@@ -1,5 +1,5 @@
 error[E0277]: `impl Future<Output = ()>` cannot be sent between threads safely
-  --> $DIR/auto-with-drop_tracking_mir.rs:24:13
+  --> $DIR/auto-with-drop_tracking_mir.rs:25:13
    |
 LL |     is_send(foo());
    |     ------- ^^^^^ `impl Future<Output = ()>` cannot be sent between threads safely
@@ -8,7 +8,7 @@ LL |     is_send(foo());
    |
    = help: the trait `Send` is not implemented for `impl Future<Output = ()>`
 note: required by a bound in `is_send`
-  --> $DIR/auto-with-drop_tracking_mir.rs:23:24
+  --> $DIR/auto-with-drop_tracking_mir.rs:24:24
    |
 LL |     fn is_send(_: impl Send) {}
    |                        ^^^^ required by this bound in `is_send`
diff --git a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs
index a5db7c4636b..f115e143318 100644
--- a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs
+++ b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs
@@ -14,6 +14,7 @@ async fn foo() {
     #[cfg(fail)]
     let x = &NotSync;
     bar().await;
+    #[allow(drop_ref)]
     drop(x);
 }
 
diff --git a/tests/ui/traits/new-solver/temporary-ambiguity.rs b/tests/ui/traits/new-solver/temporary-ambiguity.rs
index 18ee0545700..c6c11a1a1de 100644
--- a/tests/ui/traits/new-solver/temporary-ambiguity.rs
+++ b/tests/ui/traits/new-solver/temporary-ambiguity.rs
@@ -18,5 +18,5 @@ fn main() {
     let w = Wrapper(x);
     needs_foo(w);
     x = 1;
-    drop(x);
+    let _ = x;
 }
diff --git a/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr b/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr
index 47fa29b6648..d56519223f4 100644
--- a/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr
+++ b/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr
@@ -20,8 +20,7 @@ LL | trait Foo: for<T> Bar<T> {}
    |       ---  ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables
    |       |
    |       this trait cannot be made into an object...
-   = note: required for `&()` to implement `CoerceUnsized<&dyn Foo>`
-   = note: required by cast to type `&dyn Foo`
+   = note: required for the cast from `&()` to `&dyn Foo`
 
 error[E0038]: the trait `Foo` cannot be made into an object
   --> $DIR/supertrait-object-safety.rs:19:12
diff --git a/tests/ui/traits/object/safety.stderr b/tests/ui/traits/object/safety.stderr
index dc18adeafc7..a51b6975938 100644
--- a/tests/ui/traits/object/safety.stderr
+++ b/tests/ui/traits/object/safety.stderr
@@ -11,8 +11,7 @@ LL | trait Tr {
    |       -- this trait cannot be made into an object...
 LL |     fn foo();
    |        ^^^ ...because associated function `foo` has no `self` parameter
-   = note: required for `&St` to implement `CoerceUnsized<&dyn Tr>`
-   = note: required by cast to type `&dyn Tr`
+   = note: required for the cast from `&St` to `&dyn Tr`
 help: consider turning `foo` into a method by giving it a `&self` argument
    |
 LL |     fn foo(&self);
diff --git a/tests/ui/traits/test-2.stderr b/tests/ui/traits/test-2.stderr
index 6c0e8b8af4b..74a0fc42708 100644
--- a/tests/ui/traits/test-2.stderr
+++ b/tests/ui/traits/test-2.stderr
@@ -76,8 +76,7 @@ LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
    |       this trait cannot be made into an object...
    = help: consider moving `dup` to another trait
    = help: consider moving `blah` to another trait
-   = note: required for `Box<{integer}>` to implement `CoerceUnsized<Box<dyn bar>>`
-   = note: required by cast to type `Box<dyn bar>`
+   = note: required for the cast from `Box<{integer}>` to `Box<dyn bar>`
 
 error: aborting due to 5 previous errors
 
diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-1.stderr b/tests/ui/traits/trait-upcasting/type-checking-test-1.stderr
index fe269d8e99b..82b4e9bd72a 100644
--- a/tests/ui/traits/trait-upcasting/type-checking-test-1.stderr
+++ b/tests/ui/traits/trait-upcasting/type-checking-test-1.stderr
@@ -15,7 +15,7 @@ error[E0277]: the trait bound `&dyn Foo: Bar<_>` is not satisfied
 LL |     let _ = x as &dyn Bar<_>; // Ambiguous
    |             ^ the trait `Bar<_>` is not implemented for `&dyn Foo`
    |
-   = note: required for the cast from `&dyn Foo` to the object type `dyn Bar<_>`
+   = note: required for the cast from `&&dyn Foo` to `&dyn Bar<_>`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-2.stderr b/tests/ui/traits/trait-upcasting/type-checking-test-2.stderr
index ef007d5cb90..856303ef4dd 100644
--- a/tests/ui/traits/trait-upcasting/type-checking-test-2.stderr
+++ b/tests/ui/traits/trait-upcasting/type-checking-test-2.stderr
@@ -15,7 +15,7 @@ error[E0277]: the trait bound `&dyn Foo<i32>: Bar<u32>` is not satisfied
 LL |     let _ = x as &dyn Bar<u32>; // Error
    |             ^ the trait `Bar<u32>` is not implemented for `&dyn Foo<i32>`
    |
-   = note: required for the cast from `&dyn Foo<i32>` to the object type `dyn Bar<u32>`
+   = note: required for the cast from `&&dyn Foo<i32>` to `&dyn Bar<u32>`
 
 error[E0605]: non-primitive cast: `&dyn Foo<u32>` as `&dyn Bar<_>`
   --> $DIR/type-checking-test-2.rs:25:13
@@ -34,7 +34,7 @@ error[E0277]: the trait bound `&dyn Foo<u32>: Bar<_>` is not satisfied
 LL |     let a = x as &dyn Bar<_>; // Ambiguous
    |             ^ the trait `Bar<_>` is not implemented for `&dyn Foo<u32>`
    |
-   = note: required for the cast from `&dyn Foo<u32>` to the object type `dyn Bar<_>`
+   = note: required for the cast from `&&dyn Foo<u32>` to `&dyn Bar<_>`
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs b/tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs
index 3416503b851..6ed7667115a 100644
--- a/tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs
+++ b/tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs
@@ -1,6 +1,8 @@
 // check-pass
 // Check tautalogically false `Copy` bounds
+
 #![feature(trivial_bounds)]
+#![allow(drop_ref, drop_copy)]
 
 fn copy_string(t: String) -> String where String: Copy { //~ WARNING trivial_bounds
     is_copy(&t);
diff --git a/tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy.stderr b/tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy.stderr
index 1e26623899b..deeb352a2a8 100644
--- a/tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy.stderr
+++ b/tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy.stderr
@@ -1,5 +1,5 @@
 warning: trait bound String: Copy does not depend on any type or lifetime parameters
-  --> $DIR/trivial-bounds-inconsistent-copy.rs:5:51
+  --> $DIR/trivial-bounds-inconsistent-copy.rs:7:51
    |
 LL | fn copy_string(t: String) -> String where String: Copy {
    |                                                   ^^^^
@@ -7,19 +7,19 @@ LL | fn copy_string(t: String) -> String where String: Copy {
    = note: `#[warn(trivial_bounds)]` on by default
 
 warning: trait bound String: Copy does not depend on any type or lifetime parameters
-  --> $DIR/trivial-bounds-inconsistent-copy.rs:12:56
+  --> $DIR/trivial-bounds-inconsistent-copy.rs:14:56
    |
 LL | fn copy_out_string(t: &String) -> String where String: Copy {
    |                                                        ^^^^
 
 warning: trait bound String: Copy does not depend on any type or lifetime parameters
-  --> $DIR/trivial-bounds-inconsistent-copy.rs:16:55
+  --> $DIR/trivial-bounds-inconsistent-copy.rs:18:55
    |
 LL | fn copy_string_with_param<T>(x: String) where String: Copy {
    |                                                       ^^^^
 
 warning: trait bound for<'b> &'b mut i32: Copy does not depend on any type or lifetime parameters
-  --> $DIR/trivial-bounds-inconsistent-copy.rs:22:76
+  --> $DIR/trivial-bounds-inconsistent-copy.rs:24:76
    |
 LL | fn copy_mut<'a>(t: &&'a mut i32) -> &'a mut i32 where for<'b> &'b mut i32: Copy {
    |                                                                            ^^^^
diff --git a/tests/ui/type-alias-impl-trait/associated-type-impl-trait-lifetime.rs b/tests/ui/type-alias-impl-trait/associated-type-impl-trait-lifetime.rs
index 551815d021a..58eaa9c2c42 100644
--- a/tests/ui/type-alias-impl-trait/associated-type-impl-trait-lifetime.rs
+++ b/tests/ui/type-alias-impl-trait/associated-type-impl-trait-lifetime.rs
@@ -5,15 +5,16 @@
 trait Trait {
     type Opaque1;
     type Opaque2;
-    fn constrain(self);
+    fn constrain(self) -> (Self::Opaque1, Self::Opaque2);
 }
 
 impl<'a> Trait for &'a () {
     type Opaque1 = impl Sized;
     type Opaque2 = impl Sized + 'a;
-    fn constrain(self) {
-        let _: Self::Opaque1 = ();
-        let _: Self::Opaque2 = self;
+    fn constrain(self) -> (Self::Opaque1, Self::Opaque2) {
+        let a: Self::Opaque1 = ();
+        let b: Self::Opaque2 = self;
+        (a, b)
     }
 }
 
diff --git a/tests/ui/type-alias-impl-trait/invalid_impl_trait_in_assoc_ty.rs b/tests/ui/type-alias-impl-trait/invalid_impl_trait_in_assoc_ty.rs
new file mode 100644
index 00000000000..93c52126d69
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/invalid_impl_trait_in_assoc_ty.rs
@@ -0,0 +1,16 @@
+#![feature(impl_trait_in_assoc_type)]
+
+trait Foo {
+    type Foo;
+    fn bar();
+}
+
+impl Foo for () {
+    type Foo = impl std::fmt::Debug;
+    fn bar() {
+        let x: Self::Foo = ();
+        //~^ ERROR: mismatched types
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/invalid_impl_trait_in_assoc_ty.stderr b/tests/ui/type-alias-impl-trait/invalid_impl_trait_in_assoc_ty.stderr
new file mode 100644
index 00000000000..2beed73cb85
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/invalid_impl_trait_in_assoc_ty.stderr
@@ -0,0 +1,22 @@
+error[E0308]: mismatched types
+  --> $DIR/invalid_impl_trait_in_assoc_ty.rs:11:28
+   |
+LL |     type Foo = impl std::fmt::Debug;
+   |                -------------------- the expected opaque type
+LL |     fn bar() {
+LL |         let x: Self::Foo = ();
+   |                ---------   ^^ expected opaque type, found `()`
+   |                |
+   |                expected due to this
+   |
+   = note: expected opaque type `<() as Foo>::Foo`
+                found unit type `()`
+note: this item must have the opaque type in its signature in order to be able to register hidden types
+  --> $DIR/invalid_impl_trait_in_assoc_ty.rs:10:5
+   |
+LL |     fn bar() {
+   |     ^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/type-alias-impl-trait/issue-98604.stderr b/tests/ui/type-alias-impl-trait/issue-98604.stderr
index fa16d321890..af758d8099f 100644
--- a/tests/ui/type-alias-impl-trait/issue-98604.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-98604.stderr
@@ -4,7 +4,7 @@ error[E0271]: expected `test` to be a fn item that returns `Pin<Box<dyn Future<O
 LL |     Box::new(test) as AsyncFnPtr;
    |     ^^^^^^^^^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found future
    |
-   = note: required for the cast from `fn() -> impl Future<Output = ()> {test}` to the object type `dyn Fn() -> Pin<Box<(dyn Future<Output = ()> + 'static)>>`
+   = note: required for the cast from `Box<fn() -> impl Future<Output = ()> {test}>` to `Box<(dyn Fn() -> Pin<Box<(dyn Future<Output = ()> + 'static)>> + 'static)>`
 
 error: aborting due to previous error
 
diff --git a/tests/ui/type-alias-impl-trait/issue-98608.stderr b/tests/ui/type-alias-impl-trait/issue-98608.stderr
index 506d40cb776..9b651008371 100644
--- a/tests/ui/type-alias-impl-trait/issue-98608.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-98608.stderr
@@ -9,7 +9,7 @@ LL |     let b: Box<dyn Fn() -> Box<u8>> = Box::new(hi);
    |
    = note:   expected struct `Box<u8>`
            found opaque type `impl Sized`
-   = note: required for the cast from `fn() -> impl Sized {hi}` to the object type `dyn Fn() -> Box<u8>`
+   = note: required for the cast from `Box<fn() -> impl Sized {hi}>` to `Box<dyn Fn() -> Box<u8>>`
 
 error: aborting due to previous error
 
diff --git a/tests/ui/type/issue-58355.stderr b/tests/ui/type/issue-58355.stderr
index 6f89a7b0049..67078bcfe89 100644
--- a/tests/ui/type/issue-58355.stderr
+++ b/tests/ui/type/issue-58355.stderr
@@ -6,7 +6,7 @@ LL |     x = Some(Box::new(callback));
    |
    = help: within `fn() -> dyn ToString`, the trait `Sized` is not implemented for `dyn ToString`
    = note: required because it appears within the type `fn() -> dyn ToString`
-   = note: required for the cast from `fn() -> dyn ToString` to the object type `dyn Fn() -> (dyn ToString + 'static)`
+   = note: required for the cast from `Box<fn() -> dyn ToString>` to `Box<dyn Fn() -> (dyn ToString + 'static)>`
 
 error: aborting due to previous error
 
diff --git a/tests/ui/unsized/unsized-fn-param.stderr b/tests/ui/unsized/unsized-fn-param.stderr
index b4772605432..0de3dbbb557 100644
--- a/tests/ui/unsized/unsized-fn-param.stderr
+++ b/tests/ui/unsized/unsized-fn-param.stderr
@@ -5,8 +5,8 @@ LL |     foo11("bar", &"baz");
    |           ^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `Sized` is not implemented for `str`
-   = note: required for the cast from `str` to the object type `dyn AsRef<Path>`
-help: consider borrowing the value, since `&str` can be coerced into `dyn AsRef<Path>`
+   = note: required for the cast from `&'static str` to `&dyn AsRef<Path>`
+help: consider borrowing the value, since `&&'static str` can be coerced into `&dyn AsRef<Path>`
    |
 LL |     foo11(&"bar", &"baz");
    |           +
@@ -18,8 +18,8 @@ LL |     foo12(&"bar", "baz");
    |                   ^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `Sized` is not implemented for `str`
-   = note: required for the cast from `str` to the object type `dyn AsRef<Path>`
-help: consider borrowing the value, since `&str` can be coerced into `dyn AsRef<Path>`
+   = note: required for the cast from `&'static str` to `&dyn AsRef<Path>`
+help: consider borrowing the value, since `&&'static str` can be coerced into `&dyn AsRef<Path>`
    |
 LL |     foo12(&"bar", &"baz");
    |                   +
@@ -31,8 +31,8 @@ LL |     foo21("bar", &"baz");
    |           ^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `Sized` is not implemented for `str`
-   = note: required for the cast from `str` to the object type `dyn AsRef<str>`
-help: consider borrowing the value, since `&str` can be coerced into `dyn AsRef<str>`
+   = note: required for the cast from `&'static str` to `&dyn AsRef<str>`
+help: consider borrowing the value, since `&&'static str` can be coerced into `&dyn AsRef<str>`
    |
 LL |     foo21(&"bar", &"baz");
    |           +
@@ -44,8 +44,8 @@ LL |     foo22(&"bar", "baz");
    |                   ^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `Sized` is not implemented for `str`
-   = note: required for the cast from `str` to the object type `dyn AsRef<str>`
-help: consider borrowing the value, since `&str` can be coerced into `dyn AsRef<str>`
+   = note: required for the cast from `&'static str` to `&dyn AsRef<str>`
+help: consider borrowing the value, since `&&'static str` can be coerced into `&dyn AsRef<str>`
    |
 LL |     foo22(&"bar", &"baz");
    |                   +
diff --git a/tests/ui/wf/wf-convert-unsafe-trait-obj-box.stderr b/tests/ui/wf/wf-convert-unsafe-trait-obj-box.stderr
index 6cf4f33f947..40a25c7df6b 100644
--- a/tests/ui/wf/wf-convert-unsafe-trait-obj-box.stderr
+++ b/tests/ui/wf/wf-convert-unsafe-trait-obj-box.stderr
@@ -11,8 +11,7 @@ LL | trait Trait: Sized {}
    |       -----  ^^^^^ ...because it requires `Self: Sized`
    |       |
    |       this trait cannot be made into an object...
-   = note: required for `Box<S>` to implement `CoerceUnsized<Box<dyn Trait>>`
-   = note: required by cast to type `Box<dyn Trait>`
+   = note: required for the cast from `Box<S>` to `Box<dyn Trait>`
 
 error[E0038]: the trait `Trait` cannot be made into an object
   --> $DIR/wf-convert-unsafe-trait-obj-box.rs:17:15
@@ -27,8 +26,7 @@ LL | trait Trait: Sized {}
    |       -----  ^^^^^ ...because it requires `Self: Sized`
    |       |
    |       this trait cannot be made into an object...
-   = note: required for `Box<S>` to implement `CoerceUnsized<Box<dyn Trait>>`
-   = note: required by cast to type `Box<(dyn Trait + 'static)>`
+   = note: required for the cast from `Box<S>` to `Box<(dyn Trait + 'static)>`
 
 error[E0038]: the trait `Trait` cannot be made into an object
   --> $DIR/wf-convert-unsafe-trait-obj-box.rs:15:5
@@ -43,8 +41,7 @@ LL | trait Trait: Sized {}
    |       -----  ^^^^^ ...because it requires `Self: Sized`
    |       |
    |       this trait cannot be made into an object...
-   = note: required for `Box<S>` to implement `CoerceUnsized<Box<dyn Trait>>`
-   = note: required by cast to type `Box<dyn Trait>`
+   = note: required for the cast from `Box<S>` to `Box<dyn Trait>`
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/wf/wf-convert-unsafe-trait-obj.stderr b/tests/ui/wf/wf-convert-unsafe-trait-obj.stderr
index c9bd4549aaf..e2c71df2feb 100644
--- a/tests/ui/wf/wf-convert-unsafe-trait-obj.stderr
+++ b/tests/ui/wf/wf-convert-unsafe-trait-obj.stderr
@@ -11,8 +11,7 @@ LL | trait Trait: Sized {}
    |       -----  ^^^^^ ...because it requires `Self: Sized`
    |       |
    |       this trait cannot be made into an object...
-   = note: required for `&S` to implement `CoerceUnsized<&dyn Trait>`
-   = note: required by cast to type `&dyn Trait`
+   = note: required for the cast from `&S` to `&dyn Trait`
 
 error[E0038]: the trait `Trait` cannot be made into an object
   --> $DIR/wf-convert-unsafe-trait-obj.rs:17:17
@@ -27,8 +26,7 @@ LL | trait Trait: Sized {}
    |       -----  ^^^^^ ...because it requires `Self: Sized`
    |       |
    |       this trait cannot be made into an object...
-   = note: required for `&S` to implement `CoerceUnsized<&dyn Trait>`
-   = note: required by cast to type `&dyn Trait`
+   = note: required for the cast from `&S` to `&dyn Trait`
 
 error[E0038]: the trait `Trait` cannot be made into an object
   --> $DIR/wf-convert-unsafe-trait-obj.rs:15:5
@@ -43,8 +41,7 @@ LL | trait Trait: Sized {}
    |       -----  ^^^^^ ...because it requires `Self: Sized`
    |       |
    |       this trait cannot be made into an object...
-   = note: required for `&S` to implement `CoerceUnsized<&dyn Trait>`
-   = note: required by cast to type `&dyn Trait`
+   = note: required for the cast from `&S` to `&dyn Trait`
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/wf/wf-unsafe-trait-obj-match.stderr b/tests/ui/wf/wf-unsafe-trait-obj-match.stderr
index d2b41630976..66504e44060 100644
--- a/tests/ui/wf/wf-unsafe-trait-obj-match.stderr
+++ b/tests/ui/wf/wf-unsafe-trait-obj-match.stderr
@@ -25,8 +25,7 @@ LL | trait Trait: Sized {}
    |       -----  ^^^^^ ...because it requires `Self: Sized`
    |       |
    |       this trait cannot be made into an object...
-   = note: required for `&S` to implement `CoerceUnsized<&dyn Trait>`
-   = note: required by cast to type `&dyn Trait`
+   = note: required for the cast from `&S` to `&dyn Trait`
 
 error[E0038]: the trait `Trait` cannot be made into an object
   --> $DIR/wf-unsafe-trait-obj-match.rs:25:25
@@ -45,8 +44,7 @@ LL | trait Trait: Sized {}
    |       -----  ^^^^^ ...because it requires `Self: Sized`
    |       |
    |       this trait cannot be made into an object...
-   = note: required for `&R` to implement `CoerceUnsized<&dyn Trait>`
-   = note: required by cast to type `&dyn Trait`
+   = note: required for the cast from `&R` to `&dyn Trait`
 
 error: aborting due to 3 previous errors