about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-11-15 22:26:28 +0000
committerMichael Goulet <michael@errs.io>2022-11-18 18:23:48 +0000
commitb3da04aa52d6e36d7db8666db9aeeaec316f1cc9 (patch)
tree1df8059392d817dba2b0b9526d96f93dcaf7da64 /src
parentda3c5397a614f790f0daaf61bfdc692b36719e01 (diff)
Check both align and size in PointerSized
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/dyn-star/align.normal.stderr11
-rw-r--r--src/test/ui/dyn-star/align.over_aligned.stderr20
-rw-r--r--src/test/ui/dyn-star/align.rs17
3 files changed, 48 insertions, 0 deletions
diff --git a/src/test/ui/dyn-star/align.normal.stderr b/src/test/ui/dyn-star/align.normal.stderr
new file mode 100644
index 00000000000..983d7bf6e7e
--- /dev/null
+++ b/src/test/ui/dyn-star/align.normal.stderr
@@ -0,0 +1,11 @@
+warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
+  --> $DIR/align.rs:4:12
+   |
+LL | #![feature(dyn_star)]
+   |            ^^^^^^^^
+   |
+   = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+   = note: `#[warn(incomplete_features)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/src/test/ui/dyn-star/align.over_aligned.stderr b/src/test/ui/dyn-star/align.over_aligned.stderr
new file mode 100644
index 00000000000..6b6fc55d805
--- /dev/null
+++ b/src/test/ui/dyn-star/align.over_aligned.stderr
@@ -0,0 +1,20 @@
+warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
+  --> $DIR/align.rs:4:12
+   |
+LL | #![feature(dyn_star)]
+   |            ^^^^^^^^
+   |
+   = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+   = note: `#[warn(incomplete_features)]` on by default
+
+error[E0277]: `AlignedUsize` needs to be a pointer-sized type
+  --> $DIR/align.rs:15:13
+   |
+LL |     let x = AlignedUsize(12) as dyn* Debug;
+   |             ^^^^^^^^^^^^^^^^ `AlignedUsize` needs to be a pointer-sized type
+   |
+   = help: the trait `PointerSized` is not implemented for `AlignedUsize`
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/dyn-star/align.rs b/src/test/ui/dyn-star/align.rs
new file mode 100644
index 00000000000..fb41a05a066
--- /dev/null
+++ b/src/test/ui/dyn-star/align.rs
@@ -0,0 +1,17 @@
+// revisions: normal over_aligned
+//[normal] check-pass
+
+#![feature(dyn_star)]
+//~^ WARN the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
+
+use std::fmt::Debug;
+
+#[cfg_attr(over_aligned,      repr(C, align(1024)))]
+#[cfg_attr(not(over_aligned), repr(C))]
+#[derive(Debug)]
+struct AlignedUsize(usize);
+
+fn main() {
+    let x = AlignedUsize(12) as dyn* Debug;
+    //[over_aligned]~^ ERROR `AlignedUsize` needs to be a pointer-sized type
+}