]> git.lizzy.rs Git - rust.git/commit - src/tools/miri
Rollup merge of #68195 - estebank:impl-trait-2000, r=Centril
authorDylan DPC <dylan.dpc@gmail.com>
Fri, 17 Jan 2020 05:46:37 +0000 (11:16 +0530)
committerGitHub <noreply@github.com>
Fri, 17 Jan 2020 05:46:37 +0000 (11:16 +0530)
commitde01a29fbee586a13f10ee928df7c15c5a170587
tree5df2f8765a42cd59c9d6244b56d7d18b56d8d77f
parentecf42a3d624b859bcfeffc1c454ebd964eac0422
parent029a9c625371e756d93024efd3deb7636a90f8f8
Rollup merge of #68195 - estebank:impl-trait-2000, r=Centril

Account for common `impl Trait`/`dyn Trait` return type errors

- When all return paths have the same type, suggest `impl Trait`.
- When all return paths implement the expected `trait`, suggest `Box<dyn Trait>` and mention using an `enum`.
- When multiple different types are returned and `impl Trait` is expected, extend the explanation.
- When return type is `impl Trait` and the return paths do not implement `Trait`, point at the returned values.
- Split `src/librustc/traits/error_reporting.rs` into multiple files to keep size under control.

Fix #68110, cc #66523.