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

cannot compile code with function pointer #89

Open
chungwong opened this issue Jun 28, 2023 · 0 comments
Open

cannot compile code with function pointer #89

chungwong opened this issue Jun 28, 2023 · 0 comments

Comments

@chungwong
Copy link

It looks like function pointers are not support at this moment.

fn add_one(x: i32) -> i32 {
    x + 1
}

fn do_twice(f: fn(i32) -> i32, arg: i32) -> i32 {
    f(arg) + f(arg)
}

fn main() {
    let answer = do_twice(add_one, 5);

    println!("The answer is: {}", answer);
}
Checking aquascope_tmp_proj v0.1.0 (/app/aquascope_tmp_proj)

Running
 
`CARGO=/usr/local/rustup/toolchains/nightly-2023-04-12-x86_64-unknown-linux-musl/bin/cargo CARGO_BIN_NAME=aquascope_tmp_proj CARGO_CRATE_NAME=aquascope_tmp_proj CARGO_MANIFEST_DIR=/app/aquascope_tmp_proj CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=aquascope_tmp_proj CARGO_PKG_README='' CARGO_PKG_REPOSITORY='' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 LD_LIBRARY_PATH='/app/aquascope_tmp_proj/target/plugin-nightly-2023-04-12/debug/deps:/root/.cache/miri/lib:/usr/local/rustup/toolchains/nightly-2023-04-12-x86_64-unknown-linux-musl/lib' /usr/local/cargo/bin/aquascope-driver rustc --crate-name aquascope_tmp_proj --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 -C metadata=3455252d1c09473c -C extra-filename=-3455252d1c09473c --out-dir /app/aquascope_tmp_proj/target/plugin-nightly-2023-04-12/debug/deps -C incremental=/app/aquascope_tmp_proj/target/plugin-nightly-2023-04-12/debug/incremental -L dependency=/app/aquascope_tmp_proj/target/plugin-nightly-2023-04-12/debug/deps -C target-feature=-crt-static`


thread 'rustc' panicked at '`ref_to_mplace` called on non-ptr type', /rustc/9df3a39fb30575d808e70800f9fad5362aac57a2/compiler/rustc_const_eval/src/interpret/place.rs:321:47
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: could not compile `aquascope_tmp_proj` (bin "aquascope_tmp_proj")

Caused by:
  process didn't exit successfully: `CARGO=/usr/local/rustup/toolchains/nightly-2023-04-12-x86_64-unknown-linux-musl/bin/cargo CARGO_BIN_NAME=aquascope_tmp_proj CARGO_CRATE_NAME=aquascope_tmp_proj CARGO_MANIFEST_DIR=/app/aquascope_tmp_proj CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=aquascope_tmp_proj CARGO_PKG_README='' CARGO_PKG_REPOSITORY='' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 LD_LIBRARY_PATH='/app/aquascope_tmp_proj/target/plugin-nightly-2023-04-12/debug/deps:/root/.cache/miri/lib:/usr/local/rustup/toolchains/nightly-2023-04-12-x86_64-unknown-linux-musl/lib' /usr/local/cargo/bin/aquascope-driver rustc --crate-name aquascope_tmp_proj --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 -C metadata=3455252d1c09473c -C extra-filename=-3455252d1c09473c --out-dir /app/aquascope_tmp_proj/target/plugin-nightly-2023-04-12/debug/deps -C incremental=/app/aquascope_tmp_proj/target/plugin-nightly-2023-04-12/debug/incremental -L dependency=/app/aquascope_tmp_proj/target/plugin-nightly-2023-04-12/debug/deps -C target-feature=-crt-static` (exit status: 101)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants