mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
5311938531
Fix #82051.
13 lines
240 B
Rust
13 lines
240 B
Rust
pub struct Example { a: i32 }
|
|
|
|
impl Example {
|
|
fn is_pos(&self) -> bool { self.a > 0 }
|
|
}
|
|
|
|
fn one() -> i32 { 1 }
|
|
|
|
fn main() {
|
|
if Example { a: one(), }.is_pos() { //~ ERROR invalid struct literal
|
|
println!("Positive!");
|
|
}
|
|
}
|