Skip to content

Commit

Permalink
Update rust to v1.62 (#2272)
Browse files Browse the repository at this point in the history
* update rust from v1.56 to v1.65

* remove unnecessary borrows to appease clippy

* stop clippy complaining for now

* use 1.64 instead because of CI stuff

* update CHANGLEOG

* just seeing if the cli version is affecting the available rust version

* ok, back to 1.62

Co-authored-by: henrye <henry@notanemail>
  • Loading branch information
Henry-E and henrye committed Nov 22, 2022
1 parent afbbbb0 commit 5291a7b
Show file tree
Hide file tree
Showing 64 changed files with 404 additions and 405 deletions.
663 changes: 331 additions & 332 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion avm/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "avm"
version = "0.25.0"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[[bin]]
Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Expand Up @@ -2,7 +2,7 @@
name = "anchor-cli"
version = "0.25.0"
authors = ["armaniferrante <armaniferrante@gmail.com>"]
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"
repository = "https://github.com/coral-xyz/anchor"
description = "Anchor CLI"
Expand Down
20 changes: 10 additions & 10 deletions cli/src/lib.rs
Expand Up @@ -604,7 +604,7 @@ fn new(cfg_override: &ConfigOverride, name: String) -> Result<()> {
println!("Unable to make new program");
}
Some(parent) => {
std::env::set_current_dir(&parent)?;
std::env::set_current_dir(parent)?;
new_program(&name)?;
println!("Created new program.");
}
Expand Down Expand Up @@ -871,7 +871,7 @@ fn build_cwd(
) -> Result<()> {
match cargo_toml.parent() {
None => return Err(anyhow!("Unable to find parent")),
Some(p) => std::env::set_current_dir(&p)?,
Some(p) => std::env::set_current_dir(p)?,
};
match build_config.verifiable {
false => _build_cwd(cfg, idl_out, idl_ts_out, skip_lint, cargo_args),
Expand Down Expand Up @@ -983,7 +983,7 @@ fn docker_build(
let target_dir = workdir.join("docker-target");
println!("Run docker image");
let exit = std::process::Command::new("docker")
.args(&[
.args([
"run",
"-it",
"-d",
Expand Down Expand Up @@ -1095,7 +1095,7 @@ fn docker_build_bpf(

// Execute the build.
let exit = std::process::Command::new("docker")
.args(&[
.args([
"exec",
"--env",
"PATH=/root/.local/share/solana/install/active_release/bin:/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
Expand Down Expand Up @@ -1138,7 +1138,7 @@ fn docker_build_bpf(
bin_path.as_path().to_str().unwrap()
);
let exit = std::process::Command::new("docker")
.args(&["cp", &bin_artifact, &out_file])
.args(["cp", &bin_artifact, &out_file])
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.output()
Expand All @@ -1160,7 +1160,7 @@ fn docker_cleanup(container_name: &str, target_dir: &Path) -> Result<()> {
// Remove the docker image.
println!("Removing the docker container");
let exit = std::process::Command::new("docker")
.args(&["rm", "-f", container_name])
.args(["rm", "-f", container_name])
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.output()
Expand Down Expand Up @@ -2317,10 +2317,10 @@ fn test_validator_file_paths(test_validator: &Option<TestValidator>) -> (String,
std::process::exit(1);
}
if Path::new(&ledger_directory).exists() {
fs::remove_dir_all(&ledger_directory).unwrap();
fs::remove_dir_all(ledger_directory).unwrap();
}

fs::create_dir_all(&ledger_directory).unwrap();
fs::create_dir_all(ledger_directory).unwrap();

(
ledger_directory.to_string(),
Expand Down Expand Up @@ -2675,7 +2675,7 @@ fn set_workspace_dir_or_exit() {
println!("Unable to make new program");
}
Some(parent) => {
if std::env::set_current_dir(&parent).is_err() {
if std::env::set_current_dir(parent).is_err() {
println!("Not in anchor workspace.");
std::process::exit(1);
}
Expand Down Expand Up @@ -2770,7 +2770,7 @@ fn shell(cfg_override: &ConfigOverride) -> Result<()> {
let url = cluster_url(cfg, &cfg.test_validator);
let js_code = template::node_shell(&url, &cfg.provider.wallet.to_string(), programs)?;
let mut child = std::process::Command::new("node")
.args(&["-e", &js_code, "-i", "--experimental-repl-await"])
.args(["-e", &js_code, "-i", "--experimental-repl-await"])
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.spawn()
Expand Down
2 changes: 1 addition & 1 deletion client/Cargo.toml
Expand Up @@ -2,7 +2,7 @@
name = "anchor-client"
version = "0.25.0"
authors = ["Serum Foundation <foundation@projectserum.com>"]
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"
license = "Apache-2.0"
description = "Rust client for Anchor programs"
Expand Down
2 changes: 1 addition & 1 deletion client/example/Cargo.toml
Expand Up @@ -2,7 +2,7 @@
name = "example"
version = "0.1.0"
authors = ["Armani Ferrante <armaniferrante@gmail.com>"]
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[workspace]
Expand Down
2 changes: 1 addition & 1 deletion client/src/lib.rs
Expand Up @@ -282,7 +282,7 @@ fn handle_program_log<T: anchor_lang::Event + anchor_lang::AnchorDeserialize>(
.strip_prefix(PROGRAM_LOG)
.or_else(|| l.strip_prefix(PROGRAM_DATA))
{
let borsh_bytes = match anchor_lang::__private::base64::decode(&log) {
let borsh_bytes = match anchor_lang::__private::base64::decode(log) {
Ok(borsh_bytes) => borsh_bytes,
_ => {
#[cfg(feature = "debug")]
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial/basic-0/programs/basic-0/Cargo.toml
Expand Up @@ -2,7 +2,7 @@
name = "basic-0"
version = "0.1.0"
description = "Created with Anchor"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial/basic-1/programs/basic-1/Cargo.toml
Expand Up @@ -2,7 +2,7 @@
name = "basic-1"
version = "0.1.0"
description = "Created with Anchor"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial/basic-2/programs/basic-2/Cargo.toml
Expand Up @@ -2,7 +2,7 @@
name = "basic-2"
version = "0.1.0"
description = "Created with Anchor"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[lib]
Expand Down
Expand Up @@ -2,7 +2,7 @@
name = "puppet-master"
version = "0.1.0"
description = "Created with Anchor"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial/basic-3/programs/puppet/Cargo.toml
Expand Up @@ -2,7 +2,7 @@
name = "puppet"
version = "0.1.0"
description = "Created with Anchor"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial/basic-4/programs/basic-4/Cargo.toml
Expand Up @@ -2,7 +2,7 @@
name = "basic-4"
version = "0.1.0"
description = "Created with Anchor"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion lang/Cargo.toml
Expand Up @@ -3,7 +3,7 @@ name = "anchor-lang"
version = "0.25.0"
authors = ["Serum Foundation <foundation@projectserum.com>"]
repository = "https://github.com/coral-xyz/anchor"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"
license = "Apache-2.0"
description = "Solana Sealevel eDSL"
Expand Down
2 changes: 1 addition & 1 deletion lang/attribute/access-control/Cargo.toml
Expand Up @@ -5,7 +5,7 @@ authors = ["Serum Foundation <foundation@projectserum.com>"]
repository = "https://github.com/coral-xyz/anchor"
license = "Apache-2.0"
description = "Anchor attribute macro for instruction access control"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion lang/attribute/account/Cargo.toml
Expand Up @@ -5,7 +5,7 @@ authors = ["Serum Foundation <foundation@projectserum.com>"]
repository = "https://github.com/coral-xyz/anchor"
license = "Apache-2.0"
description = "Anchor attribute macro for defining an account"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[lib]
Expand Down
4 changes: 2 additions & 2 deletions lang/attribute/account/src/id.rs
Expand Up @@ -214,10 +214,10 @@ fn parse_pubkey(
) -> Result<proc_macro2::TokenStream> {
let id_vec = bs58::decode(id_literal.value())
.into_vec()
.map_err(|_| syn::Error::new_spanned(&id_literal, "failed to decode base58 string"))?;
.map_err(|_| syn::Error::new_spanned(id_literal, "failed to decode base58 string"))?;
let id_array = <[u8; 32]>::try_from(<&[u8]>::clone(&&id_vec[..])).map_err(|_| {
syn::Error::new_spanned(
&id_literal,
id_literal,
format!("pubkey array is not 32 bytes long: len={}", id_vec.len()),
)
})?;
Expand Down
2 changes: 1 addition & 1 deletion lang/attribute/constant/Cargo.toml
Expand Up @@ -5,7 +5,7 @@ authors = ["Serum Foundation <foundation@projectserum.com>"]
repository = "https://github.com/coral-xyz/anchor"
license = "Apache-2.0"
description = "Anchor attribute macro for creating constant types"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion lang/attribute/error/Cargo.toml
Expand Up @@ -5,7 +5,7 @@ authors = ["Serum Foundation <foundation@projectserum.com>"]
repository = "https://github.com/coral-xyz/anchor"
license = "Apache-2.0"
description = "Anchor attribute macro for creating error types"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion lang/attribute/event/Cargo.toml
Expand Up @@ -5,7 +5,7 @@ authors = ["Serum Foundation <foundation@projectserum.com>"]
repository = "https://github.com/coral-xyz/anchor"
license = "Apache-2.0"
description = "Anchor attribute macro for defining an event"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion lang/attribute/interface/Cargo.toml
Expand Up @@ -5,7 +5,7 @@ authors = ["Serum Foundation <foundation@projectserum.com>"]
repository = "https://github.com/coral-xyz/anchor"
license = "Apache-2.0"
description = "Attribute for defining a program interface trait"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion lang/attribute/program/Cargo.toml
Expand Up @@ -5,7 +5,7 @@ authors = ["Serum Foundation <foundation@projectserum.com>"]
repository = "https://github.com/coral-xyz/anchor"
license = "Apache-2.0"
description = "Anchor attribute macro for defining a program"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion lang/attribute/state/Cargo.toml
Expand Up @@ -5,7 +5,7 @@ authors = ["Serum Foundation <foundation@projectserum.com>"]
repository = "https://github.com/coral-xyz/anchor"
license = "Apache-2.0"
description = "Attribute for defining a program state struct"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion lang/derive/accounts/Cargo.toml
Expand Up @@ -5,7 +5,7 @@ authors = ["Serum Foundation <foundation@projectserum.com>"]
repository = "https://github.com/coral-xyz/anchor"
license = "Apache-2.0"
description = "Anchor Derive macro for accounts"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion lang/syn/Cargo.toml
Expand Up @@ -5,7 +5,7 @@ authors = ["Serum Foundation <foundation@projectserum.com>"]
repository = "https://github.com/coral-xyz/anchor"
license = "Apache-2.0"
description = "Anchor syntax parsing and code generation tools"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[features]
Expand Down
2 changes: 1 addition & 1 deletion lang/syn/src/codegen/program/instruction.rs
Expand Up @@ -11,7 +11,7 @@ pub fn generate(program: &Program) -> proc_macro2::TokenStream {
let ctor_args: Vec<proc_macro2::TokenStream> = generate_ctor_typed_args(state)
.iter()
.map(|arg| {
format!("pub {}", parser::tts_to_string(&arg))
format!("pub {}", parser::tts_to_string(arg))
.parse()
.unwrap()
})
Expand Down
2 changes: 1 addition & 1 deletion lang/syn/src/idl/file.rs
Expand Up @@ -601,7 +601,7 @@ fn resolve_variable_array_lengths(ctx: &CrateContext, mut tts_string: String) ->
}

fn to_idl_type(ctx: &CrateContext, ty: &syn::Type) -> IdlType {
let mut tts_string = parser::tts_to_string(&ty);
let mut tts_string = parser::tts_to_string(ty);
if tts_string.starts_with('[') {
tts_string = resolve_variable_array_lengths(ctx, tts_string);
}
Expand Down
2 changes: 1 addition & 1 deletion lang/syn/src/idl/pda.rs
Expand Up @@ -300,7 +300,7 @@ impl SeedPath {
// Extracts the seed path from a single seed expression.
fn parse_seed_path(seed: &Expr) -> Option<SeedPath> {
// Convert the seed into the raw string representation.
let seed_str = parser::tts_to_string(&seed);
let seed_str = parser::tts_to_string(seed);

// Break up the seed into each sub field component.
let mut components: Vec<&str> = seed_str.split(" . ").collect();
Expand Down
2 changes: 1 addition & 1 deletion lang/syn/src/lib.rs
Expand Up @@ -164,7 +164,7 @@ impl AccountsStruct {
instruction_api
.iter()
.map(|expr| {
let arg = parser::tts_to_string(&expr);
let arg = parser::tts_to_string(expr);
let components: Vec<&str> = arg.split(" : ").collect();
assert!(components.len() == 2);
(components[0].to_string(), components[1].to_string())
Expand Down
2 changes: 1 addition & 1 deletion lang/syn/src/parser/accounts/mod.rs
Expand Up @@ -340,7 +340,7 @@ fn parse_program_account_loader(path: &syn::Path) -> ParseResult<AccountLoaderTy

fn parse_account_ty(path: &syn::Path) -> ParseResult<AccountTy> {
let account_type_path = parse_account(path)?;
let boxed = parser::tts_to_string(&path)
let boxed = parser::tts_to_string(path)
.replace(' ', "")
.starts_with("Box<Account<");
Ok(AccountTy {
Expand Down
2 changes: 1 addition & 1 deletion spl/Cargo.toml
Expand Up @@ -2,7 +2,7 @@
name = "anchor-spl"
version = "0.25.0"
authors = ["Serum Foundation <foundation@projectserum.com>"]
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"
license = "Apache-2.0"
description = "CPI clients for SPL programs"
Expand Down
Expand Up @@ -2,7 +2,7 @@
name = "bpf-upgradeable-state"
version = "0.1.0"
description = "Created with Anchor"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion tests/cashiers-check/programs/cashiers-check/Cargo.toml
Expand Up @@ -2,7 +2,7 @@
name = "cashiers-check"
version = "0.1.0"
description = "Created with Anchor"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion tests/cfo/programs/cfo/Cargo.toml
Expand Up @@ -2,7 +2,7 @@
name = "cfo"
version = "0.1.0"
description = "Created with Anchor"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion tests/chat/programs/chat/Cargo.toml
Expand Up @@ -2,7 +2,7 @@
name = "chat"
version = "0.1.0"
description = "Created with Anchor"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion tests/composite/programs/composite/Cargo.toml
Expand Up @@ -2,7 +2,7 @@
name = "composite"
version = "0.1.0"
description = "Created with Anchor"
rust-version = "1.56"
rust-version = "1.62"
edition = "2021"

[lib]
Expand Down

1 comment on commit 5291a7b

@vercel
Copy link

@vercel vercel bot commented on 5291a7b Nov 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

anchor-docs – ./

anchor-lang.com
www.anchor-lang.com
anchor-docs-200ms.vercel.app
anchor-docs-git-master-200ms.vercel.app

Please sign in to comment.