New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement SourceCode
for Vec<u8>
#216
Conversation
Thoughts on just replacing the existing impls with the following? impl SourceCode for [u8] { ... }
impl SourceCode for str { ... }
impl<T: Deref + Send + Sync> SourceCode for T where T::Target: SourceCode { ... } This should cover all the existing impls, |
wait really? If that won't be a breaking change, that does seem better! |
It's technically a breaking change, because it may overlap with existing downstream impls. For example, suppose the following code was in some dependent crate: struct Foo(String);
impl Deref for Foo {
type Target = str;
...
}
impl SourceCode for Foo { ... } That RFC 1105 states that implementing traits is only considered minor though, even though it is always technically breaking. However, the type of breaking change discussed there has to do with dispatch ambiguity rather than coherence, so I'm not sure the same reasoning applies. Fixing dispatch ambiguity issues is very straightforward, while fixing this type of coherence issue might require much deeper changes. I'm not sure how much of an issue this is in practice. I wish there was an easy way to just build all the dependent crates against a proposed change like this, similar to how crater works for rustc changes :) |
Would it be alright to merge this PR by itself and then have a second one with the breaking impl based on |
Yeah, when I originally suggested the |
Let's merge this in for now, then :) |
SourceCode is implemented for &str, String, and &[u8] but it is missing an impl for
Vec<u8>
.