mirror of
https://github.com/rust-lang/rust.git
synced 2025-12-01 13:47:59 +00:00
17 lines
204 B
Rust
17 lines
204 B
Rust
//@ check-pass
|
|
|
|
#![deny(dead_code)]
|
|
|
|
#[derive(Default)]
|
|
struct Test {
|
|
|
|
}
|
|
|
|
fn main() {
|
|
if let Some::<Test>(test) = magic::<Test>() { }
|
|
}
|
|
|
|
fn magic<T: Default>() -> Option<T> {
|
|
Some(T::default())
|
|
}
|