summary refs log tree commit diff
path: root/src/librustc_const_eval
AgeCommit message (Collapse)AuthorLines
2017-12-21Revert "Auto merge of #45225 - eddyb:trans-abi, r=arielb1"Ariel Ben-Yehuda-9/+8
This reverts commit f50fd075c2555d8511ccee8a7fe7aee3f2c45e14, reversing changes made to 5041b3bb3d953a14f32b15d1e41341c629acae12.
2017-11-19rustc: move size, align & primitive_align from Abi::Aggregate to layout.Eduard-Mihai Burtescu-2/+2
2017-11-19rustc: pre-compute field placements out of Layout.Eduard-Mihai Burtescu-1/+2
2017-11-18rustc_mir: always downcast enums, even if univariant.Eduard-Mihai Burtescu-5/+5
2017-11-10Auto merge of #45050 - petrochenkov:ambind, r=nikomatsakisbors-1/+8
resolve: Use same rules for disambiguating fresh bindings in `match` and `let` Resolve `Unit` as a unit struct pattern in ```rust struct Unit; let Unit = x; ``` consistently with ```rust match x { Unit => {} } ``` It was previously an error. (The change also applies to unit variants and constants.) Fixes https://users.rust-lang.org/t/e0530-cannot-shadow-unit-structs-what-in-the-earthly-what/13054 (This particular change doesn't depend on a fix for the issue mentioned in https://users.rust-lang.org/t/e0530-cannot-shadow-unit-structs-what-in-the-earthly-what/13054/4) cc @rust-lang/lang r? @nikomatsakis
2017-11-04Give better help for identifier patterns failing exhaustiveness checkVadim Petrochenkov-1/+8
2017-11-03Implemented RFC 2008 for enums (not including variants) and structs.David Wood-4/+69
2017-10-26Bump to 1.23 and update bootstrapAlex Crichton-2/+1
This commit updates the bootstrap compiler, bumps the version to 1.23, updates Cargo, updates books, and updates crates.io dependencies
2017-10-25Resolve types properly in const evalOliver Schneider-90/+8
2017-10-16convert constant promotion into a queryNiko Matsakis-1/+1
2017-10-16refactor inhabitedness to have clearer public entry pointsNiko Matsakis-8/+6
2017-10-06implement pattern-binding-modes RFCTobias Schottdorf-0/+38
See the [RFC] and [tracking issue]. [tracking issue]: https://github.com/rust-lang/rust/issues/42640 [RFC]: https://github.com/rust-lang/rfcs/blob/491e0af/text/2005-match-ergonomics.md
2017-09-18incr.comp.: Already hash HIR bodies during metadata export so they don't ↵Michael Woerister-4/+3
have to be hashed in downstream crates.
2017-09-16change #![feature(const_fn)] to specific gatesAlex Burka-1/+3
2017-09-11rustc: evaluate fixed-length array length expressions lazily.Eduard-Mihai Burtescu-10/+14
2017-09-11rustc: remove obsolete const_val::ErrKind::{Negate,Not}On.Eduard-Mihai Burtescu-7/+5
2017-09-11rustc: use ty::Const for the length of TyArray.Eduard-Mihai Burtescu-8/+17
2017-09-11rustc: replace usize with u64 and ConstUsize.Eduard-Mihai Burtescu-29/+30
2017-09-11rustc: introduce ty::Const { ConstVal, Ty }.Eduard-Mihai Burtescu-56/+63
2017-09-11rustc: intern ConstVal's in TyCtxt.Eduard-Mihai Burtescu-121/+131
2017-09-08Use NodeId/HirId instead of DefId for local variables.Eduard-Mihai Burtescu-14/+13
2017-09-05rustc: Store InternedString in `DefPathData`Alex Crichton-1/+1
Previously a `Symbol` was stored there, but this ended up causing hash collisions in situations that otherwise shouldn't have a hash collision. Only the symbol's string value was hashed, but it was possible for distinct symbols to have the same string value, fooling various calcuations into thinking that these paths *didn't* need disambiguating data when in fact they did! By storing `InternedString` instead we're hopefully triggering all the exising logic to disambiguate paths with same-name `Symbol` but actually distinct locations.
2017-09-05rustc: Rename item_body query to extern_const_bodyAlex Crichton-3/+3
Should hopefully more accurately reflect what's happening! This commit also removes the cache in the cstore implementation as it's already cached through the query infrastructure.
2017-09-05rustc: Migrate `CrateStore::item_body` to a queryAlex Crichton-3/+3
This commit migrates the `item_body` method on `CrateStore` to a query instead to enable better tracking of dependencies and whatnot.
2017-09-01rustc: rename CodeExtent to Scope and RegionMaps to ScopeTree.Eduard-Mihai Burtescu-4/+4
2017-08-25*: remove crate_{name,type} attributesTamir Duberstein-3/+0
Fixes #41701.
2017-08-19rustc: Remove some dead codeVadim Petrochenkov-1/+1
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-17/+17
Like #43008 (f668999), but _much more aggressive_.
2017-08-14Auto merge of #43740 - michaelwoerister:local-id-in-typecktables, r=arielb1bors-22/+33
Use hir::ItemLocalId as keys in TypeckTables. This PR makes `TypeckTables` use `ItemLocalId` instead of `NodeId` as key. This is needed for incremental compilation -- for stable hashing and for being able to persist and reload these tables. The PR implements the most important part of https://github.com/rust-lang/rust/issues/40303. Some notes on the implementation: * The PR adds the `HirId` to HIR nodes where needed (`Expr`, `Local`, `Block`, `Pat`) which obviates the need to store a `NodeId -> HirId` mapping in crate metadata. Thanks @eddyb for the suggestion! In the future the `HirId` should completely replace the `NodeId` in HIR nodes. * Before something is read or stored in one of the various `TypeckTables` subtables, the entry's key is validated via the new `TypeckTables::validate_hir_id()` method. This makes sure that we are not mixing information from different items in a single table. That last part could be made a bit nicer by either (a) new-typing the table-key and making `validate_hir_id()` the only way to convert a `HirId` to the new-typed key, or (b) just encapsulate sub-table access a little better. This PR, however, contents itself with not making things significantly worse. Also, there's quite a bit of switching around between `NodeId`, `HirId`, and `DefIndex`. These conversions are cheap except for `HirId -> NodeId`, so if the valued reviewer finds such an instance in a performance critical place, please let me know. Ideally we convert more and more code from `NodeId` to `HirId` in the future so that there are no more `NodeId`s after HIR lowering anywhere. Then the amount of switching should be minimal again. r? @eddyb, maybe?
2017-08-12Fix some typosBastien Orivel-1/+1
2017-08-11Encapsulate sub-table access in TypeckTables and validate keys on each access.Michael Woerister-11/+8
2017-08-11Use ItemLocalId as key for TypeckTables::pat_binding_modes.Michael Woerister-4/+18
2017-08-11Use ItemLocalId as key for node_types, node_substs, and adjustments in ↵Michael Woerister-13/+13
TypeckTables.
2017-08-11Make TypeckTables::type_dependent_defs use ItemLocalId instead of NodeId.Michael Woerister-9/+9
2017-08-09rustc: Rearchitect lints to be emitted more eagerlyAlex Crichton-13/+13
In preparation for incremental compilation this commit refactors the lint handling infrastructure in the compiler to be more "eager" and overall more incremental-friendly. Many passes of the compiler can emit lints at various points but before this commit all lints were buffered in a table to be emitted at the very end of compilation. This commit changes these lints to be emitted immediately during compilation using pre-calculated lint level-related data structures. Linting today is split into two phases, one set of "early" lints run on the `syntax::ast` and a "late" set of lints run on the HIR. This commit moves the "early" lints to running as late as possible in compilation, just before HIR lowering. This notably means that we're catching resolve-related lints just before HIR lowering. The early linting remains a pass very similar to how it was before, maintaining context of the current lint level as it walks the tree. Post-HIR, however, linting is structured as a method on the `TyCtxt` which transitively executes a query to calculate lint levels. Each request to lint on a `TyCtxt` will query the entire crate's 'lint level data structure' and then go from there about whether the lint should be emitted or not. The query depends on the entire HIR crate but should be very quick to calculate (just a quick walk of the HIR) and the red-green system should notice that the lint level data structure rarely changes, and should hopefully preserve incrementality. Overall this resulted in a pretty big change to the test suite now that lints are emitted much earlier in compilation (on-demand vs only at the end). This in turn necessitated the addition of many `#![allow(warnings)]` directives throughout the compile-fail test suite and a number of updates to the UI test suite.
2017-08-02rustc_const_math: use apfloat::ieee::{Single,Double} in ConstFloat.Eduard-Mihai Burtescu-28/+27
2017-07-30default binding modes: add pat_binding_modesTobias Schottdorf-15/+31
This PR kicks off the implementation of the [default binding modes RFC][1] by introducing the `pat_binding_modes` typeck table mentioned in the [mentoring instructions][2]. `pat_binding_modes` is populated in `librustc_typeck/check/_match.rs` and used wherever the HIR would be scraped prior to this PR. Unfortunately, one blemish, namely a two callers to `contains_explicit_ref_binding`, remains. This will likely have to be removed when the second part of [1], the `pat_adjustments` table, is tackled. Appropriate comments have been added. See #42640. [1]: https://github.com/rust-lang/rfcs/pull/2005 [2]: https://github.com/rust-lang/rust/issues/42640#issuecomment-313535089
2017-07-27rustc_const_eval: keep track of the appropriate ParamEnv.Eduard-Mihai Burtescu-46/+55
2017-07-27rustc_const_eval: always require correct Substs.Eduard-Mihai Burtescu-61/+49
2017-07-19Implement const fn {size,align}_of.Eduard-Mihai Burtescu-0/+23
2017-07-16Update function name to reflect realitySam Cappleman-Lynes-3/+3
2017-07-16Fix `range_covered_by_constructor` for exclusive ranges.Sam Cappleman-Lynes-4/+4
This resolves #43253
2017-06-27rustc: move the PolyFnSig out of TyFnDef.Eduard-Mihai Burtescu-3/+3
2017-06-23Removed as many "```ignore" as possible.kennytm-3/+5
Replaced by adding extra imports, adding hidden code (`# ...`), modifying examples to be runnable (sorry Homura), specifying non-Rust code, and converting to should_panic, no_run, or compile_fail. Remaining "```ignore"s received an explanation why they are being ignored.
2017-06-19Bump version and stage0 compilerAlex Crichton-4/+0
2017-06-18Use T as the subpattern type of Box<T>Wonwoo Choi-15/+20
The subpattern type of boxes being nil does not make sense because of box patterns. They should have their inner type as the subpattern type.
2017-06-13On-demand is_const_fnTaylor Cramer-1/+1
2017-06-10rustc: make the comon case of tcx.infer_ctxt(()) nicer.Eduard-Mihai Burtescu-1/+1
2017-06-10rustc: make InferCtxt optional in MemCategorizationContext.Eduard-Mihai Burtescu-10/+8
2017-06-10rustc: do not depend on infcx.tables in MemCategorizationContext.Eduard-Mihai Burtescu-2/+3