Overly strict conflicting implementation checking?

I want to do something like the following

use std::ops::Deref;

struct Struct;

impl<T: Deref<Target=str>> From<T> for Struct { ... }

impl<T: Deref<Target=[u8]>> From<T> for Struct { ... }

Which causes a conflicting implementations error. From my understanding it should be impossible to have conflicting implementations since you can't implement Deref with two different Target types for any T so there will never be ambiguity. Am I missing something?

You are right that these implementations cannot overlap with each other, but the compiler doesn’t perform the sort of reasoning necessary to accept them.

5 Likes