`mismatched types`: data type not inferred by compiler
Open
Nobody has claimed this yet.
A-coercions
A-inference
C-discussion
T-types
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.2k
- PR merge metrics
- PR metrics pending
Description
fn main() {
let arr = vec![1, 2, 3];
let x1 = (&arr[0..0], &arr[0..0]);
assert_eq!(x1, (&[], &[]));
}
compiler error:
mismatched types
expected tuple `(&[{integer}], &[{integer}])`
found tuple `(&[_; 0], &[_; 0])`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by compiling the minimal Rust reproduction in the issue and confirm the reported mismatch between the inferred vector element type and the empty array literals. Trace the compiler's type inference and diagnostics for this case; done means determining the intended behavior and adding a regression test if a fix is appropriate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100