-
Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Labels
A-type-systemArea: Type systemArea: Type system
Description
A small issue with hints and type inference, I don't fully grok what's going on so here is some code to better explain what I'm seeing:
fn main() {
let f: int = std::rand::random() % 100i;
// Or
// let f: int = (std::rand::random() % 100i) * 20i;
} inf.rs:2:18: 2:37 error: the type of this value must be known in this context
inf.rs:2 let f: int = std::rand::random() % 100i;
^~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
However with:
fn main() {
let f: int = 100i % std::rand::random(); // works but obviously incorrect
} rand::random<int>() is successfully deduced.
Why might this be the case?
Metadata
Metadata
Assignees
Labels
A-type-systemArea: Type systemArea: Type system