about summary refs log tree commit diff
path: root/tests/ui/error-codes
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-02-09 12:17:55 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-02-14 11:00:30 +0000
commit5f6390f947373528355d30a276ede65d92baaa57 (patch)
treecfccfb4047807d2dcf9aa0192ebae291d30f040e /tests/ui/error-codes
parentbb89df6903539e7014b8db29bccd6a9ee9553122 (diff)
downloadrust-5f6390f947373528355d30a276ede65d92baaa57.tar.gz
rust-5f6390f947373528355d30a276ede65d92baaa57.zip
Continue compilation after check_mod_type_wf errors
Diffstat (limited to 'tests/ui/error-codes')
-rw-r--r--tests/ui/error-codes/E0038.rs2
-rw-r--r--tests/ui/error-codes/E0038.stderr30
-rw-r--r--tests/ui/error-codes/E0059.rs2
-rw-r--r--tests/ui/error-codes/E0059.stderr17
-rw-r--r--tests/ui/error-codes/E0229.rs1
-rw-r--r--tests/ui/error-codes/E0229.stderr13
6 files changed, 60 insertions, 5 deletions
diff --git a/tests/ui/error-codes/E0038.rs b/tests/ui/error-codes/E0038.rs
index 9757e2ab10c..a467767c3fa 100644
--- a/tests/ui/error-codes/E0038.rs
+++ b/tests/ui/error-codes/E0038.rs
@@ -5,6 +5,8 @@ trait Trait {
 fn call_foo(x: Box<dyn Trait>) {
     //~^ ERROR E0038
     let y = x.foo();
+    //~^ ERROR E0038
+    //~| ERROR E0277
 }
 
 fn main() {
diff --git a/tests/ui/error-codes/E0038.stderr b/tests/ui/error-codes/E0038.stderr
index 99130396e02..6e8eaab8ddf 100644
--- a/tests/ui/error-codes/E0038.stderr
+++ b/tests/ui/error-codes/E0038.stderr
@@ -13,6 +13,32 @@ LL |     fn foo(&self) -> Self;
    |                      ^^^^ ...because method `foo` references the `Self` type in its return type
    = help: consider moving `foo` to another trait
 
-error: aborting due to 1 previous error
+error[E0038]: the trait `Trait` cannot be made into an object
+  --> $DIR/E0038.rs:7:13
+   |
+LL |     let y = x.foo();
+   |             ^^^^^^^ `Trait` cannot be made into an object
+   |
+note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
+  --> $DIR/E0038.rs:2:22
+   |
+LL | trait Trait {
+   |       ----- this trait cannot be made into an object...
+LL |     fn foo(&self) -> Self;
+   |                      ^^^^ ...because method `foo` references the `Self` type in its return type
+   = help: consider moving `foo` to another trait
+
+error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
+  --> $DIR/E0038.rs:7:9
+   |
+LL |     let y = x.foo();
+   |         ^ doesn't have a size known at compile-time
+   |
+   = help: the trait `Sized` is not implemented for `dyn Trait`
+   = note: all local variables must have a statically known size
+   = help: unsized locals are gated as an unstable feature
+
+error: aborting due to 3 previous errors
 
-For more information about this error, try `rustc --explain E0038`.
+Some errors have detailed explanations: E0038, E0277.
+For more information about an error, try `rustc --explain E0038`.
diff --git a/tests/ui/error-codes/E0059.rs b/tests/ui/error-codes/E0059.rs
index f775089bfb9..a04cc0cb2b9 100644
--- a/tests/ui/error-codes/E0059.rs
+++ b/tests/ui/error-codes/E0059.rs
@@ -1,6 +1,8 @@
 #![feature(unboxed_closures)]
 
 fn foo<F: Fn<i32>>(f: F) -> F::Output { f(3) } //~ ERROR E0059
+//~^ ERROR `i32` is not a tuple
+//~| ERROR cannot use call notation
 
 fn main() {
 }
diff --git a/tests/ui/error-codes/E0059.stderr b/tests/ui/error-codes/E0059.stderr
index a7591d2b04b..d26fadcdbfa 100644
--- a/tests/ui/error-codes/E0059.stderr
+++ b/tests/ui/error-codes/E0059.stderr
@@ -7,6 +7,19 @@ LL | fn foo<F: Fn<i32>>(f: F) -> F::Output { f(3) }
 note: required by a bound in `Fn`
   --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
-error: aborting due to 1 previous error
+error[E0277]: `i32` is not a tuple
+  --> $DIR/E0059.rs:3:41
+   |
+LL | fn foo<F: Fn<i32>>(f: F) -> F::Output { f(3) }
+   |                                         ^^^^ the trait `Tuple` is not implemented for `i32`
+
+error[E0059]: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit
+  --> $DIR/E0059.rs:3:41
+   |
+LL | fn foo<F: Fn<i32>>(f: F) -> F::Output { f(3) }
+   |                                         ^^^^
+
+error: aborting due to 3 previous errors
 
-For more information about this error, try `rustc --explain E0059`.
+Some errors have detailed explanations: E0059, E0277.
+For more information about an error, try `rustc --explain E0059`.
diff --git a/tests/ui/error-codes/E0229.rs b/tests/ui/error-codes/E0229.rs
index b7cdb1737b0..558baae37f7 100644
--- a/tests/ui/error-codes/E0229.rs
+++ b/tests/ui/error-codes/E0229.rs
@@ -15,6 +15,7 @@ fn baz<I>(x: &<I as Foo<A=Bar>>::A) {}
 //~| ERROR associated type bindings are not allowed here [E0229]
 //~| ERROR associated type bindings are not allowed here [E0229]
 //~| ERROR the trait bound `I: Foo` is not satisfied
+//~| ERROR the trait bound `I: Foo` is not satisfied
 
 fn main() {
 }
diff --git a/tests/ui/error-codes/E0229.stderr b/tests/ui/error-codes/E0229.stderr
index a7a2904bb89..bd8e1955ac6 100644
--- a/tests/ui/error-codes/E0229.stderr
+++ b/tests/ui/error-codes/E0229.stderr
@@ -31,7 +31,18 @@ help: consider restricting type parameter `I`
 LL | fn baz<I: Foo>(x: &<I as Foo<A=Bar>>::A) {}
    |         +++++
 
-error: aborting due to 4 previous errors
+error[E0277]: the trait bound `I: Foo` is not satisfied
+  --> $DIR/E0229.rs:13:37
+   |
+LL | fn baz<I>(x: &<I as Foo<A=Bar>>::A) {}
+   |                                     ^^ the trait `Foo` is not implemented for `I`
+   |
+help: consider restricting type parameter `I`
+   |
+LL | fn baz<I: Foo>(x: &<I as Foo<A=Bar>>::A) {}
+   |         +++++
+
+error: aborting due to 5 previous errors
 
 Some errors have detailed explanations: E0229, E0277.
 For more information about an error, try `rustc --explain E0229`.