diff options
| author | Taylor Cramer <cramertj@google.com> | 2024-11-20 14:19:36 -0800 |
|---|---|---|
| committer | Taylor Cramer <cramertj@google.com> | 2025-01-22 09:20:57 -0800 |
| commit | d00d4dfe0daba29036aab1f2b35a8c6ccb023f3e (patch) | |
| tree | d2aa54a8a05297e887429b0d984f626c1b94d4ac /tests/rustdoc-ui/issues | |
| parent | b2728d5426bab1d8c39709768c7e22b7f66dde5d (diff) | |
| download | rust-d00d4dfe0daba29036aab1f2b35a8c6ccb023f3e.tar.gz rust-d00d4dfe0daba29036aab1f2b35a8c6ccb023f3e.zip | |
Refactor dyn-compatibility error and suggestions
This CL makes a number of small changes to dyn compatibility errors: - "object safety" has been renamed to "dyn-compatibility" throughout - "Convert to enum" suggestions are no longer generated when there exists a type-generic impl of the trait or an impl for `dyn OtherTrait` - Several error messages are reorganized for user readability Additionally, the dyn compatibility error creation code has been split out into functions. cc #132713 cc #133267
Diffstat (limited to 'tests/rustdoc-ui/issues')
| -rw-r--r-- | tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs | 4 | ||||
| -rw-r--r-- | tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr | 9 |
2 files changed, 7 insertions, 6 deletions
diff --git a/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs index 027574923c7..89b55beaea1 100644 --- a/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs +++ b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs @@ -5,8 +5,8 @@ use std::ops::Index; pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) { //~^ expected 1 lifetime argument //~| expected 1 generic argument - //~| the trait `SVec` cannot be made into an object - //~| `SVec` cannot be made into an object + //~| the trait `SVec` is not dyn compatible + //~| `SVec` is not dyn compatible //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` let _ = s; diff --git a/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr index 97bd44244f3..72d1a52f710 100644 --- a/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr +++ b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr @@ -294,19 +294,20 @@ help: add missing generic argument LL | Output = <Self as SVec>::Item> as SVec>::Item<T>, | +++ -error[E0038]: the trait `SVec` cannot be made into an object +error[E0038]: the trait `SVec` is not dyn compatible --> $DIR/ice-generic-type-alias-105742.rs:5:35 | LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `SVec` cannot be made into an object + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `SVec` is not dyn compatible | -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> +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> --> $DIR/ice-generic-type-alias-105742.rs:15:17 | LL | pub trait SVec: Index< | ____________----__^ | | | - | | this trait cannot be made into an object... + | | this trait is not dyn compatible... LL | | <Self as SVec>::Item, ... | LL | |/ Output = <Index<<Self as SVec>::Item, |
