Rollup merge of #102635 - lcnr:incoherent_auto_trait_objects, r=jackh726
make `order_dependent_trait_objects` show up in future-breakage reports tried to change it to a hard error in #102474 but breaking the more than 1000 dependents of `traitobject` doesn't feel great 😅 This lint has existed since more than 3 years now and the way this is currently implemented is buggy and will break with #102472. imo we should upgrade it to also report for dependencies and maybe also backport this to beta. Then after maybe 2-3 stable versions I would like to finally convert this lint to a hard error.
This commit is contained in:
commit
ebfdf735ac
|
@ -1427,6 +1427,7 @@ declare_lint! {
|
|||
"trait-object types were treated as different depending on marker-trait order",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #56484 <https://github.com/rust-lang/rust/issues/56484>",
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -37,3 +37,45 @@ LL | impl Foo for dyn Send + Sync + Send {}
|
|||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Future incompatibility report: Future breakage diagnostic:
|
||||
error: conflicting implementations of trait `Foo` for type `(dyn std::marker::Send + 'static)`: (E0119)
|
||||
--> $DIR/lint-incoherent-auto-trait-objects.rs:5:1
|
||||
|
|
||||
LL | impl Foo for dyn Send {}
|
||||
| --------------------- first implementation here
|
||||
LL |
|
||||
LL | impl Foo for dyn Send + Send {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + 'static)`
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
|
||||
= note: `#[deny(order_dependent_trait_objects)]` on by default
|
||||
|
||||
Future breakage diagnostic:
|
||||
error: conflicting implementations of trait `Foo` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)
|
||||
--> $DIR/lint-incoherent-auto-trait-objects.rs:11:1
|
||||
|
|
||||
LL | impl Foo for dyn Send + Sync {}
|
||||
| ---------------------------- first implementation here
|
||||
LL |
|
||||
LL | impl Foo for dyn Sync + Send {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
|
||||
= note: `#[deny(order_dependent_trait_objects)]` on by default
|
||||
|
||||
Future breakage diagnostic:
|
||||
error: conflicting implementations of trait `Foo` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)
|
||||
--> $DIR/lint-incoherent-auto-trait-objects.rs:15:1
|
||||
|
|
||||
LL | impl Foo for dyn Sync + Send {}
|
||||
| ---------------------------- first implementation here
|
||||
...
|
||||
LL | impl Foo for dyn Send + Sync + Send {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
|
||||
= note: `#[deny(order_dependent_trait_objects)]` on by default
|
||||
|
||||
|
|
|
@ -66,3 +66,20 @@ error: aborting due to 8 previous errors
|
|||
|
||||
Some errors have detailed explanations: E0119, E0751.
|
||||
For more information about an error, try `rustc --explain E0119`.
|
||||
Future incompatibility report: Future breakage diagnostic:
|
||||
warning: conflicting implementations of trait `Trait0` for type `(dyn std::marker::Send + 'static)`: (E0119)
|
||||
--> $DIR/issue-33140-hack-boundaries.rs:10:1
|
||||
|
|
||||
LL | impl Trait0 for dyn Send {}
|
||||
| ------------------------ first implementation here
|
||||
LL | impl Trait0 for dyn Send {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + 'static)`
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/issue-33140-hack-boundaries.rs:2:10
|
||||
|
|
||||
LL | #![allow(order_dependent_trait_objects)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
|
@ -40,3 +40,56 @@ LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send + Sync { }
|
|||
|
||||
warning: 3 warnings emitted
|
||||
|
||||
Future incompatibility report: Future breakage diagnostic:
|
||||
warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)
|
||||
--> $DIR/issue-33140-traitobject-crate.rs:86:1
|
||||
|
|
||||
LL | unsafe impl Trait for dyn (::std::marker::Send) + Sync { }
|
||||
| ------------------------------------------------------ first implementation here
|
||||
LL | unsafe impl Trait for dyn (::std::marker::Send) + Send + Sync { }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/issue-33140-traitobject-crate.rs:3:9
|
||||
|
|
||||
LL | #![warn(order_dependent_trait_objects)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Future breakage diagnostic:
|
||||
warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)
|
||||
--> $DIR/issue-33140-traitobject-crate.rs:89:1
|
||||
|
|
||||
LL | unsafe impl Trait for dyn (::std::marker::Send) + Send + Sync { }
|
||||
| ------------------------------------------------------------- first implementation here
|
||||
...
|
||||
LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send { }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/issue-33140-traitobject-crate.rs:3:9
|
||||
|
|
||||
LL | #![warn(order_dependent_trait_objects)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Future breakage diagnostic:
|
||||
warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)
|
||||
--> $DIR/issue-33140-traitobject-crate.rs:93:1
|
||||
|
|
||||
LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send { }
|
||||
| ------------------------------------------------------ first implementation here
|
||||
...
|
||||
LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send + Sync { }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/issue-33140-traitobject-crate.rs:3:9
|
||||
|
|
||||
LL | #![warn(order_dependent_trait_objects)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
Loading…
Reference in a new issue