aptos-core icon indicating copy to clipboard operation
aptos-core copied to clipboard

[Bug] `aptos move compile` results in Rust panic

Open banool opened this issue 2 years ago • 2 comments

Repro

Clean everything up:

rm -rf .aptos
rm -rf ~/.move

Make a new directory with this Move.toml in it:

[package]
name = "AptosInfiniteJukebox"
version = "0.2.1"
upgrade_policy = "compatible"

[dependencies.AptosFramework]
git = 'https://github.com/aptos-labs/aptos-core.git'
rev = 'testnet'
subdir = 'aptos-move/framework/aptos-framework'

[addresses]
AptosInfiniteJukebox = "c40f1c9b9fdc204cf77f68c9bb7029b0abbe8ad9e5561f7794964076a4fbdcfd"

Set sources/AptosInfiniteJukebox.move to this: https://gist.github.com/banool/14f92342c3216a721959cff5fb911a8a.

You then get this error:

$ aptos move compile
Compiling, may take a little while to download git dependencies...
INCLUDING DEPENDENCY AptosFramework
INCLUDING DEPENDENCY AptosStdlib
INCLUDING DEPENDENCY MoveStdlib
BUILDING AptosInfiniteJukebox
thread 'main' panicked at 'assertion failed: !context.env.has_errors()', /Users/runner/.cargo/git/checkouts/move-0639dd674f581c30/6a32284/language/move-compiler/src/expansion/translate.rs:1190:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I'm aware in this case that code in the move file is very outdated. Despite that, I wouldn't expect a panic.

More info:

$ aptos info
{
  "Result": {
    "build_branch": "main",
    "build_cargo_version": "cargo 1.63.0 (fd9c4297c 2022-07-01)",
    "build_commit_hash": "01108a2345b87d539d54a67b32db55193f9ace40",
    "build_is_release_build": "true",
    "build_os": "macos-x86_64",
    "build_pkg_version": "1.0.0",
    "build_profile_name": "cli",
    "build_rust_channel": "1.63.0-x86_64-apple-darwin",
    "build_rust_version": "rustc 1.63.0 (4b91a6ea7 2022-08-08)",
    "build_tag": "",
    "build_time": "2022-10-17 15:45:32 +00:00",
    "build_using_tokio_unstable": "true"
  }
}

banool avatar Nov 03 '22 22:11 banool

Making sure @runtian-zhou, @wrwg and @vgao1996 see this...

alinush avatar Nov 04 '22 00:11 alinush

Okay once I just changed public(script) to public entry it fixed it, that should hopefully help you figure out how to fix the panic.

banool avatar Nov 05 '22 04:11 banool

This issue is stale because it has been open 45 days with no activity. Remove the stale label or comment - otherwise this will be closed in 15 days.

github-actions[bot] avatar Dec 21 '22 01:12 github-actions[bot]