Why doesn't `?Sized` work in a `where` clause?


#1

I was recently surprised to discovered that ?Sized doesn’t work in a where clause.

impl<'a, T> Foo<'a> for &'a T where T: std::borrow::Borrow<str> + ?Sized {}

Instead, ?Sized belongs in a <> trait bound, like so:

impl<'a, T: std::borrow::Borrow<str> + ?Sized> Foo<'a> for &'a T {}

(Here’s a full program showing the difference: http://is.gd/dd3tuh.)

Why does Rust have this restriction against ?Sized?


#2

It’s just not a very high priority issue…


#3

OK, thanks.