aboutsummaryrefslogtreecommitdiff
path: root/examples/rust/default.rs
blob: 65233495f27666274116d453498cee1a7b725d6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// 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
}

// If you use `main()`, declare it as `pub` to see it in the output:
// pub fn main() { ... }