about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJonas Schievink <jonasschievink@gmail.com>2021-01-23 20:16:04 +0100
committerGitHub <noreply@github.com>2021-01-23 20:16:04 +0100
commit3a3470bf0440807c4d33d5cf7b074ccbf82959b6 (patch)
treeecf248071796afc553cc7b390e89f36a2b8d1918 /src
parent05a95a43726ff741339205ed4e3fcc0b9b39d415 (diff)
parente3faeb486a962d19e1f533a206511b669aced988 (diff)
downloadrust-3a3470bf0440807c4d33d5cf7b074ccbf82959b6.tar.gz
rust-3a3470bf0440807c4d33d5cf7b074ccbf82959b6.zip
Rollup merge of #81243 - osa1:fix_80742_2, r=RalfJung
mir: Improve size_of handling when arg is unsized

As discussed on Zulip with `@RalfJung.`
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/mir/issue-80742.stderr34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/test/ui/mir/issue-80742.stderr b/src/test/ui/mir/issue-80742.stderr
index 2ec0e950528..26f9c786ba1 100644
--- a/src/test/ui/mir/issue-80742.stderr
+++ b/src/test/ui/mir/issue-80742.stderr
@@ -1,3 +1,17 @@
+error[E0080]: evaluation of constant value failed
+  --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
+   |
+LL |     intrinsics::size_of::<T>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |     |
+   |     size_of called on unsized type `dyn Debug`
+   |     inside `std::mem::size_of::<dyn Debug>` at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+   | 
+  ::: $DIR/issue-80742.rs:23:10
+   |
+LL |     [u8; size_of::<T>() + 1]: ,
+   |          -------------- inside `Inline::<dyn Debug>::{constant#0}` at $DIR/issue-80742.rs:23:10
+
 error[E0599]: no function or associated item named `new` found for struct `Inline<dyn Debug>` in the current scope
   --> $DIR/issue-80742.rs:31:36
    |
@@ -21,6 +35,20 @@ LL |   pub trait Debug {
    = note: the method `new` exists but the following trait bounds were not satisfied:
            `dyn Debug: Sized`
 
+error[E0080]: evaluation of constant value failed
+  --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
+   |
+LL |     intrinsics::size_of::<T>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |     |
+   |     size_of called on unsized type `dyn Debug`
+   |     inside `std::mem::size_of::<dyn Debug>` at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+   | 
+  ::: $DIR/issue-80742.rs:15:10
+   |
+LL |     [u8; size_of::<T>() + 1]: ,
+   |          -------------- inside `Inline::<dyn Debug>::{constant#0}` at $DIR/issue-80742.rs:15:10
+
 error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time
   --> $DIR/issue-80742.rs:31:15
    |
@@ -36,7 +64,7 @@ help: consider relaxing the implicit `Sized` restriction
 LL | struct Inline<T: ?Sized>
    |                ^^^^^^^^
 
-error: aborting due to 2 previous errors
+error: aborting due to 4 previous errors
 
-Some errors have detailed explanations: E0277, E0599.
-For more information about an error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0080, E0277, E0599.
+For more information about an error, try `rustc --explain E0080`.