summary refs log tree commit diff
path: root/src/librustc_const_eval/eval.rs
AgeCommit message (Collapse)AuthorLines
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
2016-08-12rustc: rename ProjectionMode and its variant to be more memorable.Eduard Burtescu-4/+4
2016-08-09Auto merge of #35401 - jonathandturner:enable_json_and_new_errors, ↵bors-6/+2
r=jonathandturner Turn on new errors and json mode This PR is a big-switch, but on a well-worn path: * Turns on new errors by default (and removes old skool) * Moves json output from behind a flag The RFC for new errors [landed](https://github.com/rust-lang/rfcs/pull/1644) and as part of that we wanted some bake time. It's now had a few weeks + all the time leading up to the RFC of people banging on it. We've also had [editors updating to the new format](https://github.com/saviorisdead/RustyCode/pull/159) and expect more to follow. We also have an [issue on old skool](https://github.com/rust-lang/rust/issues/35330) that needs to be fixed as more errors are switched to the new style, but it seems silly to fix old skool errors when we fully intend to throw the switch in the near future. This makes it lean towards "why not just throw the switch now, rather than waiting a couple more weeks?" I only know of vim that wanted to try to parse the new format but were not sure how, and I think we can reach out to them and work out something in the 8 weeks before this would appear in a stable release. We've [hashed out](https://github.com/rust-lang/rust/issues/35330) stabilizing JSON output, and it seems like people are relatively happy making what we have v1 and then likely adding to it in the future. The idea is that we'd maintain backward compatibility and just add new fields as needed. We'll also work on a separate output format that'd be better suited for interactive tools like IDES (since JSON message can get a little long depending on the error). This PR stabilizes JSON mode, allowing its use without `-Z unstable-options` Combined, this gives editors two ways to support errors going forward: parsing the new error format or using the JSON mode. By moving JSON to stable, we can also add support to Cargo, which plugin authors tell us does help simplify their support story. r? @nikomatsakis cc @rust-lang/tools Closes https://github.com/rust-lang/rust/issues/34826
2016-08-09Auto merge of #35166 - nikomatsakis:incr-comp-ice-34991-2, r=mwbors-2/+2
Address ICEs running w/ incremental compilation and building glium Fixes for various ICEs I encountered trying to build glium with incremental compilation enabled. Building glium now works. Of the 4 ICEs, I have test cases for 3 of them -- I didn't isolate a test for the last commit and kind of want to go do other things -- most notably, figuring out why incremental isn't saving much *effort*. But if it seems worthwhile and I can come back and try to narrow down the problem. r? @michaelwoerister Fixes #34991 Fixes #32015
2016-08-07Turn on new errors, json mode. Remove duplicate unicode testJonathan Turner-6/+2
2016-08-05Updated E0306 to new format.Federico Ravasio-4/+7
2016-08-02replace graph rewriting with detecting inlined idsNiko Matsakis-2/+2
We now detect inlined id's earlier (in the HIR map) and rewrite a read of them to be a read of the metadata for the associated item.
2016-08-01Move caching of HIR-inlining into CStore in order to avoid duplicating ↵Michael Woerister-6/+6
inlined HIR.
2016-07-27Auto merge of #34907 - arielb1:found-parse-error, r=nikomatsakisbors-67/+165
Centralize and clean type error reporting Refactors the code that handles type errors to be cleaner and fixes various edge cases. This made the already-bad "type mismatch resolving" error message somewhat uglier. I want to fix that in another commit before this PR is merged. Fixes #31173 r? @jonathandturner, cc @nikomatsakis
2016-07-23address review commentsAriel Ben-Yehuda-27/+1
I split the RFC1592 commit out
2016-07-22refactor constant evaluation error reportingAriel Ben-Yehuda-67/+191
Refactor constant evaluation to use a single error reporting function that reports a type-error-like message. Also, unify all error codes with the "constant evaluation error" message to just E0080, and similarly for a few other duplicate codes. The old situation was a total mess, and now that we have *something* we can further iterate on the UX.
2016-07-22improve const eval error reporting on "" and b"" castsOliver Schneider-2/+16
2016-07-08Merge PatKind::QPath into PatKind::Path in HIRVadim Petrochenkov-1/+1
2016-06-29Rollup merge of #34497 - oli-obk:double_negation, r=eddybManish Goregaokar-48/+41
Revert "skip double negation in const eval" This reverts commit 735c018974e5570ea13fd887aa70a011a5b8e7b8. fixes #34395 The original commit was based on a mis-understanding of the overflowing literal lint. This needs to be ported to beta. r? @eddyb