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)

image 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

Most upvoted comments

@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.