Closed SiyahKara closed 2 months ago
Getting exactly the same issue. If I comment out the .instructions()
, the error goes away.
Note that the snippets is useless to us without the other relevant code for it
Here's a minimum example:
[package]
name = "fail"
version = "0.1.0"
edition = "2021"
[dependencies]
anchor-client = { version = "0.29.0", features = ["async"] }
use std::{ str::FromStr, sync::Arc };
use anchor_client::{ solana_sdk::{ pubkey::Pubkey, signature::Keypair }, Client, Cluster };
fn main() {
let program_pubkey = Pubkey::from_str("FooBar").unwrap();
let http_url = "FooBar".into();
let ws_url = "FooBar".into();
let cluster = Cluster::Custom(http_url, ws_url);
let payer = Keypair::new();
let client = Client::new(cluster, Arc::new(payer));
let program = client.program(program_pubkey).unwrap();
let instructions = program.request().accounts(accounts).args(args).instruction();
}
accounts
and args
are undefined, which gives an error, but that doesn't matter. The panic still happens in rust-analyzer console/output.
I can confirm that the issue started with version 0.3.2029.
@SiyahKara Install version 0.3.2020 for a temporary workaround.
Here's a minimum example:
Where can I get accounts
and args
in the last line?
And the last method is instructions()
, maybe?
Here you go:
[package]
name = "fail"
version = "0.1.0"
edition = "2021"
[dependencies]
anchor-client = { version = "0.29.0", features = ["async"] }
raydium-amm-v3 = { git = "https://github.com/raydium-io/raydium-clmm.git" }
use std::{ str::FromStr, sync::Arc };
use anchor_client::{ solana_sdk::{ instruction::AccountMeta, pubkey::Pubkey, signature::Keypair }, Client, Cluster };
fn main() {
let program_pubkey = Pubkey::from_str("FooBar").unwrap();
let http_url = "FooBar".into();
let ws_url = "FooBar".into();
let cluster = Cluster::Custom(http_url, ws_url);
let payer = Keypair::new();
let client = Client::new(cluster, Arc::new(payer));
let program = client.program(program_pubkey).unwrap();
let accounts = vec![AccountMeta {
pubkey: Pubkey::from_str("FooBar").unwrap(),
is_signer: false,
is_writable: false,
}];
let args = raydium_amm_v3::instruction::Swap {
amount: 1,
other_amount_threshold: 1,
sqrt_price_limit_x64: 1,
is_base_input: true,
};
let instructions = program.request().accounts(accounts).args(args).instructions();
}
Thanks! I'll try with your example code
Good news: I just made an minimal, reproducible example;
use core::ops::Deref;
struct Struct<'a, T>(&'a T)
trait Trait {}
impl<'a, T: Deref<Target = impl Trait>> Struct<'a, T> {
fn foo(&self) {
}
fn bar(&self) {
let _ = self.foo();
}
}
extracted from https://github.com/coral-xyz/anchor/blob/2a7d9439360c209542ecad9630a40605de857706/client/src/lib.rs#L515
and I think that I can fix this soon 😄
works like a charm thank you guys you are amazing
rust-analyzer version: 0.4.2048
rustc version: 1.78.0
editor or extension: VS.-Code
im recieving the following error when i try to use the anchor_lang create:
thread 'Worker' panicked at C:\Users\runneradmin.cargo\registry\src\index.crates.io-6f17d22bba15001f\chalk-ir-0.98.0\src\fold\subst.rs:59:22: mismatched kinds in substitution stack backtrace: 0: std::panicking::begin_panic 1: chalkir::fold::subst::::<impl chalk_ir::fold::FallibleTypeFolder for chalk_ir::fold::subst::Subst>::try_fold_free_var_ty 2: chalk_ir::fold::TypeSuperFoldable::super_fold_with 3: chalkir::::<impl chalk_ir::fold::TypeFoldable for chalk_ir::WhereClause>::try_fold_with 4: chalk_ir::fold::binder_impls::<impl chalk_ir::fold::TypeFoldable for chalk_ir::Binders>::try_fold_with
5: chalk_ir::Binders::substitute
6: hir_ty::infer::expr::::infer_assignee_expr
7: hir_ty::infer::expr::::infer_assignee_expr
8: hir_ty::infer::coerce::auto_deref_adjust_steps
9: hir_ty::infer::coerce::auto_deref_adjust_steps
10: hir_ty::infer::coerce::auto_deref_adjust_steps
11: hir_ty::infer::expr::::infer_assignee_expr
12: hir_ty::infer::coerce::auto_deref_adjust_steps
13: hir_ty::infer::coerce::auto_deref_adjust_steps
14: hir_ty::infer::expr::::infer_assignee_expr
15: hir_ty::infer::coerce::auto_deref_adjust_steps
16: hir_ty::infer::coerce::auto_deref_adjust_steps
17: hir_ty::infer::infer_query
18: salsa::Cycle::catch
19: salsa::derived::slot::Slot
code snippet to reproduce:
The Error happens when i try after the args(args) parameter to use .instructions()