Closed
Description
This was an issue that came up during work on #55994.
Basically, a bug in the de-duplication code means that dyn Send
is a different type from dyn Send + Send
, and likewise dyn Sync + Send
is different from dyn Sync + Send + Sync
. However, this clearly should not be the case, and indeed dyn Send + Send
is the same type as dyn Send + Send + Send
. (Note, this is only tangentially related to the lint #56522.)
Apart from potentially surprising behaviour, the issue with the above lies with trait impls and coherence. I am unaware of a specific ICE that can arise because of it, but it is probably UB in general.
trait Foo {}
impl Foo for dyn Send {}
impl Foo for dyn Send + Send {}
trait Foo {}
impl Foo for dyn Send + Send {}
impl Foo for dyn Send + Send + Send {}