From 5f6390f947373528355d30a276ede65d92baaa57 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Fri, 9 Feb 2024 12:17:55 +0000 Subject: Continue compilation after check_mod_type_wf errors --- tests/ui/error-codes/E0038.rs | 2 ++ tests/ui/error-codes/E0038.stderr | 30 ++++++++++++++++++++++++++++-- tests/ui/error-codes/E0059.rs | 2 ++ tests/ui/error-codes/E0059.stderr | 17 +++++++++++++++-- tests/ui/error-codes/E0229.rs | 1 + tests/ui/error-codes/E0229.stderr | 13 ++++++++++++- 6 files changed, 60 insertions(+), 5 deletions(-) (limited to 'tests/ui/error-codes') 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) { //~^ 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 + --> $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: 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: 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: 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: 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(x: &>::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(x: &>::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(x: &>::A) {} + | ^^ the trait `Foo` is not implemented for `I` + | +help: consider restricting type parameter `I` + | +LL | fn baz(x: &>::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`. -- cgit 1.4.1-3-g733a5