Rust uses Hindley-Milner type system. It is a set of rules about establishing types of expressions based on their usage.
Formal description and explanation for it can be found there:
More Related Contents:
- What is the difference between iter and into_iter?
- How does for syntax differ from a regular lifetime bound?
- Why is this match pattern unreachable when using non-literal patterns?
- Proper way to return a new string in Rust
- Double mutable borrow error in a loop happens even with NLL on
- How to return a reference to a sub-value of a value that is under a mutex?
- Is it possible to make a type only movable and not copyable?
- How to use struct self in member method closure
- How do I call a function through a member variable?
- How do you pass a Rust function as a parameter?
- How do I implement a trait with a generic method?
- Is there a way to create a function pointer to a method in Rust?
- How do I use conditional compilation with `cfg` and Cargo?
- When I can use either Cell or RefCell, which should I choose?
- Return an async function from a function in Rust
- How to implement `serde::Serialize` for a boxed trait object?
- Borrow two mutable values from the same HashMap
- Can I take a byte array and deserialize it into a struct?
- How do I create a Rust callback function to pass to a FFI function?
- Why does a lazy-static value claim to not implement a trait that it clearly implements?
- How do I convert a usize to a u32 using TryFrom?
- Borrow pointer errors recursively traversing tree [duplicate]
- How can I borrow from a HashMap to read and write at the same time?
- How to print a Vec?
- Why should I prefer `Option::ok_or_else` instead of `Option::ok_or`?
- Downcast traits inside Rc for AST manipulation
- Why does Valgrind not detect a memory leak in a Rust program using nightly 1.29.0?
- How to check in Rust if architecture is 32 or 64 bit?
- What is the null pointer optimization in Rust?
- Is there any way to restrict a generic type to one of several types?