Type checker gives confusing tip when collecting std::str::Char into std::rc::Rc using std::from::From. #70959
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-bug
Category: This is a bug.
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
D-invalid-suggestion
Diagnostics: A structured suggestion resulting in incorrect code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Hey everyone,
I noticed that when collecting an
std::str::Chars
into astd::rc::Rc
usingRc::from(...)
, the compiler tells you to annotate the type on your variable, when you actually need to annotate the type of yourstd::Iter::collect()
call.This code produces the bug:
The compiler tells me to annotate the type of
r
, which already has a type annotation.In actuality the fix is to annotate the
collect()
-call:Meta
I used the following version:
rustc --version --verbose
:The current beta (1.43.0-beta.5) and stable (1.42.0) on the rust playground produce the same output.
The text was updated successfully, but these errors were encountered: