rust-analyzer: A misdiagnosed case of type mismatch
rust-analyzer version: bc08b8eff 2022-03-28 stable
rustc version: 1.59.0 (9d1b2106e 2022-02-23)
I tried the example in https://smallcultfollowing.com/babysteps//blog/2022/03/29/dyn-can-we-make-dyn-sized/ and found that r-a gives wrong diagnostics.
The source code:
use std::fmt::Debug;
fn print_me_later(x: &dyn Debug) -> impl FnOnce() + '_ {
move || println!("{x:?}")
}
fn main() {
let f = print_me_later(&22);
f()
}
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 5
- Comments: 15 (14 by maintainers)
Commits related to this issue
- fix #11847 a mismatch case — committed to bitgaoshu/rust-analyzer by bitgaoshu 5 years ago
- Rollup merge of #111121 - Zalathar:ra-false-positive, r=jackh726 Work around `rust-analyzer` false-positive type errors rust-analyzer incorrectly reports two type errors in `debug.rs`: > expected &... — committed to matthiaskrgr/rust by matthiaskrgr 3 years ago
@lasantosr 1.84 only stabilized the use of the new trait solver in coherence, i.e. it is being used to check that trait
impls don’t overlap. Stabilization of the new trait solver is also mostly independent from work on using the new trait solver in r-a – the trait solver is “just” a library, the fact that rustc is using it does not necessarily affect r-a.If you want to follow integration of r-a and the new trait solver there is this zulip thread: https://rust-lang.zulipchat.com/#narrow/channel/185405-t-compiler.2Frust-analyzer/topic/Implmentating.20New.20Trait.20Solver
But tl;dr: no, this isn’t unblocked yet.
Yes, this is probably blocked on the new trait solver.