From bd4839e394565eeabaf05533acbf57d5a7e5bda6 Mon Sep 17 00:00:00 2001 From: Dominik Maier Date: Thu, 20 Jul 2023 17:46:50 +0200 Subject: [PATCH] Refer to Godbolt (#1011) * Refer to Godbolt * Apply suggestions from code review --------- Co-authored-by: Martin Geisler --- src/ownership/borrowing.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ownership/borrowing.md b/src/ownership/borrowing.md index 7c5bc20f..50088ddf 100644 --- a/src/ownership/borrowing.md +++ b/src/ownership/borrowing.md @@ -25,7 +25,7 @@ fn main() {
Notes on stack returns: -* Demonstrate that the return from `add` is cheap because the compiler can eliminate the copy operation. Change the above code to print stack addresses and run it on the [Playground]. In the "DEBUG" optimization level, the addresses should change, while they stay the same when changing to the "RELEASE" setting: +* Demonstrate that the return from `add` is cheap because the compiler can eliminate the copy operation. Change the above code to print stack addresses and run it on the [Playground] or look at the assembly in [Godbold](https://rust.godbolt.org/). In the "DEBUG" optimization level, the addresses should change, while they stay the same when changing to the "RELEASE" setting: ```rust,editable #[derive(Debug)] @@ -37,7 +37,7 @@ Notes on stack returns: p } - fn main() { + pub fn main() { let p1 = Point(3, 4); let p2 = Point(10, 20); let p3 = add(&p1, &p2); @@ -50,4 +50,4 @@ Notes on stack returns:
-[Playground]: https://play.rust-lang.org/ +[Playground]: https://play.rust-lang.org/ \ No newline at end of file