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

Incorrect type-mismatch in certain code involving trait objects #12980

Closed
umanwizard opened this issue Aug 8, 2022 · 1 comment
Closed

Incorrect type-mismatch in certain code involving trait objects #12980

umanwizard opened this issue Aug 8, 2022 · 1 comment

Comments

@umanwizard
Copy link
Contributor

Rust-analyzer emits a type-mismatch error for this code, which is accepted by rustc:

pub fn f(mut client: postgres::Client, stmt: postgres::Statement) {
    client.query_one(&stmt, &[&0]).unwrap();
}

query_one takes &[&(dyn ToSql + Sync)], and i32 is indeed both ToSql and Sync, so this should be allowed, but r-a reports expected &(dyn ToSql + Sync), found &i32 [type-mismatch].

Note that you must have postgres = "0.19.3" in Cargo.toml to reproduce this. I do not know how to reproduce this without depending on the postgres crate. I tried creating a similar thing without dependencies but the issue did not reproduce.

rust-analyzer version: rust-analyzer 0.0.0 (a02b042 2022-08-03)

rustc version: rustc 1.62.0 (a8314ef7d 2022-06-27)

relevant settings: emacs lsp-mode with '(lsp-rust-analyzer-proc-macro-enable t)

@flodiebold
Copy link
Member

Duplicate of #11847

@flodiebold flodiebold marked this as a duplicate of #11847 Aug 8, 2022
@flodiebold flodiebold closed this as not planned Won't fix, can't repro, duplicate, stale Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants