summary refs log tree commit diff
path: root/src/librustc_const_eval/eval.rs
AgeCommit message (Collapse)AuthorLines
2017-01-26rustc: don't call the HIR AST.Eduard-Mihai Burtescu-5/+5
2017-01-26rustc: rename TyCtxt's `map` field to `hir`.Eduard-Mihai Burtescu-18/+18
2017-01-25rename `Tables` to `TypeckTables`Niko Matsakis-7/+7
2017-01-11Fix two const-eval issues related to i128 negationSimonas Kazlauskas-13/+16
First issue here was the fact that we’d only allow negating integers in i64 range in case the integer was not infered yes. While this is not the direct cause of the issue, its still good to fix it. The real issue here is the code handling specifically the `min_value` literals. While I128_OVERFLOW has the expected value (0x8000_..._0000), match using this value as a pattern is handled incorrectly by the stage1 compiler (it seems to be handled correctly, by the stage2 compiler). So what we do here is extract this pattern into an explicit `==` until the next snapshot. Fixes #38987
2017-01-06rustc: store ty::Tables separately for each body (except closures').Eduard-Mihai Burtescu-29/+43
2017-01-06rustc: keep track of tables everywhere as if they were per-body.Eduard-Mihai Burtescu-181/+179
2017-01-01rustc_const_eval: convert constants to Pattern instead of hir::Pat.Eduard-Mihai Burtescu-127/+3
2016-12-30Such large. Very 128. Much bits.Simonas Kazlauskas-37/+52
This commit introduces 128-bit integers. Stage 2 builds and produces a working compiler which understands and supports 128-bit integers throughout. The general strategy used is to have rustc_i128 module which provides aliases for iu128, equal to iu64 in stage9 and iu128 later. Since nowhere in rustc we rely on large numbers being supported, this strategy is good enough to get past the first bootstrap stages to end up with a fully working 128-bit capable compiler. In order for this strategy to work, number of locations had to be changed to use associated max_value/min_value instead of MAX/MIN constants as well as the min_value (or was it max_value?) had to be changed to use xor instead of shift so both 64-bit and 128-bit based consteval works (former not necessarily producing the right results in stage1). This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-28rustc: always print nested nodes where a HIR map is available.Eduard-Mihai Burtescu-1/+2
2016-12-28rustc: simplify constant cross-crate loading and rustc_passes::consts.Eduard-Mihai Burtescu-75/+17
2016-12-28rustc: move function arguments into hir::Body.Eduard-Mihai Burtescu-11/+9
2016-12-28rustc: separate bodies for static/(associated)const and embedded constants.Eduard-Mihai Burtescu-20/+27
2016-12-28rustc: separate TraitItem from their parent Item, just like ImplItem.Eduard-Mihai Burtescu-1/+1
2016-11-29Fix rebase breakageFlorian Diebold-3/+6
2016-11-29Refactor inlined items some moreFlorian Diebold-19/+28
They don't implement FnLikeNode anymore, instead are handled differently further up in the call tree. Also, keep less information (just def ids for the args).
2016-11-29Add make tidy fixesFlorian Diebold-8/+11
2016-11-29Fix cross-crate associated constant evaluationFlorian Diebold-12/+30
2016-11-29Give function bodies their own dep graph nodeFlorian Diebold-1/+0
2016-11-29Save bodies of functions for inlining into other cratesFlorian Diebold-42/+9
This is quite hacky and I hope to refactor it a bit, but at least it seems to work.
2016-11-29rustc_const_eval: fix compilationFlorian Diebold-1/+2
2016-11-28rustc: embed path resolutions into the HIR instead of keeping DefMap.Eduard-Mihai Burtescu-36/+38
2016-11-28rustc: desugar UFCS as much as possible during HIR lowering.Eduard Burtescu-21/+25
2016-11-22Change HirVec<P<T>> to HirVec<T> in Expr.Nicholas Nethercote-1/+1
This changes structures like this: ``` [ ExprArray | 8 | P ] | v [ P | P | P | P | P | P | P | P ] | v [ ExprTup | 2 | P ] | v [ P | P ] | v [ Expr ] ``` to this: ``` [ ExprArray | 8 | P ] | v [ [ ExprTup | 2 | P ] | ... ] | v [ Expr | Expr ] ```
2016-11-21Use `Symbol` instead of `InternedString` in the AST, HIR, and various other ↵Jeffrey Seyfried-5/+5
places.
2016-11-10Rollup merge of #37412 - eddyb:lazy-6, r=nikomatsakisEduard-Mihai Burtescu-2/+1
[6/n] rustc: transition HIR function bodies from Block to Expr. _This is part of a series ([prev](https://github.com/rust-lang/rust/pull/37408) | [next](https://github.com/rust-lang/rust/pull/37676)) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well. If any motivation is unclear, please ask for additional PR description clarifications or code comments._ <hr> The main change here is that functions and closures both use `Expr` instead of `Block` for their bodies. For closures this actually allows a honest representation of brace-less closure bodies, e.g. `|x| x + 1` is now distinguishable from `|x| { x + 1 }`, therefore this PR is `[syntax-breaking]` (cc @Manishearth). Using `Expr` allows more logic to be shared between constant bodies and function bodies, with some small such changes already part of this PR, and eventually easing #35078 and per-body type tables. Incidentally, there used to be some corners cut here and there and as such I had to (re)write divergence tracking for type-checking so that it is capable of understanding basic structured control-flow: ``` rust fn a(x: bool) -> i32 { // match also works (as long as all arms diverge) if x { panic!("true") } else { return 1; } 0 // "unreachable expression" after this PR } ``` And since liveness' "not all control paths return a value" moved to type-checking we can have nice things: ``` rust // before & after: fn b() -> i32 { 0; } // help: consider removing this semicolon // only after this PR fn c() -> i32 { { 0; } } // help: consider removing this semicolon fn d() { let x: i32 = { 0; }; } // help: consider removing this semicolon fn e() { f({ 0; }); } // help: consider removing this semicolon ```
2016-11-10rustc: unify and simplify managing associated items.Eduard Burtescu-7/+2
2016-11-10rustc: use an Expr instead of a Block for function bodies.Eduard Burtescu-2/+1
2016-11-05Rollup merge of #37577 - nnethercote:shrink-Expr-slightly, r=eddybAlex Crichton-1/+1
Shrink `hir::Expr` slightly r? @eddyb
2016-11-05Rollup merge of #37557 - TimNN:fix-36954, r=eddybAlex Crichton-7/+6
Use DefId's in const eval for cross-crate const fn's Fixes #36954. r? @eddyb cc @raphaelcohn
2016-11-04Shrink `Expr_::ExprStruct`.Nicholas Nethercote-1/+1
On 64-bit platforms this reduces the size of `Expr_` from 64 bytes to 56 bytes, and reduces the size of `Expr` from 88 bytes to 80 bytes.
2016-11-03use DefId's in const eval for cross-crate const fn'sTim Neumann-7/+6
2016-11-02rustc: make all read access to tcx.tables go through a method.Eduard Burtescu-6/+8
2016-10-26remove StaticInliner and NaN checkingAriel Ben-Yehuda-3/+9
NaN checking was a lint for a deprecated feature. It can go away.
2016-10-10Add comparison operators to boolean const eval.Mark-Simulacrum-0/+4
2016-10-04Turn some impossible definitions into ICEsVadim Petrochenkov-4/+5
2016-10-04Separate Def::StructCtor/Def::VariantCtor from Def::Struct/Def::VariantVadim Petrochenkov-5/+5
2016-09-28Call arrays "arrays" instead of "vecs" internallyJonas Schievink-4/+4
2016-09-23Auto merge of #36335 - mcarton:compiletest, r=GuillaumeGomezbors-8/+8
Fix ICE test in compiletest fail-tests While working on Clippy which uses *compiletest*, I noticed that as long as all expected error are found, *compile-fail* tests will be marked *ok* even if there is an ICE. One function seems to have not been updated with JSON errors because ICEs are now reported like this: ```json {"message":"../src/librustc/ty/context.rs:161: Attempted to intern `_` which contains inference types/regions in the global type context","code":null,"level":"error: internal compiler error","spans":[],"children":[],"rendered":null} ``` I don't think I can add a test for that. I guess: r? @nikomatsakis
2016-09-20rustc_metadata: group information into less tags.Eduard Burtescu-6/+5
2016-09-20rustc: remove ImplOrTraitItemId and TraitDef's associated_type_names.Eduard Burtescu-7/+5
2016-09-20rustc_metadata: move more RBML tags to auto-serialization.Eduard Burtescu-3/+11
2016-09-20rustc: replace uses of NodeId in Def, other than closures and labels.Eduard Burtescu-1/+2
2016-09-20Don't ICE when a float can't be parsedmcarton-8/+8
2016-09-11Use question_mark feature in librustc_const_eval.Ahmed Charles-22/+19
2016-09-08Refactor `TyStruct`/`TyEnum`/`TyUnion` into `TyAdt`Vadim Petrochenkov-8/+7
2016-09-04Replace `_, _` with `..`Vadim Petrochenkov-3/+3
2016-09-04Replace `_, _, _` with `..`Vadim Petrochenkov-1/+1
2016-09-03Translate union constantsVadim Petrochenkov-2/+5
Fix alignment for packed unions Add some missing privacy test Get rid of `unimplemented_unions` macro
2016-09-03Some better support for unions through the compilerVadim Petrochenkov-1/+2
2016-08-17rustc: reduce Substs and Generics to a simple immutable API.Eduard Burtescu-8/+8