-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Open
Labels
A-inferenceArea: Type inferenceArea: Type inferenceC-bugCategory: This is a bug.Category: This is a bug.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Description
fn main1() {
let vec1 = [1,2,3,4,5].into_iter().collect();
let _vec2 : &Vec<usize> = &vec1;
// this compiles
println!("{}", vec1[0]);
}
fn main2() {
let vec1 = [1,2,3,4,5].into_iter().collect();
// this doesn't compile
println!("{}", vec1[0]);
let _vec2 : &Vec<usize> = &vec1;
}
I wonder if it is possible to make the two code snippets act the same?
asukaminato0721
Metadata
Metadata
Assignees
Labels
A-inferenceArea: Type inferenceArea: Type inferenceC-bugCategory: This is a bug.Category: This is a bug.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.