# \[Pre-RFC\] Allowing generic impls of external traits when bounds prevent re-impl

**URL:** <https://internals.rust-lang.org/t/pre-rfc-allowing-generic-impls-of-external-traits-when-bounds-prevent-re-impl/7296>\
**Category:** Uncategorized\
**Created:** [April 12, 2018, 2:54am UTC](https://internals.rust-lang.org/t/pre-rfc-allowing-generic-impls-of-external-traits-when-bounds-prevent-re-impl/7296 "2018-04-12T02:54:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sushisource](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/sushisource/32/3956_2.png) [@Sushisource](https://internals.rust-lang.org/u/Sushisource)\
**Post date:** [April 12, 2018, 2:54am UTC](https://internals.rust-lang.org/t/pre-rfc-allowing-generic-impls-of-external-traits-when-bounds-prevent-re-impl/7296/1 "2018-04-12T02:54:23Z")

</div>

Hi all, new to the forum/process so bear with me.

Let’s start with an example:

```rust
trait CenterOriginRect {
  fn center(&self) -> Point;
  fn width(&self) -> Meters;
  fn height(&self) -> Meters;
}

impl CenterOriginRect for Room {
  fn center(&self) -> Point { self.center }
  fn width(&self) -> f32 { self.width }
  fn height(&self) -> f32 { self.height }
}

impl<'a, T: CenterOriginRect> From<&'a T> for Rect {
  fn from(r: &T) -> Rect {
    Rect {
      x: r.center().x - r.width() / 2.0,
      y: r.center().y - r.height() / 2.0,
      w: r.width(),
      h: r.height(),
    }
  }
}

```

Trying to compile this will result my least favorite error, E0210 (type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`); only traits defined in the current crate can be implemented for a type parameter).

However, I think, and correct me if I’m wrong, this is impossble because `CenterOriginRect` is not public. No one could collide with this implementation because of the bounds.

Is that statement true? If so, this feels like it could be a straightforward usability win.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [March 25, 2019, 8:30am UTC](https://internals.rust-lang.org/t/pre-rfc-allowing-generic-impls-of-external-traits-when-bounds-prevent-re-impl/7296/2 "2019-03-25T08:30:03Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
