aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authornarpfel <narpfel@gmx.de>2024-01-17 05:02:20 +0100
committerGitHub <noreply@github.com>2024-01-16 22:02:20 -0600
commit21aaec6be5a2091298dbeeda748a6f915bcc6648 (patch)
treed5e6afbd324009d9b6f0b6d33001d3cfd3c1e7a3 /examples
parentdab53cb91661c32e6142ce803258d50c99637ef8 (diff)
downloadcompiler-explorer-21aaec6be5a2091298dbeeda748a6f915bcc6648.tar.gz
compiler-explorer-21aaec6be5a2091298dbeeda748a6f915bcc6648.zip
Add note to Rust example explaining why functions are missing in the output (#6013)gh-10235
Resolves #5939. Rust issue about this problem: https://github.com/rust-lang/rust/issues/119850 Hopefully this can be reverted again when there is a fix on the Rust side.
Diffstat (limited to 'examples')
-rw-r--r--examples/rust/default.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/examples/rust/default.rs b/examples/rust/default.rs
index 22790d250..65233495f 100644
--- a/examples/rust/default.rs
+++ b/examples/rust/default.rs
@@ -1,4 +1,12 @@
// Type your code here, or load an example.
+
+// As of Rust 1.75, small functions are automatically
+// marked as `#[inline]` so they will not show up in
+// the output when compiling with optimisations. Use
+// `#[no_mangle]` or `#[inline(never)]` to work around
+// this issue.
+// See https://github.com/compiler-explorer/compiler-explorer/issues/5939
+#[no_mangle]
pub fn square(num: i32) -> i32 {
num * num
}