Uh oh!
There was an error while loading. Please reload this page.
rustbuild: Enable WebAssembly backend by default - #46115
Conversation
alexcrichton
commented
Nov 20, 2017
This is the successor of #45905 where now that everything's in tree it's time to add some tests! This PR will ensure that the wasm32-unknown-unknown target does not regress (keeps building) and also enables all of our distributed compilers to build for wasm32 architectures by default. This PR also adds a rustup target, so after this lands it will be possible to do: and then you're ready to experiment! After this PR I'll work on adding a builder that starts running some tests so we can get some regression testing there. |
alexcrichton
commented
Nov 20, 2017
r? @kennytm |
kennytm
commented
Nov 20, 2017
LGTM. @bors r+ |
bors
commented
Nov 20, 2017
📌 Commit 2e54755 has been approved by |
est31
commented
Nov 20, 2017
Doesn't this need LLVM 5.0? Or was that requirement dropped? |
est31
commented
Nov 20, 2017
Hmm I guess it never was a hard requirement really, but there was just no testing on it... |
alexcrichton
commented
Nov 20, 2017
2e54755 to
969c9acComparealexcrichton
commented
Nov 20, 2017
re-r? @kennytm The support added for documenting all platforms when documenting the standard library was broken with wasm b/c it didn't share enough in common to compile the unix/windows "tiny shims". I ended up using |
kennytm
commented
Nov 20, 2017
r=me after tidy fix. |
969c9ac to
dae3bb3Comparealexcrichton
commented
Nov 20, 2017
@bors: r=kennytm |
bors
commented
Nov 20, 2017
📌 Commit dae3bb3 has been approved by |
bors
commented
Nov 25, 2017
⌛ Testing commit dae3bb3de9602cf5d5cc8cfe61cd1059c33777dd with merge 4d6744e7de8a198b177f6f7b5d4c251cd6a730ad... |
bors
commented
Nov 25, 2017
💔 Test failed - status-travis |
Cannot document libstd for Details |
There was a problem hiding this comment.
This should be #[cfg(any(unix, target_os = "redox"))] I guess.
But it also needs #[cfg(target_os = "redox")] use os::linux as platform;.
This commit alters how we compile LLVM by default enabling the WebAssembly backend. This then also adds the wasm32-unknown-unknown target to get compiled on the `cross` builder and distributed through rustup. Tests are not yet enabled for this target but that should hopefully be coming soon!
dae3bb3 to
48996f9Comparealexcrichton
commented
Nov 25, 2017
@bors: r=kennytm |
bors
commented
Nov 25, 2017
📌 Commit 48996f9 has been approved by |
bors
commented
Nov 25, 2017
rustbuild: Enable WebAssembly backend by default This commit alters how we compile LLVM by default enabling the WebAssembly backend. This then also adds the wasm32-unknown-unknown target to get compiled on the `cross` builder and distributed through rustup. Tests are not yet enabled for this target but that should hopefully be coming soon!
bors
commented
Nov 25, 2017
☀️ Test successful - status-appveyor, status-travis |
I found that function with return type front-end caller letwasmInstance="";letaddRust="";fetchAndInstantiate('small-add.wasm',{}).then(instance=>{wasmInstance=instance;console.log("wasmInstance instantiated in line 11");sayHello=wasmInstance.exports.say_hello;console.log("function sayHello instantiated in line 17");console.log(sayHello());});back-end callee: #[no_mangle]pubfnsay_hello() -> &'staticstr{"hello, world! hello, rust wasm!"} |
badboy
commented
Nov 28, 2017
@huangjj27 That's on purpose and is simply the way Rust works. Strings, Vec, slices, etc. are returned by writing a pointer and additional data to a caller-allocated memory buffer, from which the caller has to read it after calling the function. Wasm has no idea about the layout of Strings. @killercup and I are working on a bit of JS boilerplate to handle those cases easily in wasm-experiments |
Rustdoc has for some time now used the "everybody loops" pass in the compiler to avoid typechecking and otherwise avoid looking at implementation details. In rust-lang#46115 the placement of this pass was pushed back in the compiler to after macro expansion to ensure that it works with macro-expanded code as well. This in turn caused the regression in rust-lang#46271. The bug here was that the resolver was producing `def_id` instances for "possibly unused extern crates" which would then later get processed during typeck to actually issue lint warnings. The problem was that *after* resolution these `def_id` nodes were actually removed from the AST by the "everybody loops" pass. This later, when we tried to take a look at `def_id`, caused the compiler to panic. The fix applied here is a bit of a heavy hammer which is to just, in this one case, ignore the `extern crate` lints if the `def_id` looks "bogus" in any way (basically if it looks like the node was removed after resolution). The real underlying bug here is probably that the "everybody loops" AST pass is being stressed to much beyond what it was originally intended to do, but this should at least fix the ICE for now... Closesrust-lang#46271
rustc: Filter out bogus extern crate warnings Rustdoc has for some time now used the "everybody loops" pass in the compiler to avoid typechecking and otherwise avoid looking at implementation details. In rust-lang#46115 the placement of this pass was pushed back in the compiler to after macro expansion to ensure that it works with macro-expanded code as well. This in turn caused the regression in rust-lang#46271. The bug here was that the resolver was producing `def_id` instances for "possibly unused extern crates" which would then later get processed during typeck to actually issue lint warnings. The problem was that *after* resolution these `def_id` nodes were actually removed from the AST by the "everybody loops" pass. This later, when we tried to take a look at `def_id`, caused the compiler to panic. The fix applied here is a bit of a heavy hammer which is to just, in this one case, ignore the `extern crate` lints if the `def_id` looks "bogus" in any way (basically if it looks like the node was removed after resolution). The real underlying bug here is probably that the "everybody loops" AST pass is being stressed to much beyond what it was originally intended to do, but this should at least fix the ICE for now... Closesrust-lang#46271
This commit alters how we compile LLVM by default enabling the WebAssembly
backend. This then also adds the wasm32-unknown-unknown target to get compiled
on the
crossbuilder and distributed through rustup. Tests are not yet enabledfor this target but that should hopefully be coming soon!