Skip to content

Example RPN code fails to run #595

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

Closed
memco opened this issue Apr 22, 2020 · 3 comments
Closed

Example RPN code fails to run #595

memco opened this issue Apr 22, 2020 · 3 comments

Comments

@memco
Copy link

memco commented Apr 22, 2020

Hi, totally new to Rust and I clicked the playground link from the Rust homepage then clicked the run button and I see this:

Compiling playground v0.0.1 (/playground)
error: Could not apply operator `*` to the current stack: [2 + 3]
  --> src/main.rs:7:9
   |
7  |         compile_error!(concat!("Could not apply operator `", stringify!($op), "` to the current stack: ", stringify!($stack)))
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
44 |     println!("{}", rpn!(2 3 + *));
   |                    ------------- in this macro invocation
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

error: could not compile `playground`.

To learn more, run the command again with --verbose.

Is it supposed to be broken? If so, what should I be looking for in order to see it run?

@shepmaster
Copy link
Member

I clicked the playground link from the Rust homepage then clicked the run button

The link to the playground on https://www.rust-lang.org/ (I assume you mean this one:)

image

Does not supply any code:

image

The default code of the playground is a basic hello world:

https://github.com/integer32llc/rust-playground/blob/77ce403cd0d4d2da0d4d424e841ce30623e3a209/ui/frontend/reducers/code.ts#L3-L5

It sounds like you visited the playground previously with that RPN code. Your last code is persisted in your local browser storage. Perhaps I should add a timestamp check and offer to reset things if someone hasn't visited the playground in sufficiently long.

@memco
Copy link
Author

memco commented Apr 30, 2020

Thanks for the explanation, I can see how the local storage feature is useful if you're using the playground as a scratch pad. I probably won't be visiting the scratch pad much for that kind of thing, but maybe the reset idea could be helpful for others like me who visited out of curiosity sometime in the past and have since forgotten they ever visited.

@shepmaster
Copy link
Member

Duplicate of #323

@shepmaster shepmaster marked this as a duplicate of #323 May 6, 2020
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

No branches or pull requests

2 participants