rust/src
Nick Cameron 95602a759d Add trivial cast lints.
This permits all coercions to be performed in casts, but adds lints to warn in those cases.

Part of this patch moves cast checking to a later stage of type checking. We acquire obligations to check casts as part of type checking where we previously checked them. Once we have type checked a function or module, then we check any cast obligations which have been acquired. That means we have more type information available to check casts (this was crucial to making coercions work properly in place of some casts), but it means that casts cannot feed input into type inference.

[breaking change]

* Adds two new lints for trivial casts and trivial numeric casts, these are warn by default, but can cause errors if you build with warnings as errors. Previously, trivial numeric casts and casts to trait objects were allowed.
* The unused casts lint has gone.
* Interactions between casting and type inference have changed in subtle ways. Two ways this might manifest are:
- You may need to 'direct' casts more with extra type information, for example, in some cases where `foo as _ as T` succeeded, you may now need to specify the type for `_`
- Casts do not influence inference of integer types. E.g., the following used to type check:

```
let x = 42;
let y = &x as *const u32;
```

Because the cast would inform inference that `x` must have type `u32`. This no longer applies and the compiler will fallback to `i32` for `x` and thus there will be a type error in the cast. The solution is to add more type information:

```
let x: u32 = 42;
let y = &x as *const u32;
```
2015-03-25 10:03:57 +13:00
..
compiler-rt@58ab642c30
compiletest rollup merge of #23598: brson/gate 2015-03-23 15:13:15 -07:00
doc rollup merge of #23645: steveklabnik/gh23642 2015-03-23 17:13:38 -07:00
driver
etc
grammar
jemalloc@e24a1a025a
liballoc Test fixes and rebase conflicts, round 2 2015-03-23 17:10:19 -07:00
libarena Add trivial cast lints. 2015-03-25 10:03:57 +13:00
libbacktrace
libcollections Add trivial cast lints. 2015-03-25 10:03:57 +13:00
libcollectionstest Test fixes and rebase conflicts, round 2 2015-03-23 17:10:19 -07:00
libcore Add trivial cast lints. 2015-03-25 10:03:57 +13:00
libcoretest Add trivial cast lints. 2015-03-25 10:03:57 +13:00
libflate Require feature attributes, and add them where necessary 2015-03-23 14:40:26 -07:00
libfmt_macros
libgetopts
libgraphviz Test fixes and rebase conflicts, round 2 2015-03-23 17:10:19 -07:00
liblibc rollup merge of #23598: brson/gate 2015-03-23 15:13:15 -07:00
liblog Add trivial cast lints. 2015-03-25 10:03:57 +13:00
librand Add trivial cast lints. 2015-03-25 10:03:57 +13:00
librbml Add trivial cast lints. 2015-03-25 10:03:57 +13:00
librustc Add trivial cast lints. 2015-03-25 10:03:57 +13:00
librustc_back Test fixes and rebase conflicts, round 3 2015-03-23 22:52:21 -07:00
librustc_bitflags Add #![feature] attributes to doctests 2015-03-23 14:40:26 -07:00
librustc_borrowck rollup merge of #23601: nikomatsakis/by-value-index 2015-03-23 15:10:50 -07:00
librustc_driver Add generic conversion traits 2015-03-23 15:01:45 -07:00
librustc_lint Add trivial cast lints. 2015-03-25 10:03:57 +13:00
librustc_llvm Add trivial cast lints. 2015-03-25 10:03:57 +13:00
librustc_privacy Fallout in stdlib, rustdoc, rustc, etc. For most maps, converted uses of 2015-03-23 16:55:45 -04:00
librustc_resolve Future-proof indexing on maps: remove IndexMut 2015-03-20 10:46:31 -07:00
librustc_trans Add trivial cast lints. 2015-03-25 10:03:57 +13:00
librustc_typeck Add trivial cast lints. 2015-03-25 10:03:57 +13:00
librustdoc Add trivial cast lints. 2015-03-25 10:03:57 +13:00
libserialize Add trivial cast lints. 2015-03-25 10:03:57 +13:00
libstd Add trivial cast lints. 2015-03-25 10:03:57 +13:00
libsyntax Add trivial cast lints. 2015-03-25 10:03:57 +13:00
libterm Add trivial cast lints. 2015-03-25 10:03:57 +13:00
libtest Add trivial cast lints. 2015-03-25 10:03:57 +13:00
libunicode Add #![feature] attributes to doctests 2015-03-23 14:40:26 -07:00
llvm@bff6907697
rt
rust-installer@60fd8abfca
rustbook Add trivial cast lints. 2015-03-25 10:03:57 +13:00
rustllvm
test Add trivial cast lints. 2015-03-25 10:03:57 +13:00
snapshots.txt adding lastest Bitrig snapshot by hand 2015-03-23 15:58:44 -07:00