about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Wood <david.wood2@arm.com>2025-01-22 18:07:04 +0000
committerDavid Wood <david.wood2@arm.com>2025-06-16 23:04:35 +0000
commit3c3ba37ba57b66ccced0d9c41e1f0c0f48868a20 (patch)
tree2af4a2d2ca0dd1725dd0b1285c184a31eb56f470
parent118d4e62c380a4dfb7a0c53a0001a19d0cee6567 (diff)
downloadrust-3c3ba37ba57b66ccced0d9c41e1f0c0f48868a20.tar.gz
rust-3c3ba37ba57b66ccced0d9c41e1f0c0f48868a20.zip
tests: `PointeeSized` bounds with extern types
These tests necessarily need to change now that `?Sized` is not
sufficient to accept extern types and `PointeeSized` is now necessary. In
addition, the `size_of_val`/`align_of_val` test can now be changed to
expect an error.
-rw-r--r--tests/codegen/dst-offset.rs5
-rw-r--r--tests/ui/consts/const-size_of_val-align_of_val-extern-type.rs6
-rw-r--r--tests/ui/consts/const-size_of_val-align_of_val-extern-type.stderr26
-rw-r--r--tests/ui/extern/extern-type-diag-not-similar.rs7
-rw-r--r--tests/ui/extern/extern-type-diag-not-similar.stderr6
-rw-r--r--tests/ui/extern/extern-types-manual-sync-send.rs8
-rw-r--r--tests/ui/extern/extern-types-not-sync-send.rs8
-rw-r--r--tests/ui/extern/extern-types-not-sync-send.stderr16
-rw-r--r--tests/ui/extern/extern-types-pointer-cast.rs5
-rw-r--r--tests/ui/extern/extern-types-size_of_val.rs16
-rw-r--r--tests/ui/extern/extern-types-size_of_val.stderr39
-rw-r--r--tests/ui/extern/extern-types-thin-pointer.rs7
-rw-r--r--tests/ui/extern/extern-types-trait-impl.rs9
-rw-r--r--tests/ui/offset-of/offset-of-dst-field.rs5
-rw-r--r--tests/ui/offset-of/offset-of-dst-field.stderr20
-rw-r--r--tests/ui/symbol-names/foreign-types.rs5
-rw-r--r--tests/ui/symbol-names/foreign-types.stderr6
-rw-r--r--tests/ui/traits/default_auto_traits/extern-types.current.stderr2
-rw-r--r--tests/ui/traits/default_auto_traits/extern-types.next.stderr2
-rw-r--r--tests/ui/traits/default_auto_traits/extern-types.rs2
20 files changed, 131 insertions, 69 deletions
diff --git a/tests/codegen/dst-offset.rs b/tests/codegen/dst-offset.rs
index 7177a960432..2cf5fa9fac6 100644
--- a/tests/codegen/dst-offset.rs
+++ b/tests/codegen/dst-offset.rs
@@ -3,8 +3,9 @@
 //@ compile-flags: -C no-prepopulate-passes -Copt-level=0
 
 #![crate_type = "lib"]
-#![feature(extern_types)]
+#![feature(extern_types, sized_hierarchy)]
 
+use std::marker::PointeeSized;
 use std::ptr::addr_of;
 
 // Hack to get the correct type for usize
@@ -12,7 +13,7 @@ use std::ptr::addr_of;
 #[no_mangle]
 pub fn helper(_: usize) {}
 
