Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a --reference-types CLI flag #2257

Merged
merged 1 commit into from
Jul 28, 2020

Conversation

alexcrichton
Copy link
Contributor

This proposal is now shipping in browsers!

This proposal is now shipping in browsers!
@alexcrichton alexcrichton merged commit ebc1e92 into rustwasm:master Jul 28, 2020
@alexcrichton alexcrichton deleted the reference-types-flag branch July 28, 2020 20:13
let stack_pointer = 32;

function addBorrowedObject(obj) {
if (stack_pointer == 1) throw new Error('out of js stack');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey quick question.

How come this isn't if (stack_pointer == 0)?

What's the issue with assigning an object to heap[0].

Just for my own understanding.

Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think at some point we were reserving the first slot (index 0) as a sort of null pointer or something like that. I don't believe those plans ever panned out though so this is likely a bug that we can fix nowadays.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet thanks for explaining!

@Urhengulas
Copy link

Hello @alexcrichton 👋

Sorry if this question is unrelated, but how can I enable this option with wasm-pack?

I've tried to add following to my Cargo.toml, but this doesn't seem to do the trick...

[package.metadata.wasm-pack.profile.release.wasm-bindgen]
reference-types = true

@alexcrichton
Copy link
Contributor Author

Sorry I'm not faimliar enough with wasm-pack to know how to pass this argument. This may need a patch to wasm-bindgen.

@gilesv
Copy link

gilesv commented Aug 8, 2020

@Urhengulas There is an open PR which adds the --reference-types option to wasm-pack: rustwasm/wasm-pack#888
We will be able to use it as soon as it gets merged and released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants