diff options
| author | Camelid <camelidcamel@gmail.com> | 2021-01-10 20:40:47 -0800 |
|---|---|---|
| committer | Camelid <camelidcamel@gmail.com> | 2021-01-18 11:51:18 -0800 |
| commit | a7b7a435ea14cd0d2b83ea8a229e7d9cc4c651f1 (patch) | |
| tree | 308d1951ba8c82828a0a886b8ed8f6a5c7725e97 /src/test/ui/consts | |
| parent | def0e9b8a495fa2a44e1d2cd948f7d4b6d81344f (diff) | |
| download | rust-a7b7a435ea14cd0d2b83ea8a229e7d9cc4c651f1.tar.gz rust-a7b7a435ea14cd0d2b83ea8a229e7d9cc4c651f1.zip | |
Move test to `src/test/ui/consts/`
Apparently `tidy` has a hard limit of 2830 tests in the `src/test/ui/issues/` directory, and this test hit that limit. `src/test/ui/consts/` is probably a better location anyway.
Diffstat (limited to 'src/test/ui/consts')
| -rw-r--r-- | src/test/ui/consts/issue-79690.rs | 29 | ||||
| -rw-r--r-- | src/test/ui/consts/issue-79690.stderr | 11 |
2 files changed, 40 insertions, 0 deletions
diff --git a/src/test/ui/consts/issue-79690.rs b/src/test/ui/consts/issue-79690.rs new file mode 100644 index 00000000000..6a38b3c8c2c --- /dev/null +++ b/src/test/ui/consts/issue-79690.rs @@ -0,0 +1,29 @@ +union Transmute<T: Copy, U: Copy> { + t: T, + u: U, +} +trait Bar { + fn bar(&self) -> u32; +} +struct Foo { + foo: u32, + bar: bool, +} +impl Bar for Foo { + fn bar(&self) -> u32 { + self.foo + } +} +#[derive(Copy, Clone)] +struct Fat<'a>(&'a Foo, &'static VTable); +struct VTable { + size: Foo, +} +const FOO: &dyn Bar = &Foo { + foo: 128, + bar: false, +}; +const G: Fat = unsafe { Transmute { t: FOO }.u }; +//~^ ERROR it is undefined behavior to use this value + +fn main() {} diff --git a/src/test/ui/consts/issue-79690.stderr b/src/test/ui/consts/issue-79690.stderr new file mode 100644 index 00000000000..c7f9c6a55e7 --- /dev/null +++ b/src/test/ui/consts/issue-79690.stderr @@ -0,0 +1,11 @@ +error[E0080]: it is undefined behavior to use this value + --> $DIR/issue-79690.rs:26:1 + | +LL | const G: Fat = unsafe { Transmute { t: FOO }.u }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered read of part of a pointer at .1.<deref>.size.foo + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. |
