about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0161.md26
-rw-r--r--src/test/ui/error-codes/E0161.edition.stderr8
-rw-r--r--src/test/ui/error-codes/E0161.editionul.stderr9
-rw-r--r--src/test/ui/error-codes/E0161.migrate.stderr8
-rw-r--r--src/test/ui/error-codes/E0161.migrateul.stderr9
-rw-r--r--src/test/ui/error-codes/E0161.nll.stderr8
-rw-r--r--src/test/ui/error-codes/E0161.nllul.stderr9
-rw-r--r--src/test/ui/error-codes/E0161.rs14
-rw-r--r--src/test/ui/error-codes/E0161.zflags.stderr8
-rw-r--r--src/test/ui/error-codes/E0161.zflagsul.stderr9
10 files changed, 47 insertions, 61 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0161.md b/compiler/rustc_error_codes/src/error_codes/E0161.md
index c2e2f0240f4..ebd2c97698b 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0161.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0161.md
@@ -4,11 +4,18 @@ Erroneous code example:
 
 ```compile_fail,E0161
 #![feature(box_syntax)]
+trait Bar {
+    fn f(self);
+}
+
+impl Bar for i32 {
+    fn f(self) {}
+}
 
 fn main() {
-    let array: &[isize] = &[1, 2, 3];
-    let _x: Box<[isize]> = box *array;
-    // error: cannot move a value of type [isize]: the size of [isize] cannot
+    let b: Box<dyn Bar> = box (0 as i32);
+    b.f();
+    // error: cannot move a value of type dyn Bar: the size of dyn Bar cannot
     //        be statically determined
 }
 ```
@@ -22,8 +29,17 @@ it around as usual. Example:
 ```
 #![feature(box_syntax)]
 
+trait Bar {
+    fn f(&self);
+}
+
+impl Bar for i32 {
+    fn f(&self) {}
+}
+
 fn main() {
-    let array: &[isize] = &[1, 2, 3];
-    let _x: Box<&[isize]> = box array; // ok!
+    let b: Box<dyn Bar> = box (0 as i32);
+    b.f();
+    // ok!
 }
 ```
diff --git a/src/test/ui/error-codes/E0161.edition.stderr b/src/test/ui/error-codes/E0161.edition.stderr
index 536a81a4bc6..6beb29c57d5 100644
--- a/src/test/ui/error-codes/E0161.edition.stderr
+++ b/src/test/ui/error-codes/E0161.edition.stderr
@@ -1,8 +1,8 @@
-error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
-  --> $DIR/E0161.rs:22:9
+error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be statically determined
+  --> $DIR/E0161.rs:29:5
    |
-LL |     box *x;
-   |         ^^
+LL |     x.f();
+   |     ^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/error-codes/E0161.editionul.stderr b/src/test/ui/error-codes/E0161.editionul.stderr
deleted file mode 100644
index 2baba998f12..00000000000
--- a/src/test/ui/error-codes/E0161.editionul.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
-  --> $DIR/E0161.rs:22:5
-   |
-LL |     box *x;
-   |     ^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0161`.
diff --git a/src/test/ui/error-codes/E0161.migrate.stderr b/src/test/ui/error-codes/E0161.migrate.stderr
index 536a81a4bc6..6beb29c57d5 100644
--- a/src/test/ui/error-codes/E0161.migrate.stderr
+++ b/src/test/ui/error-codes/E0161.migrate.stderr
@@ -1,8 +1,8 @@
-error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
-  --> $DIR/E0161.rs:22:9
+error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be statically determined
+  --> $DIR/E0161.rs:29:5
    |
-LL |     box *x;
-   |         ^^
+LL |     x.f();
+   |     ^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/error-codes/E0161.migrateul.stderr b/src/test/ui/error-codes/E0161.migrateul.stderr
deleted file mode 100644
index 2baba998f12..00000000000
--- a/src/test/ui/error-codes/E0161.migrateul.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
-  --> $DIR/E0161.rs:22:5
-   |
-LL |     box *x;
-   |     ^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0161`.
diff --git a/src/test/ui/error-codes/E0161.nll.stderr b/src/test/ui/error-codes/E0161.nll.stderr
index 536a81a4bc6..6beb29c57d5 100644
--- a/src/test/ui/error-codes/E0161.nll.stderr
+++ b/src/test/ui/error-codes/E0161.nll.stderr
@@ -1,8 +1,8 @@
-error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
-  --> $DIR/E0161.rs:22:9
+error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be statically determined
+  --> $DIR/E0161.rs:29:5
    |
-LL |     box *x;
-   |         ^^
+LL |     x.f();
+   |     ^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/error-codes/E0161.nllul.stderr b/src/test/ui/error-codes/E0161.nllul.stderr
deleted file mode 100644
index 2baba998f12..00000000000
--- a/src/test/ui/error-codes/E0161.nllul.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
-  --> $DIR/E0161.rs:22:5
-   |
-LL |     box *x;
-   |     ^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0161`.
diff --git a/src/test/ui/error-codes/E0161.rs b/src/test/ui/error-codes/E0161.rs
index e0f5776424e..ba74529e4b6 100644
--- a/src/test/ui/error-codes/E0161.rs
+++ b/src/test/ui/error-codes/E0161.rs
@@ -8,6 +8,10 @@
 //[edition]edition:2018
 //[zflagsul]compile-flags: -Z borrowck=migrate
 //[editionul]edition:2018
+//[migrateul] check-pass
+//[nllul] check-pass
+//[zflagsul] check-pass
+//[editionul] check-pass
 
 #![allow(incomplete_features)]
 #![cfg_attr(nll, feature(nll))]
@@ -16,12 +20,14 @@
 #![cfg_attr(zflagsul, feature(unsized_locals))]
 #![cfg_attr(nllul, feature(unsized_locals))]
 #![cfg_attr(editionul, feature(unsized_locals))]
-#![feature(box_syntax)]
 
-fn foo(x: Box<[i32]>) {
-    box *x;
+trait Bar {
+    fn f(self);
+}
+
+fn foo(x: Box<dyn Bar>) {
+    x.f();
     //[migrate,nll,zflags,edition]~^ ERROR E0161
-    //[migrateul,nllul,zflagsul,editionul]~^^ ERROR E0161
 }
 
 fn main() {}
diff --git a/src/test/ui/error-codes/E0161.zflags.stderr b/src/test/ui/error-codes/E0161.zflags.stderr
index 536a81a4bc6..6beb29c57d5 100644
--- a/src/test/ui/error-codes/E0161.zflags.stderr
+++ b/src/test/ui/error-codes/E0161.zflags.stderr
@@ -1,8 +1,8 @@
-error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
-  --> $DIR/E0161.rs:22:9
+error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be statically determined
+  --> $DIR/E0161.rs:29:5
    |
-LL |     box *x;
-   |         ^^
+LL |     x.f();
+   |     ^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/error-codes/E0161.zflagsul.stderr b/src/test/ui/error-codes/E0161.zflagsul.stderr
deleted file mode 100644
index 2baba998f12..00000000000
--- a/src/test/ui/error-codes/E0161.zflagsul.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined
-  --> $DIR/E0161.rs:22:5
-   |
-LL |     box *x;
-   |     ^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0161`.