summaryrefslogtreecommitdiffstats
path: root/tests/ui/coercion/issue-101066.rs
blob: b658ed1e9ab79e6f0dd4ef4c8c17f99c637be726 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// check-pass

use std::convert::TryFrom;

pub trait FieldElement {
    type Integer: TryFrom<usize, Error = std::num::TryFromIntError>;

    fn valid_integer_try_from<N>(i: N) -> Result<Self::Integer, ()>
    where
        Self::Integer: TryFrom<N>,
    {
        Self::Integer::try_from(i).map_err(|_| ())
    }
}

fn main() {}