mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 11:48:30 +00:00

Done with ```bash sd '//@ pretty-expanded.*\n' '' tests/ui/**/*.rs ``` and ``` sd '//@pretty-expanded.*\n' '' tests/ui/**/*.rs ```
15 lines
248 B
Rust
15 lines
248 B
Rust
//@ run-pass
|
|
#![allow(dead_code)]
|
|
|
|
pub trait NumCast: Sized {
|
|
fn from(i: i32) -> Option<Self>;
|
|
}
|
|
|
|
pub trait NumExt: NumCast + PartialOrd { }
|
|
|
|
fn greater_than_one<T:NumExt>(n: &T) -> bool {
|
|
*n > NumCast::from(1).unwrap()
|
|
}
|
|
|
|
pub fn main() {}
|