rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

fix: sort and deduplicate auto traits in trait object types

Open lowr opened this issue 3 years ago • 0 comments

Fixes #12739

Chalk solver doesn't sort and deduplicate auto traits in trait object types, so we need to handle them ourselves in the lowering phase, just like rustc and chalk-integration do.

Quoting from the Chalk book:

Note that -- for this purpose -- ordering of bounds is significant. That means that if you create a dyn Foo + Send and a dyn Send + Foo, chalk would consider them distinct types. The assumption is that bounds are ordered in some canonical fashion somewhere else.

Also, trait object types with more than one non-auto traits were previously allowed, but are now disallowed with this patch.

lowr avatar Jul 18 '22 11:07 lowr