Skip to content

Commit 517ff7d

Browse files
authored
area(&rectangle) do not compile with rustc 1.56.0. Use rectangle.area()
With rustc 1.56.0 (Debian sid) "area(&rectangle)" produces the compilation error: error[E0425]: cannot find function `area` in this scope rectangle.area() compiles. Change also _triangle.area() for consistency.
1 parent 1ca6a7b commit 517ff7d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/generics/bounds.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ fn main() {
5858
let _triangle = Triangle { length: 3.0, height: 4.0 };
5959
6060
print_debug(&rectangle);
61-
println!("Area: {}", area(&rectangle));
61+
println!("Area: {}", rectangle.area());
6262
6363
//print_debug(&_triangle);
64-
//println!("Area: {}", area(&_triangle));
64+
//println!("Area: {}", _triangle.area());
6565
// ^ TODO: Try uncommenting these.
6666
// | Error: Does not implement either `Debug` or `HasArea`.
6767
}

0 commit comments

Comments
 (0)