It appears that the link to cargo-concordium for Windows is broken or access is denied. I get a XML file in return saying that access is denied, much like a soap service response.
Ok, so now the link works and I get “cargo-concordium_1.0.0-2.exe”, but how exactly am I suppose to use this tool?
All I see it offers me is a command to get a help text (2 lines) and a command to get the version.
How is this used with VS Code and Rust? … What am I missing?
We appreciate your interest in Concordium’s smart contracts!
I’m not sure what happened regarding the link, but I’m glad it worked out.
You should rename cargo-concordium_1.0.0-2.exe to cargo-concordium.exe and make sure that it is on your PATH.
This can be achieved by either:
Moving the executable to a folder that is already on your PATH, for example C:\Users\<your-username>\.cargo\bin\ (replacing <your-username> with your actual username).
Thank you for explaining.
When you’re new to Rust in general, this part wasn’t really self explaining to me. My plan was indeed to try out the Piggy Bank tutorial.
I agree, this is not clear from the documentation either and will probably confuse more people in the future. We’ll add it to the smart contract tool installation guide.
Thanks for bringing this to our attention, and hope you’ll have a nice learning experience!
I’m having problems with the Piggy Bank sample - the test in the tutorial won’t build when trying “cargo test” as described.
I get “error: linking with link.exe failed: exit code: 1169” and a whole lot of other text, but this is the overall error message.
Before adding the test to the library, it was building just fine though - as I recall.
UPDATE: I found that the compile doesn’t fail if I use “cargo concordium test”.
However that doesn’t seem to be the idea until I’m supposed to compile to wasm, as I understand it.
So it is still a problem that “cargo test” fails.
From what I can tell this error message is caused by multiple symbols with the same name. Is it possible that the name of your test collides with the name of another function?
Yeah it’s really odd, if I remove all tests from the code so I only have the piggy bank code itself, I get the error on “cargo build”… However, not on “cargo concordium build”.
That seemed to fix the problem - not that I’m sure what the first line does exactly. Apparently some Rust stuff was uninstalled because VS Code wanted to install some Rust specifics when I tried to use the online samples. I didn’t take everything from the online samples though, just the lib.rs content.
I tried to create 2 libs, one with and one without the tests and they both build now. Here is the output from building the one including the tests.
warning: panic message is not a string literal
--> src\lib.rs:100:9
|
100 | / claim_eq!(
101 | | state,
102 | | PiggyBankState::Intact,
103 | | "Piggy bank state should be intact after initialization."
104 | | );
| |__________^
|
= note: `#[warn(non_fmt_panics)]` on by default
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
= note: this warning originates in the macro `$crate::fail` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: panic message is not a string literal
--> src\lib.rs:120:9
|
120 | claim_eq!(actions, ActionsTree::accept(), "No action should be produced.");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
= note: this warning originates in the macro `$crate::fail` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: panic message is not a string literal
--> src\lib.rs:121:9
|
121 | claim_eq!(state, PiggyBankState::Intact, "Piggy bank state should still be intact.");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
= note: this warning originates in the macro `$crate::fail` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: panic message is not a string literal
--> src\lib.rs:135:9
|
135 | claim!(actions_result.is_err(), "Should failed when piggy bank is smashed.");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
= note: this warning originates in the macro `$crate::fail` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: panic message is not a string literal
--> src\lib.rs:157:9
|
157 | claim_eq!(actions, ActionsTree::simple_transfer(&owner, balance));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
= note: this warning originates in the macro `$crate::fail` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: panic message is not a string literal
--> src\lib.rs:158:9
|
158 | claim_eq!(state, PiggyBankState::Smashed);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
= note: this warning originates in the macro `$crate::fail` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: panic message is not a string literal
--> src\lib.rs:179:9
|
179 | claim_eq!(err, SmashError::NotOwner, "Expected to fail with error NotOwner")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
= note: this warning originates in the macro `$crate::fail` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: panic message is not a string literal
--> src\lib.rs:199:9
|
199 | claim_eq!(err, SmashError::AlreadySmashed, "Expected to fail with error AlreadySmashed")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
= note: this warning originates in the macro `$crate::fail` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: `piggy_bank3` (lib test) generated 8 warnings
Finished test [unoptimized + debuginfo] target(s) in 1.76s
Running unittests (target\debug\deps\piggy_bank3-c8e6d63a271fb3bd.exe)
running 6 tests
test tests::test_init ... ok
test tests::test_insert_intact ... ok
test tests::test_insert_smashed ... ok
test tests::test_smash_intact ... ok
test tests::test_smash_intact_not_owner ... ok
test tests::test_smash_smashed ... ok
test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s