On Mon, Feb 3, 2014 at 5:20 PM, Eric Reed <[email protected]> wrote:
> Actually this isn't the case.
>
> fn foo<T: Any>(t: T) -> TypeId {
>     t.get_type_id()
> }
>
> compiles just fine, but
>
> fn bar<T>(t: T) -> TypeId {
>     t.get_type_id()
> }
>
> fails with "error: instantiating a type parameter with incompatible type
> `T`, which does not fulfill `'static`". Just <T> does not imply <T:
> 'static>, so parametricity is not violated.
>
> I had the same thought about making size_of and friends unsafe functions. I
> think that might be a reasonable idea.

The 'static bound is there as a workaround for an implementation
limitation. In all likelihood, it will no longer be required in the
future as it has no fundamental relation to reflection.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to