This commit is contained in:
Michael Goulet 2022-08-27 03:42:15 +00:00
parent 2820bc4b69
commit eda91d9291
2 changed files with 17 additions and 0 deletions

View File

@ -37,6 +37,7 @@ pub struct Inherited<'a, 'tcx> {
// Some additional `Sized` obligations badly affect type inference.
// These obligations are added in a later stage of typeck.
// Removing these may also cause additional complications, see #101066.
pub(super) deferred_sized_obligations:
RefCell<Vec<(Ty<'tcx>, Span, traits::ObligationCauseCode<'tcx>)>>,

View File

@ -0,0 +1,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() {}