-
Notifications
You must be signed in to change notification settings - Fork 41
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
Trait associated type bounds are stable #251
Labels
help wanted
Extra attention is needed
Comments
One problem that I came across: What to do with stuff like the following in the generated code? impl TryFrom<&Buffer> for Point {
type Error = ParseError;
fn try_from(value: &Buffer) -> Result<Self, Self::Error> {
Self::try_from(&**value)
}
}
impl TryFrom<Buffer> for Point {
type Error = ParseError;
fn try_from(value: Buffer) -> Result<Self, Self::Error> {
Self::try_from(&*value)
}
} The following is the "correct" replacement, I think: impl<B: AsRef<[u8]>> TryFrom<B> for Point {
type Error = ParseError;
fn try_from(value: B) -> Result<Self, Self::Error> {
Self::try_from(value.as_ref())
}
} However, coherence complains:
|
You caught me looking at it also. As done in this PR, I propose to just use |
Looks like it's just not possible to have a generic TryFrom implementation: rust-lang/rust#50133 |
Closing because #259 has been merged. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looking at:
x11rb/src/utils.rs
Lines 88 to 98 in efece4d
However, the following code is allowed in rust 1.37 (https://godbolt.org/z/Xe9rG9):
The text was updated successfully, but these errors were encountered: