rust/src/test/ui/issues/issue-53692.rs

18 lines
499 B
Rust
Raw Normal View History

2018-09-09 07:05:46 -05:00
fn main() {
let items = vec![1, 2, 3];
let ref_items: &[i32] = &items;
let items_clone: Vec<i32> = ref_items.clone();
2018-11-27 03:56:36 -06:00
//~^ ERROR mismatched types
2018-09-09 07:05:46 -05:00
2018-09-09 08:43:41 -05:00
// in that case no suggestion will be triggered
let items_clone_2:Vec<i32> = items.clone();
2018-09-09 07:05:46 -05:00
let s = "hi";
let string: String = s.clone();
2018-11-27 03:56:36 -06:00
//~^ ERROR mismatched types
2018-09-09 08:43:41 -05:00
// in that case no suggestion will be triggered
let s2 = "hi";
let string_2: String = s2.to_string();
2018-09-09 07:05:46 -05:00
}