rust/mk
bors 01118928fc Auto merge of #30587 - oli-obk:eager_const_eval2, r=nikomatsakis
typestrong const integers

~~It would be great if someone could run crater on this PR, as this has a high danger of breaking valid code~~ Crater ran. Good to go.

----

So this PR does a few things:

1. ~~const eval array values when const evaluating an array expression~~
2. ~~const eval repeat value when const evaluating a repeat expression~~
3. ~~const eval all struct and tuple fields when evaluating a struct/tuple expression~~
4. remove the `ConstVal::Int` and `ConstVal::Uint` variants and replace them with a single enum (`ConstInt`) which has variants for all integral types
  * `usize`/`isize` are also enums with variants for 32 and 64 bit. At creation and various usage steps there are assertions in place checking if the target bitwidth matches with the chosen enum variant
5. enum discriminants (`ty::Disr`) are now `ConstInt`
6. trans has its own `Disr` type now (newtype around `u64`)

This obviously can't be done without breaking changes (the ones that are noticable in stable)
We could probably write lints that find those situations and error on it for a cycle or two. But then again, those situations are rare and really bugs imo anyway:

```rust
let v10 = 10 as i8;
let v4 = 4 as isize;
assert_eq!(v10 << v4 as usize, 160 as i8);
 ```

stops compiling because 160 is not a valid i8

```rust
struct S<T, S> {
    a: T,
    b: u8,
    c: S
}
let s = S { a: 0xff_ff_ff_ffu32, b: 1, c: 0xaa_aa_aa_aa as i32 };
```

stops compiling because `0xaa_aa_aa_aa` is not a valid i32

----

cc @eddyb @pnkfelix

related: https://github.com/rust-lang/rfcs/issues/1071
2016-03-14 11:38:23 -07:00
..
cfg Auto merge of #32034 - alexcrichton:old-x86-msvc, r=aturon 2016-03-10 22:47:49 -08:00
clean.mk
crates.mk Auto merge of #30587 - oli-obk:eager_const_eval2, r=nikomatsakis 2016-03-14 11:38:23 -07:00
ctags.mk
debuggers.mk
dist.mk mk: Fix make dist 2016-03-12 12:22:40 -08:00
docs.mk mk: Move disable-jemalloc logic into makefiles 2016-02-25 21:05:59 -08:00
grammar.mk Revert "mk: fix some undefined variable warnings" 2016-02-01 23:27:04 -08:00
host.mk mk: Move disable-jemalloc logic into makefiles 2016-02-25 21:05:59 -08:00
install.mk mk: Move disable-jemalloc logic into makefiles 2016-02-25 21:05:59 -08:00
llvm.mk rustc_llvm: Tweak how initialization is performed 2016-02-11 11:12:33 -08:00
main.mk Bump to 1.9 2016-03-01 18:34:26 +00:00
platform.mk mk: Move disable-jemalloc logic into makefiles 2016-02-25 21:05:59 -08:00
prepare.mk mk: Move disable-jemalloc logic into makefiles 2016-02-25 21:05:59 -08:00
reconfig.mk
rt.mk More reliable and consistent method of cancelling -Werror* 2016-03-05 14:45:25 +01:00
rustllvm.mk
snap.mk
stage0.mk
target.mk mk: Move disable-jemalloc logic into makefiles 2016-02-25 21:05:59 -08:00
tests.mk mk: Distribute fewer TARGET_CRATES 2016-03-07 13:05:12 -08:00
util.mk