mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-15 10:07:30 +00:00
17 lines
386 B
Rust
17 lines
386 B
Rust
struct Rectangle {
|
|
width: i32,
|
|
height: i32,
|
|
}
|
|
impl Rectangle {
|
|
fn new(width: i32, height: i32) -> Self {
|
|
Self { width, height }
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let rect = Rectangle::new(3, 4);
|
|
// `area` is not implemented for `Rectangle`, so this should not suggest
|
|
let _ = rect::area();
|
|
//~^ ERROR failed to resolve: use of undeclared crate or module `rect`
|
|
}
|