These are chat archives for rust-lang/rust

11th
May 2019
octave99
@octave99
May 11 11:42
Could someone help me understand the error in below code:
use std::convert::TryFrom;

struct Age(u8);
// conflicting implementation in crate `core`:   - impl<T, U> std::convert::TryFrom<U> for T  where U: std::convert::Into<T>;
impl<T> TryFrom<T> for Age where T: AsRef<[u8]> {
    type Error = std::io::Error;
    fn try_from(t: T) -> Result<Self, Self::Error> {
        Ok(Age(22))
    }
}

fn main(){}
From trait implementation is working, like so. Not sure what's wrong with TryFrom:
impl<T> From<T> for Age where T: AsRef<[u8]> {
    fn from(t: T) -> Self {
        Age(22)
    }
}
Denis Lisov
@tanriol
May 11 11:59
This is unfortunately not possible, this implementation would conflict with the default blanket impl.
Ghost
@ghost~5cd49501d73408ce4fbfdd2f
May 11 17:01
How to install npm latest be version in linux mint for web assembly