Skip to content

Commit 4436ad7

Browse files
committed
Address review
1 parent 61f228c commit 4436ad7

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

guide/src/reference/attributes/on-rust-exports/main.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# `main`
22

3-
When attached to the `fn main()` function this attribute will adjust it to
4-
properly throw errors if they can be. This is only intended to be used for
5-
binaries.
3+
When attached to the `main` function this attribute will adjust it to properly
4+
throw errors if they can be.
65

76
```rust
87
#[wasm_bindgen(main)]
@@ -21,10 +20,9 @@ async fn main() {
2120
}
2221
```
2322

24-
Unlike `#[wasm_bindgen(start)]` this will not export a function to be executed
25-
on startup, it should only be used in Cargo binaries or examples for the `main`
26-
function. `#[wasm_bindgen(start)]` will prevent the `main` function to start and
27-
should not be used in conjunction.
23+
This attribute is intended to be used on the `main` function of binaries or
24+
examples only. Unlike `#[wasm_bindgen(start)]`, it will not cause a function to
25+
be executed on start in a library.
2826

2927
Any return value that is supported by Rust is supported here, see
3028
[`Termination`]. In order, wasm-bindgen will first detect a

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1761,7 +1761,7 @@ pub mod __rt {
17611761
#[inline]
17621762
fn __wasm_bindgen_main(&mut self) {
17631763
if let Err(e) = self.0.take().unwrap() {
1764-
crate::throw_val(std::format!("{:?}", e).into());
1764+
crate::throw_str(&std::format!("{:?}", e));
17651765
}
17661766
}
17671767
}

0 commit comments

Comments
 (0)