diff options
| author | Michael Goulet <michael@errs.io> | 2024-11-23 18:32:10 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-11-23 23:31:30 +0000 |
| commit | cfa8fcbf581c8c311e079b04517cbe979d9beb7b (patch) | |
| tree | ef8f35d148daf7787be7b284b2a7da5f8c0aa404 /tests/ui/issues | |
| parent | 898ccdb75426f5fb5c58e8057a83d015640613b8 (diff) | |
| download | rust-cfa8fcbf581c8c311e079b04517cbe979d9beb7b.tar.gz rust-cfa8fcbf581c8c311e079b04517cbe979d9beb7b.zip | |
Dont create trait object if it has errors in it
Diffstat (limited to 'tests/ui/issues')
| -rw-r--r-- | tests/ui/issues/issue-23024.rs | 1 | ||||
| -rw-r--r-- | tests/ui/issues/issue-23024.stderr | 10 | ||||
| -rw-r--r-- | tests/ui/issues/issue-34373.rs | 1 | ||||
| -rw-r--r-- | tests/ui/issues/issue-34373.stderr | 30 |
4 files changed, 6 insertions, 36 deletions
diff --git a/tests/ui/issues/issue-23024.rs b/tests/ui/issues/issue-23024.rs index 25220dc3e61..1b072dd7b69 100644 --- a/tests/ui/issues/issue-23024.rs +++ b/tests/ui/issues/issue-23024.rs @@ -8,5 +8,4 @@ fn main() println!("{:?}",(vfnfer[0] as dyn Fn)(3)); //~^ ERROR the precise format of `Fn`-family traits' //~| ERROR missing generics for trait `Fn` - //~| ERROR the value of the associated type `Output` in `FnOnce` } diff --git a/tests/ui/issues/issue-23024.stderr b/tests/ui/issues/issue-23024.stderr index 62278a51be6..51db0414f3a 100644 --- a/tests/ui/issues/issue-23024.stderr +++ b/tests/ui/issues/issue-23024.stderr @@ -19,13 +19,7 @@ help: add missing generic argument LL | println!("{:?}",(vfnfer[0] as dyn Fn<Args>)(3)); | ++++++ -error[E0191]: the value of the associated type `Output` in `FnOnce` must be specified - --> $DIR/issue-23024.rs:8:39 - | -LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3)); - | ^^ help: specify the associated type: `Fn::<Output = Type>` - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0107, E0191, E0658. +Some errors have detailed explanations: E0107, E0658. For more information about an error, try `rustc --explain E0107`. diff --git a/tests/ui/issues/issue-34373.rs b/tests/ui/issues/issue-34373.rs index dc20c5589b3..707aa8cf338 100644 --- a/tests/ui/issues/issue-34373.rs +++ b/tests/ui/issues/issue-34373.rs @@ -6,7 +6,6 @@ trait Trait<T> { pub struct Foo<T = Box<Trait<DefaultFoo>>>; //~ ERROR cycle detected //~^ ERROR `T` is never used -//~| ERROR `Trait` cannot be made into an object type DefaultFoo = Foo; fn main() { diff --git a/tests/ui/issues/issue-34373.stderr b/tests/ui/issues/issue-34373.stderr index 4e8e7c61fee..06365558217 100644 --- a/tests/ui/issues/issue-34373.stderr +++ b/tests/ui/issues/issue-34373.stderr @@ -5,7 +5,7 @@ LL | pub struct Foo<T = Box<Trait<DefaultFoo>>>; | ^^^^^^^^^^ | note: ...which requires expanding type alias `DefaultFoo`... - --> $DIR/issue-34373.rs:10:19 + --> $DIR/issue-34373.rs:9:19 | LL | type DefaultFoo = Foo; | ^^^ @@ -17,28 +17,6 @@ LL | pub struct Foo<T = Box<Trait<DefaultFoo>>>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error[E0038]: the trait `Trait` cannot be made into an object - --> $DIR/issue-34373.rs:7:24 - | -LL | pub struct Foo<T = Box<Trait<DefaultFoo>>>; - | ^^^^^^^^^^^^^^^^^ `Trait` cannot be made into an object - | -note: for a trait to be "dyn-compatible" 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/issue-34373.rs:4:8 - | -LL | trait Trait<T> { - | ----- this trait cannot be made into an object... -LL | fn foo(_: T) {} - | ^^^ ...because associated function `foo` has no `self` parameter -help: consider turning `foo` into a method by giving it a `&self` argument - | -LL | fn foo(&self, _: T) {} - | ++++++ -help: alternatively, consider constraining `foo` so it does not apply to trait objects - | -LL | fn foo(_: T) where Self: Sized {} - | +++++++++++++++++ - error[E0392]: type parameter `T` is never used --> $DIR/issue-34373.rs:7:16 | @@ -48,7 +26,7 @@ LL | pub struct Foo<T = Box<Trait<DefaultFoo>>>; = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0038, E0391, E0392. -For more information about an error, try `rustc --explain E0038`. +Some errors have detailed explanations: E0391, E0392. +For more information about an error, try `rustc --explain E0391`. |
