rust/src
bors 2585803ec1 auto merge of #12764 : Kimundi/rust/partial_typehint, r=nikomatsakis
# Summary

This patch introduces the `_` token into the type grammar, with the meaning "infer this type".
With this change, the following two lines become equivalent:
```
let x = foo();
let x: _ = foo();
```
But due to its composability, it enables partial type hints like this:
```
let x: Bar<_> = baz();
```

Using it on the item level is explicitly forbidden, as the Rust language does not enable global type inference by design.

This implements the feature requested in https://github.com/mozilla/rust/issues/9508.

# Things requiring clarification

- The change to enable it is very small, but I have only limited understanding of the related code, so the approach here might be wrong.
  - In particular, while this patch works, it does so in a way not originally intended according to the code comments.
- This probably needs more tests, or rather feedback for which tests are still missing.
- I'm unsure how this interacts with lifetime parameters, and whether it is correct in regard to them.
- Partial type hints on the right side of `as` like `&foo as *_` work in both a normal function contexts and in constexprs like `static foo: *int = &'static 123 as *_`. The question is whether this should be allowed in general.

# Todo for this PR

- The manual and tutorial still needs updating.

# Bugs I'm unsure how to fix

- Requesting inference for the top level of the right hand side of a `as` fails to infer correctly, even if all possible hints are given:

  ```
.../type_hole_1.rs:35:18: 35:22 error: the type of this value must be known in this context
.../type_hole_1.rs:35     let a: int = 1u32 as _;
                                           ^~~~
```
2014-03-14 08:01:28 -07:00
..
compiler-rt@f4b221571c
compiletest lint: add lint for use of a ~[T]. 2014-03-14 11:28:39 +11:00
doc auto merge of #12815 : alexcrichton/rust/chan-rename, r=brson 2014-03-13 14:06:37 -07:00
driver
etc auto merge of #12815 : alexcrichton/rust/chan-rename, r=brson 2014-03-13 14:06:37 -07:00
gyp@1e46da1000
libarena lint: add lint for use of a ~[T]. 2014-03-14 11:28:39 +11:00
libbacktrace Bundle libbacktrace with the compiler 2014-03-11 21:02:34 -07:00
libcollections auto merge of #12867 : alexcrichton/rust/issue-12860, r=thestinger 2014-03-14 02:01:34 -07:00
libextra auto merge of #12861 : huonw/rust/lint-owned-vecs, r=thestinger 2014-03-13 22:26:35 -07:00
libflate lint: add lint for use of a ~[T]. 2014-03-14 11:28:39 +11:00
libfourcc
libgetopts lint: add lint for use of a ~[T]. 2014-03-14 11:28:39 +11:00
libglob lint: add lint for use of a ~[T]. 2014-03-14 11:28:39 +11:00
libgreen auto merge of #12861 : huonw/rust/lint-owned-vecs, r=thestinger 2014-03-13 22:26:35 -07:00
libhexfloat Implement hexadecimal floating point literals via a syntax extension 2014-03-10 22:36:56 +00:00
libnative auto merge of #12861 : huonw/rust/lint-owned-vecs, r=thestinger 2014-03-13 22:26:35 -07:00
libnum lint: add lint for use of a ~[T]. 2014-03-14 11:28:39 +11:00
librand auto merge of #12861 : huonw/rust/lint-owned-vecs, r=thestinger 2014-03-13 22:26:35 -07:00
librustc auto merge of #12764 : Kimundi/rust/partial_typehint, r=nikomatsakis 2014-03-14 08:01:28 -07:00
librustdoc auto merge of #12861 : huonw/rust/lint-owned-vecs, r=thestinger 2014-03-13 22:26:35 -07:00
librustuv auto merge of #12861 : huonw/rust/lint-owned-vecs, r=thestinger 2014-03-13 22:26:35 -07:00
libsemver lint: add lint for use of a ~[T]. 2014-03-14 11:28:39 +11:00
libserialize lint: add lint for use of a ~[T]. 2014-03-14 11:28:39 +11:00
libstd auto merge of #12875 : alexcrichton/rust/demangle-more-things, r=brson 2014-03-14 06:41:26 -07:00
libsync auto merge of #12861 : huonw/rust/lint-owned-vecs, r=thestinger 2014-03-13 22:26:35 -07:00
libsyntax auto merge of #12764 : Kimundi/rust/partial_typehint, r=nikomatsakis 2014-03-14 08:01:28 -07:00
libterm lint: add lint for use of a ~[T]. 2014-03-14 11:28:39 +11:00
libtest auto merge of #12861 : huonw/rust/lint-owned-vecs, r=thestinger 2014-03-13 22:26:35 -07:00
libtime lint: add lint for use of a ~[T]. 2014-03-14 11:28:39 +11:00
libuuid lint: add lint for use of a ~[T]. 2014-03-14 11:28:39 +11:00
libuv@800b56fe6a
llvm@263c617d66
rt std: Move rand to librand. 2014-03-12 11:31:05 +11:00
rustllvm rustc: Fix support for LLVM 3.3 2014-03-05 18:05:05 -08:00
test auto merge of #12764 : Kimundi/rust/partial_typehint, r=nikomatsakis 2014-03-14 08:01:28 -07:00
README.md
snapshots.txt

This is a preliminary version of the Rust compiler, libraries and tools.

Source layout:

Path Description
librustc/ The self-hosted compiler
libstd/ The standard library (imported and linked by default)
libextra/ The "extras" library (slightly more peripheral code)
libgreen/ The M:N runtime library
libnative/ The 1:1 runtime library
libsyntax/ The Rust parser and pretty-printer
libcollections/ A collection of useful data structures and containers
libnum/ Extended number support library (complex, rational, etc)
libtest/ Rust's test-runner code
------------------- ---------------------------------------------------------
libarena/ The arena (a fast but limited) memory allocator
libflate/ Simple compression library
libfourcc/ Data format identifier library
libgetopts/ Get command-line-options library
libglob/ Unix glob patterns library
libsemver/ Rust's semantic versioning library
libserialize/ Encode-Decode types library
libsync/ Concurrency mechanisms and primitives
libterm/ ANSI color library for terminals
libtime/ Time operations library
libuuid/ UUID's handling code
------------------- ---------------------------------------------------------
rt/ The runtime system
rt/rust_*.c - Some of the runtime services
rt/vg - Valgrind headers
rt/msvc - MSVC support
rt/sundown - The Markdown library used by rustdoc
------------------- ---------------------------------------------------------
compiletest/ The test runner
test/ Testsuite
test/codegen - Tests for the LLVM IR infrastructure
test/compile-fail - Tests that should fail to compile
test/debug-info - Tests for the debuginfo tool
test/run-fail - Tests that should compile, run and fail
test/run-make - Tests that depend on a Makefile infrastructure
test/run-pass - Tests that should compile, run and succeed
test/bench - Benchmarks and miscellaneous
test/pretty - Pretty-printer tests
test/auxiliary - Dependencies of tests
------------------- ---------------------------------------------------------
librustdoc/ The Rust API documentation tool
libuv/ The libuv submodule
librustuv/ Rust libuv support code
------------------- ---------------------------------------------------------
llvm/ The LLVM submodule
rustllvm/ LLVM support code
------------------- ---------------------------------------------------------
etc/ Scripts, editors support, misc

NOTE: This list (especially the second part of the table which contains modules and libraries) is highly volatile and subject to change.