Skip to content

Commit aca7905

Browse files
CoAlloc: tests
1 parent c4752e7 commit aca7905

File tree

5 files changed

+12
-28
lines changed

5 files changed

+12
-28
lines changed

compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
357357
return None // do not suggest code that is already there (#53348)
358358
}
359359

360-
let method_call_list = [sym::to_vec, sym::to_string];
360+
let method_call_list = [sym::to_vec, sym::to_vec_co, sym::to_string];
361361
let mut sugg = if let ExprKind::MethodCall(receiver_method, ..) = expr.kind
362362
&& receiver_method.ident.name == sym::clone
363363
&& method_call_list.contains(&conversion_method.name)

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,6 +1482,7 @@ symbols! {
14821482
tmm_reg,
14831483
to_string,
14841484
to_vec,
1485+
to_vec_co,
14851486
todo_macro,
14861487
tool_attributes,
14871488
tool_lints,

tests/ui/suggestions/issue-53692.fixed

Lines changed: 0 additions & 20 deletions
This file was deleted.

tests/ui/suggestions/issue-53692.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// run-rustfix
21
#![allow(unused_variables)]
32

43
fn main() {

tests/ui/suggestions/issue-53692.stderr

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
error[E0308]: mismatched types
2-
--> $DIR/issue-53692.rs:7:33
2+
--> $DIR/issue-53692.rs:6:33
33
|
44
LL | let items_clone: Vec<i32> = ref_items.clone();
5-
| -------- ^^^^^^^^^^-----^^
6-
| | | |
7-
| | | help: try using a conversion method: `to_vec`
8-
| | expected `Vec<i32>`, found `&[i32]`
5+
| -------- ^^^^^^^^^^^^^^^^^ expected `Vec<i32>`, found `&[i32]`
6+
| |
97
| expected due to this
108
|
119
= note: expected struct `Vec<i32>`
1210
found reference `&[i32]`
11+
help: try using a conversion method
12+
|
13+
LL | let items_clone: Vec<i32> = ref_items.to_vec();
14+
| ~~~~~~
15+
LL | let items_clone: Vec<i32> = ref_items.to_vec_co();
16+
| ~~~~~~~~~
1317

1418
error[E0308]: mismatched types
15-
--> $DIR/issue-53692.rs:14:26
19+
--> $DIR/issue-53692.rs:13:26
1620
|
1721
LL | let string: String = s.clone();
1822
| ------ ^^-----^^

0 commit comments

Comments
 (0)