1
Fork 0

Rollup merge of #111451 - compiler-errors:note-cast-origin, r=b-naber

Note user-facing types of coercion failure

When coercing, for example, `Box<A>` into `Box<dyn B>`, make sure that any failure notes mention *those* specific types, rather than mentioning inner types, like "the cast from `A` to `dyn B`".

I expect end-users are often confused when we skip layers of types and only mention the "innermost" part of a coercion, especially when other notes point at HIR, e.g. #111406.
This commit is contained in:
Dylan DPC 2023-05-13 11:05:33 +05:30 committed by GitHub
commit 05ca3e31df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
65 changed files with 142 additions and 225 deletions

View file

@ -281,9 +281,6 @@ pub enum ObligationCauseCode<'tcx> {
/// A type like `Box<Foo<'a> + 'b>` is WF only if `'b: 'a`.
ObjectTypeBound(Ty<'tcx>, ty::Region<'tcx>),
/// Obligation incurred due to an object cast.
ObjectCastObligation(/* Concrete type */ Ty<'tcx>, /* Object type */ Ty<'tcx>),
/// Obligation incurred due to a coercion.
Coercion {
source: Ty<'tcx>,