diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-05-18 08:41:15 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-18 08:41:15 +0200 |
| commit | 49048eab47b2bb6cbba518c6477d0054cc3fc780 (patch) | |
| tree | 84a6f61c4fa407f3b9f0801d96ab834c396bfa6c /src/test | |
| parent | 04f903859a8a1b82a25b6bba7301beb06ad145d2 (diff) | |
| parent | 0de7568e417ae001a45ae0a85b8bc2067a5f9c46 (diff) | |
| download | rust-49048eab47b2bb6cbba518c6477d0054cc3fc780.tar.gz rust-49048eab47b2bb6cbba518c6477d0054cc3fc780.zip | |
Rollup merge of #96378 - compiler-errors:trait-upcast-error, r=nagisa
Mention traits and types involved in unstable trait upcasting Fixes #95972 by printing the traits being upcasted and the types being coerced that cause that upcasting... --- the poor span mentioned in the original issue has nothing to do with trait upcasting diagnostic here... > The original example I had that made me run into this issue had an even longer expression there (multiple chained iterator methods) which just got all highlighted as one big block saying "somewhere here trait coercion is used and it's not allowed". I don't think I can solve that issue in general without fixing the ObligationCauseCode and span that gets passed into Coerce.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/feature-gates/feature-gate-trait_upcasting.stderr | 3 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-11515.stderr | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/test/ui/feature-gates/feature-gate-trait_upcasting.stderr b/src/test/ui/feature-gates/feature-gate-trait_upcasting.stderr index bc13a5d7d7b..93afa78459d 100644 --- a/src/test/ui/feature-gates/feature-gate-trait_upcasting.stderr +++ b/src/test/ui/feature-gates/feature-gate-trait_upcasting.stderr @@ -1,4 +1,4 @@ -error[E0658]: trait upcasting coercion is experimental +error[E0658]: cannot cast `dyn Bar` to `dyn Foo`, trait upcasting coercion is experimental --> $DIR/feature-gate-trait_upcasting.rs:11:25 | LL | let foo: &dyn Foo = bar; @@ -6,6 +6,7 @@ LL | let foo: &dyn Foo = bar; | = note: see issue #65991 <https://github.com/rust-lang/rust/issues/65991> for more information = help: add `#![feature(trait_upcasting)]` to the crate attributes to enable + = note: required when coercing `&dyn Bar` into `&dyn Foo` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-11515.stderr b/src/test/ui/issues/issue-11515.stderr index a70e7c416bc..17bfae2a4e4 100644 --- a/src/test/ui/issues/issue-11515.stderr +++ b/src/test/ui/issues/issue-11515.stderr @@ -1,4 +1,4 @@ -error[E0658]: trait upcasting coercion is experimental +error[E0658]: cannot cast `dyn Fn()` to `dyn FnMut()`, trait upcasting coercion is experimental --> $DIR/issue-11515.rs:9:33 | LL | let test = box Test { func: closure }; @@ -6,6 +6,7 @@ LL | let test = box Test { func: closure }; | = note: see issue #65991 <https://github.com/rust-lang/rust/issues/65991> for more information = help: add `#![feature(trait_upcasting)]` to the crate attributes to enable + = note: required when coercing `Box<(dyn Fn() + 'static)>` into `Box<(dyn FnMut() + 'static)>` error: aborting due to previous error |
