Skip to content

TypeMismatch quickfix position error: to_owned()#22185

Draft
WeiTheShinobi wants to merge 1 commit intorust-lang:masterfrom
WeiTheShinobi:fix_type_mismatch_str_ref_to_owned_block_tail_expr
Draft

TypeMismatch quickfix position error: to_owned()#22185
WeiTheShinobi wants to merge 1 commit intorust-lang:masterfrom
WeiTheShinobi:fix_type_mismatch_str_ref_to_owned_block_tail_expr

Conversation

@WeiTheShinobi
Copy link
Copy Markdown
Contributor

@WeiTheShinobi WeiTheShinobi commented Apr 26, 2026

Part of #22152

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 26, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 26, 2026

⚠️ Warning ⚠️

  • There are uncanonicalized issue links (such as #123) in the commit messages of the following commits.
    Please add the organization and repository before the issue number (like so rust-lang/rust#123) to avoid issues with subtree.

@WeiTheShinobi WeiTheShinobi marked this pull request as draft April 26, 2026 14:49
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 26, 2026
@WeiTheShinobi WeiTheShinobi changed the title Fix issue #22152: TypeMismatch quick fix error when insert to_owned() to tail expr of block. TypeMismatch quickfix position error: to_owned() Apr 26, 2026
@WeiTheShinobi WeiTheShinobi force-pushed the fix_type_mismatch_str_ref_to_owned_block_tail_expr branch from 65b4fc7 to 94f431c Compare April 26, 2026 14:51

let edit = TextEdit::insert(range.end(), to_owned);
let mut edit_expr = expr.clone();
while let ast::Expr::BlockExpr(block) = edit_expr.clone() {
Copy link
Copy Markdown
Member

@A4-Tacks A4-Tacks Apr 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a real fix
We should fix the emit of diagnostic because d: &hir::TypeMismatch<'_> points to { "" } instead of ""

View changes since the review

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

Successfully merging this pull request may close these issues.

3 participants