-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Rustc: rustc 1.87.0 (17067e9ac 2025-05-09)
Anchor: anchor-cli 0.31.1
I've run
anchor init my_project
and then build then check, I get warnings. While I can resolve this by ignoring them with #![
directive ... I just think a fresh project shouldn't have such warnings, so I must be doing something wrong, any help is appreciated. I run in a container, container dockerfile at end of post.
Note: I ran cargo update -p solana_program_entrypoint
but that was wrong too, cargo update -p solana-program-entrypoint
is the correct command, but low n behold I'm up-2-date, as I should be with a fresh install/project.
warning: use of deprecated method `anchor_lang::prelude::AccountInfo::<'a>::realloc`: Use AccountInfo::resize() instead
--> programs/template-rust-solana/src/lib.rs:6:1
|
6 | #[program]
| ^^^^^^^^^^
|
= note: `#[warn(deprecated)]` on by default
= note: this warning originates in the attribute macro `program` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: `template-rust-solana` (lib) generated 1 warning
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.10s
vscode ➜ /workspaces/template-rust-solana (feat-add-template-for-solana-projects-CU-86cz8t45n) $ rustc --version
rustc 1.87.0 (17067e9ac 2025-05-09)
vscode ➜ /workspaces/template-rust-solana (feat-add-template-for-solana-projects-CU-86cz8t45n) $ cargo check
warning: use of deprecated method `anchor_lang::prelude::AccountInfo::<'a>::realloc`: Use AccountInfo::resize() instead
--> programs/template-rust-solana/src/lib.rs:6:1
|
6 | #[program]
| ^^^^^^^^^^
|
= note: `#[warn(deprecated)]` on by default
= note: this warning originates in the attribute macro `program` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: `template-rust-solana` (lib) generated 1 warning
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.04s
vscode ➜ /workspaces/template-rust-solana (feat-add-template-for-solana-projects-CU-86cz8t45n) $ cargo check
warning: unexpected `cfg` condition value: `custom-heap`
--> programs/template-rust-solana/src/lib.rs:5:1
|
5 | #[program]
| ^^^^^^^^^^
|
= note: expected values for `feature` are: `cpi`, `default`, `idl-build`, `no-entrypoint`, `no-idl`, and `no-log-ix-name`
= note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate
= help: try referring to `$crate::custom_heap_default` crate for guidance on how handle this unexpected cfg
= help: the macro `$crate::custom_heap_default` may come from an old version of the `solana_program_entrypoint` crate, try updating your dependency with `cargo update -p solana_program_entrypoint`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
= note: this warning originates in the macro `$crate::custom_heap_default` which comes from the expansion of the attribute macro `program` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unexpected `cfg` condition value: `solana`
--> programs/template-rust-solana/src/lib.rs:5:1
|
5 | #[program]
| ^^^^^^^^^^
|
= note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, and `unknown` and 8 more
= note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate
= help: try referring to `$crate::custom_heap_default` crate for guidance on how handle this unexpected cfg
= help: the macro `$crate::custom_heap_default` may come from an old version of the `solana_program_entrypoint` crate, try updating your dependency with `cargo update -p solana_program_entrypoint`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: this warning originates in the macro `$crate::custom_heap_default` which comes from the expansion of the attribute macro `program` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unexpected `cfg` condition value: `custom-panic`
--> programs/template-rust-solana/src/lib.rs:5:1
|
5 | #[program]
| ^^^^^^^^^^
|
= note: expected values for `feature` are: `cpi`, `default`, `idl-build`, `no-entrypoint`, `no-idl`, and `no-log-ix-name`
= note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate
= help: try referring to `$crate::custom_panic_default` crate for guidance on how handle this unexpected cfg
= help: the macro `$crate::custom_panic_default` may come from an old version of the `solana_program_entrypoint` crate, try updating your dependency with `cargo update -p solana_program_entrypoint`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: this warning originates in the macro `$crate::custom_panic_default` which comes from the expansion of the attribute macro `program` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unexpected `cfg` condition value: `solana`
--> programs/template-rust-solana/src/lib.rs:5:1
|
5 | #[program]
| ^^^^^^^^^^
|
= note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, and `unknown` and 8 more
= note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate
= help: try referring to `$crate::custom_panic_default` crate for guidance on how handle this unexpected cfg
= help: the macro `$crate::custom_panic_default` may come from an old version of the `solana_program_entrypoint` crate, try updating your dependency with `cargo update -p solana_program_entrypoint`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: this warning originates in the macro `$crate::custom_panic_default` which comes from the expansion of the attribute macro `program` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unexpected `cfg` condition value: `anchor-debug`
--> programs/template-rust-solana/src/lib.rs:5:1
|
5 | #[program]
| ^^^^^^^^^^
|
= note: expected values for `feature` are: `cpi`, `default`, `idl-build`, `no-entrypoint`, `no-idl`, and `no-log-ix-name`
= note: using a cfg inside a attribute macro will use the cfgs from the destination crate and not the ones from the defining crate
= help: try referring to `program` crate for guidance on how handle this unexpected cfg
= help: the attribute macro `program` may come from an old version of the `anchor_attribute_program` crate, try updating your dependency with `cargo update -p anchor_attribute_program`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: this warning originates in the attribute macro `program` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unexpected `cfg` condition value: `anchor-debug`
--> programs/template-rust-solana/src/lib.rs:5:1
|
5 | #[program]
| ^^^^^^^^^^
|
= note: expected values for `feature` are: `cpi`, `default`, `idl-build`, `no-entrypoint`, `no-idl`, and `no-log-ix-name`
= note: using a cfg inside a derive macro will use the cfgs from the destination crate and not the ones from the defining crate
= help: try referring to `Accounts` crate for guidance on how handle this unexpected cfg
= help: the derive macro `Accounts` may come from an old version of the `anchor_derive_accounts` crate, try updating your dependency with `cargo update -p anchor_derive_accounts`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: this warning originates in the derive macro `Accounts` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: use of deprecated method `anchor_lang::prelude::AccountInfo::<'a>::realloc`: Use AccountInfo::resize() instead
--> programs/template-rust-solana/src/lib.rs:5:1
|
5 | #[program]
| ^^^^^^^^^^
|
= note: `#[warn(deprecated)]` on by default
= note: this warning originates in the attribute macro `program` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: `template-rust-solana` (lib) generated 12 warnings (5 duplicates)
FROM mcr.microsoft.com/devcontainers/rust:latest
# SYSTEM SETUP
USER root
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
protobuf-compiler pkg-config libssl-dev clang curl ca-certificates bzip2
# Install Node.js 22 LTS
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Yarn globally via npm
RUN npm install -g mocha \
&& npm install -g yarn
# Install NATS CLI (latest)
RUN curl -sf https://binaries.nats.dev/nats-io/natscli/nats@latest | bash \
&& mv nats /usr/local/bin \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Switch to vscode for user-level installs/configs
USER vscode
# Install Rust toolchains, add useful components, and install cargo-cache (maximise cache)
RUN rustup default stable \
&& rustup component add clippy rustfmt --toolchain stable \
&& cargo install cargo-cache
# Install Solana CLI as the vscode user (puts binaries in ~/.local/share/solana/...)
RUN curl -sSfL https://release.anza.xyz/stable/install | sh \
&& /home/vscode/.local/share/solana/install/active_release/bin/solana config set -ul
# Install Anchor CLI for current user,
RUN cargo install --git https://github.com/coral-xyz/anchor anchor-cli --locked
USER root
RUN rustup update stable \
&& rustup install nightly \
&& rustup component add clippy rustfmt --toolchain nightly
USER vscode
# NATS CLI config (as vscode user)
RUN mkdir -p ~/.config/nats \
&& nats context add development --server=nats://nats:4222 --description="Development NATS Server" \
&& nats context select development
ENV PATH="/usr/local/bin:/home/vscode/.local/share/solana/install/active_release/bin:/home/vscode/.cargo/bin:${PATH}"
dima74
Metadata
Metadata
Assignees
Labels
No labels