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

example move code build failed #17087

Open
leihuhu opened this issue Apr 8, 2024 · 1 comment
Open

example move code build failed #17087

leihuhu opened this issue Apr 8, 2024 · 1 comment
Labels
doc-issue Issue submitted using the Doc issue template move

Comments

@leihuhu
Copy link

leihuhu commented Apr 8, 2024

Steps to Reproduce Issue

Follow the doc: https://docs.sui.io/guides/developer/first-app/write-package

  1. use the command: sui move new my_first_package
  2. copy the code to my_module.move file
  3. build my package with sui move build

Expected Result

build success.

Actual Result

error[E01003]: invalid modifier
  ┌─ sources/my_module.move:9:5
  │
9 │     struct Sword has key, store {
  │     ^^^^^^ Invalid struct declaration. Internal struct declarations are not yet supported
  │
  = Visibility annotations are required on struct declarations from the Move 2024 edition onwards.

error[E01003]: invalid modifier
   ┌─ sources/my_module.move:15:5
   │
15 │     struct Forge has key, store {
   │     ^^^^^^ Invalid struct declaration. Internal struct declarations are not yet supported
   │
   = Visibility annotations are required on struct declarations from the Move 2024 edition onwards.

Failed to build Move modules: Compilation error.

The [pachage] in Move.toml is:

[package]
name = "my_first_package"
edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move
# license = ""           # e.g., "MIT", "GPL", "Apache 2.0"
# authors = ["..."]      # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"]

The edition should be annotated!!!

System Information

  • OS: Linux version 5.15.0-101-generic (buildd@lcy02-amd64-032) (gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38)
  • Compiler: sui 1.22.0-036299745
@summertoo
Copy link

change edition = "2024.beta" to #edition = "2024.beta" or add public struct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-issue Issue submitted using the Doc issue template move
Projects
None yet
Development

No branches or pull requests

3 participants