TypeMismatch quickfix position error: to_owned()#22185
TypeMismatch quickfix position error: to_owned()#22185WeiTheShinobi wants to merge 3 commits intorust-lang:masterfrom
to_owned()#22185Conversation
This comment has been minimized.
This comment has been minimized.
to_owned()
65b4fc7 to
94f431c
Compare
|
|
||
| let edit = TextEdit::insert(range.end(), to_owned); | ||
| let mut edit_expr = expr.clone(); | ||
| while let ast::Expr::BlockExpr(block) = edit_expr.clone() { |
There was a problem hiding this comment.
This is not a real fix
We should fix the emit of diagnostic because d: &hir::TypeMismatch<'_> points to { "" } instead of ""
There was a problem hiding this comment.
I moved the logic to where TypeMismatch is created and both cases have been solved,
Or should I fix this further upstream?
| ExprOrPatId::ExprId(expr) => source_map.expr_syntax(expr).map(Either::Left), | ||
| ExprOrPatId::ExprId(mut expr) => { | ||
| while let Expr::Block { tail: Some(tail), .. } = &body[expr] { | ||
| expr = *tail; |
There was a problem hiding this comment.
@ChayimFriedman2 I don't know if it's appropriate this, do you think?
There was a problem hiding this comment.
I don't think this is the place. If we have adjustments to do and we can't do them when emitting the type mismatch, we should do them in ide-diagnostics.
This comment has been minimized.
This comment has been minimized.
6514fc9 to
4c20a4d
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
739a261 to
4c20a4d
Compare
Fixed #22152