-struct Dst<T: ?Sized> {
+struct Dst<T: PointeeSized> {
     x: u32,
     y: u8,
     z: T,
diff --git a/tests/ui/consts/const-size_of_val-align_of_val-extern-type.rs b/tests/ui/consts/const-size_of_val-align_of_val-extern-type.rs
index 423ff37baef..2372d1c3e3d 100644
--- a/tests/ui/consts/const-size_of_val-align_of_val-extern-type.rs
+++ b/tests/ui/consts/const-size_of_val-align_of_val-extern-type.rs
@@ -7,7 +7,9 @@ extern "C" {
     type Opaque;
 }
 
-const _SIZE: usize = unsafe { size_of_val(&4 as *const i32 as *const Opaque) }; //~ ERROR layout
-const _ALIGN: usize = unsafe { align_of_val(&4 as *const i32 as *const Opaque) }; //~ ERROR layout
+const _SIZE: usize = unsafe { size_of_val(&4 as *const i32 as *const Opaque) };
+//~^ ERROR the size for values of type `Opaque` cannot be known
+const _ALIGN: usize = unsafe { align_of_val(&4 as *const i32 as *const Opaque) };
+//~^ ERROR the size for values of type `Opaque` cannot be known
 
 fn main() {}
diff --git a/tests/ui/consts/const-size_of_val-align_of_val-extern-type.stderr b/tests/ui/consts/const-size_of_val-align_of_val-extern-type.stderr
index c78626bdefc..6d6bc157771 100644
--- a/tests/ui/consts/const-size_of_val-align_of_val-extern-type.stderr
+++ b/tests/ui/consts/const-size_of_val-align_of_val-extern-type.stderr
@@ -1,15 +1,27 @@
-error[E0080]: `extern type` does not have known layout
-  --> $DIR/const-size_of_val-align_of_val-extern-type.rs:10:31
+error[E0277]: the size for values of type `Opaque` cannot be known
+  --> $DIR/const-size_of_val-align_of_val-extern-type.rs:10:43
    |
 LL | const _SIZE: usize = unsafe { size_of_val(&4 as *const i32 as *const Opaque) };
-   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_SIZE` failed here
+   |                               ----------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a known size
+   |                               |
+   |                               required by a bound introduced by this call
+   |
+   = help: the trait `MetaSized` is not implemented for `Opaque`
+note: required by a bound in `std::intrinsics::size_of_val`
+  --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL
 
-error[E0080]: `extern type` does not have known layout
-  --> $DIR/const-size_of_val-align_of_val-extern-type.rs:11:32
+error[E0277]: the size for values of type `Opaque` cannot be known
+  --> $DIR/const-size_of_val-align_of_val-extern-type.rs:12:45
    |
 LL | const _ALIGN: usize = unsafe { align_of_val(&4 as *const i32 as *const Opaque) };
-   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_ALIGN` failed here
+   |                                ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a known size
+   |                                |
+   |                                required by a bound introduced by this call
+   |
+   = help: the trait `MetaSized` is not implemented for `Opaque`
+note: required by a bound in `std::intrinsics::align_of_val`
+  --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL
 
 error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0080`.
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/extern/extern-type-diag-not-similar.rs b/tests/ui/extern/extern-type-diag-not-similar.rs
index cd3eec9f1f7..21a2a20a644 100644
--- a/tests/ui/extern/extern-type-diag-not-similar.rs
+++ b/tests/ui/extern/extern-type-diag-not-similar.rs
@@ -3,7 +3,10 @@
 // Two extern types shouldn't really be considered similar just
 // because they are both extern types.
 
-#![feature(extern_types)]
+#![feature(extern_types, sized_hierarchy)]
+
+use std::marker::PointeeSized;
+
 extern "C" {
     type ShouldNotBeMentioned;
 }
@@ -14,7 +17,7 @@ extern "C" {
 
 unsafe impl Send for ShouldNotBeMentioned {}
 
-fn assert_send<T: Send + ?Sized>() {}
+fn assert_send<T: Send + PointeeSized>() {}
 
 fn main() {
     assert_send::<Foo>()
diff --git a/tests/ui/extern/extern-type-diag-not-similar.stderr b/tests/ui/extern/extern-type-diag-not-similar.stderr
index 3547f9b3ff6..f85ff1eead6 100644
--- a/tests/ui/extern/extern-type-diag-not-similar.stderr
+++ b/tests/ui/extern/extern-type-diag-not-similar.stderr
@@ -1,14 +1,14 @@
 error[E0277]: `Foo` cannot be sent between threads safely
-  --> $DIR/extern-type-diag-not-similar.rs:20:19
+  --> $DIR/extern-type-diag-not-similar.rs:23:19
    |
 LL |     assert_send::<Foo>()
    |                   ^^^ `Foo` cannot be sent between threads safely
    |
    = help: the trait `Send` is not implemented for `Foo`
 note: required by a bound in `assert_send`
-  --> $DIR/extern-type-diag-not-similar.rs:17:19
+  --> $DIR/extern-type-diag-not-similar.rs:20:19
    |
-LL | fn assert_send<T: Send + ?Sized>() {}
+LL | fn assert_send<T: Send + PointeeSized>() {}
    |                   ^^^^ required by this bound in `assert_send`
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/extern/extern-types-manual-sync-send.rs b/tests/ui/extern/extern-types-manual-sync-send.rs
index 2df0cd4c923..b273dcea722 100644
--- a/tests/ui/extern/extern-types-manual-sync-send.rs
+++ b/tests/ui/extern/extern-types-manual-sync-send.rs
@@ -1,7 +1,9 @@
 //@ run-pass
 // Test that unsafe impl for Sync/Send can be provided for extern types.
 
-#![feature(extern_types)]
+#![feature(extern_types, sized_hierarchy)]
+
+use std::marker::PointeeSized;
 
 extern "C" {
     type A;
@@ -10,8 +12,8 @@ extern "C" {
 unsafe impl Sync for A {}
 unsafe impl Send for A {}
 
-fn assert_sync<T: ?Sized + Sync>() {}
-fn assert_send<T: ?Sized + Send>() {}
+fn assert_sync<T: PointeeSized + Sync>() {}
+fn assert_send<T: PointeeSized + Send>() {}
 
 fn main() {
     assert_sync::<A>();
diff --git a/tests/ui/extern/extern-types-not-sync-send.rs b/tests/ui/extern/extern-types-not-sync-send.rs
index ba82caced7a..3cac1aabea9 100644
--- a/tests/ui/extern/extern-types-not-sync-send.rs
+++ b/tests/ui/extern/extern-types-not-sync-send.rs
@@ -1,13 +1,15 @@
 // Make sure extern types are !Sync and !Send.
 
-#![feature(extern_types)]
+#![feature(extern_types, sized_hierarchy)]
+
+use std::marker::PointeeSized;
 
 extern "C" {
     type A;
 }
 
-fn assert_sync<T: ?Sized + Sync>() {}
-fn assert_send<T: ?Sized + Send>() {}
+fn assert_sync<T: PointeeSized + Sync>() {}
+fn assert_send<T: PointeeSized + Send>() {}
 
 fn main() {
     assert_sync::<A>();
diff --git a/tests/ui/extern/extern-types-not-sync-send.stderr b/tests/ui/extern/extern-types-not-sync-send.stderr
index 7865ddeda34..56bdd5be7cf 100644
--- a/tests/ui/extern/extern-types-not-sync-send.stderr
+++ b/tests/ui/extern/extern-types-not-sync-send.stderr
@@ -1,28 +1,28 @@
 error[E0277]: `A` cannot be shared between threads safely
-  --> $DIR/extern-types-not-sync-send.rs:13:19
+  --> $DIR/extern-types-not-sync-send.rs:15:19
    |
 LL |     assert_sync::<A>();
    |                   ^ `A` cannot be shared between threads safely
    |
    = help: the trait `Sync` is not implemented for `A`
 note: required by a bound in `assert_sync`
-  --> $DIR/extern-types-not-sync-send.rs:9:28
+  --> $DIR/extern-types-not-sync-send.rs:11:34
    |
-LL | fn assert_sync<T: ?Sized + Sync>() {}
-   |                            ^^^^ required by this bound in `assert_sync`
+LL | fn assert_sync<T: PointeeSized + Sync>() {}
+   |                                  ^^^^ required by this bound in `assert_sync`
 
 error[E0277]: `A` cannot be sent between threads safely
-  --> $DIR/extern-types-not-sync-send.rs:16:19
+  --> $DIR/extern-types-not-sync-send.rs:18:19
    |
 LL |     assert_send::<A>();
    |                   ^ `A` cannot be sent between threads safely
    |
    = help: the trait `Send` is not implemented for `A`
 note: required by a bound in `assert_send`
-  --> $DIR/extern-types-not-sync-send.rs:10:28
+  --> $DIR/extern-types-not-sync-send.rs:12:34
    |
-LL | fn assert_send<T: ?Sized + Send>() {}
-   |                            ^^^^ required by this bound in `assert_send`
+LL | fn assert_send<T: PointeeSized + Send>() {}
+   |                                  ^^^^ required by this bound in `assert_send`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/extern/extern-types-pointer-cast.rs b/tests/ui/extern/extern-types-pointer-cast.rs
index 78dbee77b9c..080ed91a632 100644
--- a/tests/ui/extern/extern-types-pointer-cast.rs
+++ b/tests/ui/extern/extern-types-pointer-cast.rs
@@ -2,7 +2,8 @@
 #![allow(dead_code)]
 // Test that pointers to extern types can be cast from/to usize,
 // despite being !Sized.
-#![feature(extern_types)]
+#![feature(extern_types, sized_hierarchy)]
+use std::marker::PointeeSized;
 
 extern "C" {
     type A;
@@ -13,7 +14,7 @@ struct Foo {
     tail: A,
 }
 
-struct Bar<T: ?Sized> {
+struct Bar<T: PointeeSized> {
     x: u8,
     tail: T,
 }
diff --git a/tests/ui/extern/extern-types-size_of_val.rs b/tests/ui/extern/extern-types-size_of_val.rs
index 399a5828ff3..3ff51b9b6b0 100644
--- a/tests/ui/extern/extern-types-size_of_val.rs
+++ b/tests/ui/extern/extern-types-size_of_val.rs
@@ -1,8 +1,4 @@
-//@ run-fail
-//@ check-run-results
-//@ exec-env:RUST_BACKTRACE=0
-//@ normalize-stderr: "(core/src/panicking\.rs):[0-9]+:[0-9]+" -> "$1:$$LINE:$$COL"
-//@ revisions: size align
+//@ check-fail
 #![feature(extern_types)]
 
 use std::mem::{align_of_val, size_of_val};
@@ -14,10 +10,8 @@ extern "C" {
 fn main() {
     let x: &A = unsafe { &*(1usize as *const A) };
 
-    // These don't have a dynamic size, so this should panic.
-    if cfg!(size) {
-        assert_eq!(size_of_val(x), 0);
-    } else {
-        assert_eq!(align_of_val(x), 1);
-    }
+    size_of_val(x);
+    //~^ ERROR the size for values of type `A` cannot be known
+    align_of_val(x);
+    //~^ ERROR the size for values of type `A` cannot be known
 }
diff --git a/tests/ui/extern/extern-types-size_of_val.stderr b/tests/ui/extern/extern-types-size_of_val.stderr
new file mode 100644
index 00000000000..8678c6c3d60
--- /dev/null
+++ b/tests/ui/extern/extern-types-size_of_val.stderr
@@ -0,0 +1,39 @@
+error[E0277]: the size for values of type `A` cannot be known
+  --> $DIR/extern-types-size_of_val.rs:13:17
+   |
+LL |     size_of_val(x);
+   |     ----------- ^ the trait `MetaSized` is not implemented for `A`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = note: the trait bound `A: MetaSized` is not satisfied
+note: required by a bound in `std::mem::size_of_val`
+  --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
+help: consider borrowing here
+   |
+LL |     size_of_val(&x);
+   |                 +
+LL |     size_of_val(&mut x);
+   |                 ++++
+
+error[E0277]: the size for values of type `A` cannot be known
+  --> $DIR/extern-types-size_of_val.rs:15:18
+   |
+LL |     align_of_val(x);
+   |     ------------ ^ the trait `MetaSized` is not implemented for `A`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = note: the trait bound `A: MetaSized` is not satisfied
+note: required by a bound in `std::mem::align_of_val`
+  --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
+help: consider borrowing here
+   |
+LL |     align_of_val(&x);
+   |                  +
+LL |     align_of_val(&mut x);
+   |                  ++++
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/extern/extern-types-thin-pointer.rs b/tests/ui/extern/extern-types-thin-pointer.rs
index 8e5911228b2..15777d456c2 100644
--- a/tests/ui/extern/extern-types-thin-pointer.rs
+++ b/tests/ui/extern/extern-types-thin-pointer.rs
@@ -2,8 +2,9 @@
 #![allow(dead_code)]
 // Test that pointers and references to extern types are thin, ie they have the same size and
 // alignment as a pointer to ().
-#![feature(extern_types)]
+#![feature(extern_types, sized_hierarchy)]
 
+use std::marker::PointeeSized;
 use std::mem::{align_of, size_of};
 
 extern "C" {
@@ -15,12 +16,12 @@ struct Foo {
     tail: A,
 }
 
-struct Bar<T: ?Sized> {
+struct Bar<T: PointeeSized> {
     x: u8,
     tail: T,
 }
 
-fn assert_thin<T: ?Sized>() {
+fn assert_thin<T: PointeeSized>() {
     assert_eq!(size_of::<*const T>(), size_of::<*const ()>());
     assert_eq!(align_of::<*const T>(), align_of::<*const ()>());
 
diff --git a/tests/ui/extern/extern-types-trait-impl.rs b/tests/ui/extern/extern-types-trait-impl.rs
index 44300b10514..07cb1efa801 100644
--- a/tests/ui/extern/extern-types-trait-impl.rs
+++ b/tests/ui/extern/extern-types-trait-impl.rs
@@ -1,13 +1,14 @@
 //@ run-pass
 #![allow(dead_code)]
 // Test that traits can be implemented for extern types.
-#![feature(extern_types)]
+#![feature(extern_types, sized_hierarchy)]
+use std::marker::PointeeSized;
 
 extern "C" {
     type A;
 }
 
-trait Foo {
+trait Foo: PointeeSized {
     fn foo(&self) {}
 }
 
@@ -15,9 +16,9 @@ impl Foo for A {
     fn foo(&self) {}
 }
 
-fn assert_foo<T: ?Sized + Foo>() {}
+fn assert_foo<T: PointeeSized + Foo>() {}
 
-fn use_foo<T: ?Sized + Foo>(x: &dyn Foo) {
+fn use_foo<T: PointeeSized + Foo>(x: &dyn Foo) {
     x.foo();
 }
 
diff --git a/tests/ui/offset-of/offset-of-dst-field.rs b/tests/ui/offset-of/offset-of-dst-field.rs
index 2e0bdb151e1..575a66fe302 100644
--- a/tests/ui/offset-of/offset-of-dst-field.rs
+++ b/tests/ui/offset-of/offset-of-dst-field.rs
@@ -1,5 +1,6 @@
-#![feature(extern_types)]
+#![feature(extern_types, sized_hierarchy)]
 
+use std::marker::PointeeSized;
 use std::mem::offset_of;
 
 struct Alpha {
@@ -26,7 +27,7 @@ struct Gamma {
     z: Extern,
 }
 
-struct Delta<T: ?Sized> {
+struct Delta<T: PointeeSized> {
     x: u8,
     y: u16,
     z: T,
diff --git a/tests/ui/offset-of/offset-of-dst-field.stderr b/tests/ui/offset-of/offset-of-dst-field.stderr
index 714bf7a0266..0953e86e222 100644
--- a/tests/ui/offset-of/offset-of-dst-field.stderr
+++ b/tests/ui/offset-of/offset-of-dst-field.stderr
@@ -1,5 +1,5 @@
 error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
-  --> $DIR/offset-of-dst-field.rs:36:5
+  --> $DIR/offset-of-dst-field.rs:37:5
    |
 LL |     offset_of!(Alpha, z);
    |     ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
@@ -8,7 +8,7 @@ LL |     offset_of!(Alpha, z);
    = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time
-  --> $DIR/offset-of-dst-field.rs:37:5
+  --> $DIR/offset-of-dst-field.rs:38:5
    |
 LL |     offset_of!(Beta, z);
    |     ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
@@ -17,7 +17,7 @@ LL |     offset_of!(Beta, z);
    = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the size for values of type `Extern` cannot be known at compilation time
-  --> $DIR/offset-of-dst-field.rs:38:5
+  --> $DIR/offset-of-dst-field.rs:39:5
    |
 LL |     offset_of!(Gamma, z);
    |     ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
@@ -26,7 +26,7 @@ LL |     offset_of!(Gamma, z);
    = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
-  --> $DIR/offset-of-dst-field.rs:40:5
+  --> $DIR/offset-of-dst-field.rs:41:5
    |
 LL |     offset_of!((u8, dyn Trait), 1);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
@@ -35,7 +35,7 @@ LL |     offset_of!((u8, dyn Trait), 1);
    = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the size for values of type `Extern` cannot be known at compilation time
-  --> $DIR/offset-of-dst-field.rs:45:5
+  --> $DIR/offset-of-dst-field.rs:46:5
    |
 LL |     offset_of!(Delta<Extern>, z);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
@@ -44,7 +44,7 @@ LL |     offset_of!(Delta<Extern>, z);
    = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
-  --> $DIR/offset-of-dst-field.rs:46:5
+  --> $DIR/offset-of-dst-field.rs:47:5
    |
 LL |     offset_of!(Delta<dyn Trait>, z);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
@@ -53,21 +53,21 @@ LL |     offset_of!(Delta<dyn Trait>, z);
    = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
-  --> $DIR/offset-of-dst-field.rs:44:5
+  --> $DIR/offset-of-dst-field.rs:45:5
    |
 LL |     offset_of!(Delta<Alpha>, z);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
    |
    = help: within `Alpha`, the trait `Sized` is not implemented for `[u8]`
 note: required because it appears within the type `Alpha`
-  --> $DIR/offset-of-dst-field.rs:5:8
+  --> $DIR/offset-of-dst-field.rs:6:8
    |
 LL | struct Alpha {
    |        ^^^^^
    = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the size for values of type `T` cannot be known at compilation time
-  --> $DIR/offset-of-dst-field.rs:50:5
+  --> $DIR/offset-of-dst-field.rs:51:5
    |
 LL | fn generic_with_maybe_sized<T: ?Sized>() -> usize {
    |                             - this type parameter needs to be `Sized`
@@ -82,7 +82,7 @@ LL + fn generic_with_maybe_sized<T>() -> usize {
    |
 
 error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
-  --> $DIR/offset-of-dst-field.rs:54:16
+  --> $DIR/offset-of-dst-field.rs:55:16
    |
 LL |     offset_of!(([u8], u8), 1);
    |                ^^^^^^^^^^ doesn't have a size known at compile-time
diff --git a/tests/ui/symbol-names/foreign-types.rs b/tests/ui/symbol-names/foreign-types.rs
index 2a9aadfcb83..b863e8c1759 100644
--- a/tests/ui/symbol-names/foreign-types.rs
+++ b/tests/ui/symbol-names/foreign-types.rs
@@ -2,13 +2,16 @@
 //@ compile-flags: -C symbol-mangling-version=v0
 
 #![feature(extern_types)]
+#![feature(sized_hierarchy)]
 #![feature(rustc_attrs)]
 
+use std::marker::PointeeSized;
+
 extern "C" {
     type ForeignType;
 }
 
-struct Check<T: ?Sized>(T);
+struct Check<T: PointeeSized>(T);
 
 #[rustc_symbol_name]
 //~^ ERROR symbol-name(_RMCs
diff --git a/tests/ui/symbol-names/foreign-types.stderr b/tests/ui/symbol-names/foreign-types.stderr
index 63044991485..4640ceae811 100644
--- a/tests/ui/symbol-names/foreign-types.stderr
+++ b/tests/ui/symbol-names/foreign-types.stderr
@@ -1,17 +1,17 @@
 error: symbol-name(_RMCsCRATE_HASH_13foreign_typesINtB<REF>_5CheckNtB<REF>_11ForeignTypeE)
-  --> $DIR/foreign-types.rs:13:1
+  --> $DIR/foreign-types.rs:16:1
    |
 LL | #[rustc_symbol_name]
    | ^^^^^^^^^^^^^^^^^^^^
 
 error: demangling(<foreign_types[fcdd87e190ad88e3]::Check<foreign_types[fcdd87e190ad88e3]::ForeignType>>)
-  --> $DIR/foreign-types.rs:13:1
+  --> $DIR/foreign-types.rs:16:1
    |
 LL | #[rustc_symbol_name]
    | ^^^^^^^^^^^^^^^^^^^^
 
 error: demangling-alt(<foreign_types::Check<foreign_types::ForeignType>>)
-  --> $DIR/foreign-types.rs:13:1
+  --> $DIR/foreign-types.rs:16:1
    |
 LL | #[rustc_symbol_name]
    | ^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/traits/default_auto_traits/extern-types.current.stderr b/tests/ui/traits/default_auto_traits/extern-types.current.stderr
index 4fa4eb2762e..593204382e3 100644
--- a/tests/ui/traits/default_auto_traits/extern-types.current.stderr
+++ b/tests/ui/traits/default_auto_traits/extern-types.current.stderr
@@ -9,7 +9,7 @@ LL |         foo(x);
 note: required by a bound in `foo`
   --> $DIR/extern-types.rs:26:8
    |
-LL | fn foo<T: ?Sized>(_: &T) {}
+LL | fn foo<T: PointeeSized>(_: &T) {}
    |        ^ required by this bound in `foo`
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/traits/default_auto_traits/extern-types.next.stderr b/tests/ui/traits/default_auto_traits/extern-types.next.stderr
index 4fa4eb2762e..593204382e3 100644
--- a/tests/ui/traits/default_auto_traits/extern-types.next.stderr
+++ b/tests/ui/traits/default_auto_traits/extern-types.next.stderr
@@ -9,7 +9,7 @@ LL |         foo(x);
 note: required by a bound in `foo`
   --> $DIR/extern-types.rs:26:8
    |
-LL | fn foo<T: ?Sized>(_: &T) {}
+LL | fn foo<T: PointeeSized>(_: &T) {}
    |        ^ required by this bound in `foo`
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/traits/default_auto_traits/extern-types.rs b/tests/ui/traits/default_auto_traits/extern-types.rs
index 83e37583b91..df106d83171 100644
--- a/tests/ui/traits/default_auto_traits/extern-types.rs
+++ b/tests/ui/traits/default_auto_traits/extern-types.rs
@@ -23,7 +23,7 @@ pub trait Copy {}
 auto trait Leak {}
 
 // implicit T: Leak here
-fn foo<T: ?Sized>(_: &T) {}
+fn foo<T: PointeeSized>(_: &T) {}
 
 mod extern_leak {
     use crate::*;