-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Type mismatch with async block to dyn Future
coercion
#11815
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
Comments
Possibly-the-same-bug appears without fn foo() {
let a = noise::Value::new();
let b: noise::ScaleBias<'_, [f64; 2]> = noise::ScaleBias::new(&a).set_bias(1.0);
} (with |
is there a way to locally disable the check for cases where this hits? |
@Emilgardis not right now. Only per-project. |
Isn't this fixed already? |
The error mentioned in the issue is still showing up, and so is the |
Any pointers on getting started on this bug? |
@arilotter this diagnostic is opt-in in newer RA versions. |
@lnicola Where is that controlled? I'm still getting the false error and I've checked my user and workspace VSCode |
It's |
I don't have that setting enabled. I'm on r-a extension {
"rust-analyzer.inlayHints.parameterHints": false,
"rust-analyzer.inlayHints.maxLength": 5,
"rust-analyzer.inlayHints.typeHints": false,
"rust-analyzer.diagnostics.disabled": [
"missing-unsafe"
],
"rust-analyzer.inlayHints.enable": false
} {
"rust-analyzer.cargo.allFeatures": true,
"rust-analyzer.assist.importPrefix": "crate",
"rust-analyzer.checkOnSave.command": "clippy",
"rust-analyzer.checkOnSave.allTargets": true,
"rust-analyzer.assist.importGranularity": "module"
} |
|
The VS Code settings UI thinks it is off by default, and editing the setting to be either explicitly true or explicitly false made no difference. |
I think the basic problem here is that currently, we just model async blocks as an opaque type, and we don't implement any logic for the hidden type behind the opaque type: rust-analyzer/crates/hir-ty/src/chalk_db.rs Lines 282 to 285 in 1f709d5
As the FIXME says, the hidden type is used to determine auto traits, and this is probably the reason Chalk says the coercion doesn't work because it doesn't implement Send .To really properly handle this, we'd need to desugar the async block to a generator like rustc does, and actually implement generators. Or at least give it some generator type, and make sure the generator type implements all necessary auto traits somehow. Alternatively we could do some hack to consider these opaque types to always implement auto traits, though I'm not sure what the best way to do this is. |
This is fixed. |
high priority as this affects all uses of
async_trait
The text was updated successfully, but these errors were encountered: