summary refs log tree commit diff
path: root/src/librustc_const_eval
AgeCommit message (Collapse)AuthorLines
2018-02-08Encode (in MIR) whether borrows are explicit in source or arise due to autoref.Felix S. Klock II-2/+2
This is foundation for issue 46747 (limit two-phase borrows to method-call autorefs).
2018-02-05Rollup merge of #47892 - Badel2:const_type_id_of, r=oli-obkkennytm-0/+4
Turn `type_id` into a constant intrinsic https://github.com/rust-lang/rust/issues/27745 The method `get_type_id` in `Any` is intended to support reflection. It's currently unstable in favor of using an associated constant instead. This PR makes the `type_id` intrinsic a constant intrinsic, the same as `size_of` and `align_of`, allowing `TypeId::of` to be a `const fn`, which will allow using an associated constant in `Any`.
2018-02-04Auto merge of #47915 - eddyb:layout-of, r=nikomatsakisbors-2/+1
rustc: prefer ParamEnvAnd and LayoutCx over tuples for LayoutOf. This PR provides `tcx.layout_of(param_env.and(ty))` as the idiomatic replacement for the existing `(tcx, param_env).layout_of(ty)` and removes fragile (coherence-wise) layout-related tuple impls. r? @nikomatsakis
2018-02-01Turn `type_id` into a constant intrinsicBadel2-0/+4
Add rustc_const_unstable attribute for `any::TypeId::of` Add test for `const fn TypeId::of`
2018-02-01rustc: prefer ParamEnvAnd and LayoutCx over tuples for LayoutOf.Eduard-Mihai Burtescu-2/+1
2018-01-31Rollup merge of #47876 - GuillaumeGomez:associated-const-error, r=nikomatsakiskennytm-3/+19
Update associated constants error message Fixes #47570.
2018-01-30Update associated constants error messageGuillaume Gomez-3/+19
2018-01-25Auto merge of #47374 - topecongiro:issue-47096, r=nikomatsakisbors-1/+3
Simplify irrefutable slice patterns Closes #47096.
2018-01-17Simplify irrefutable slice patternsSeiichi Uchida-1/+3
Closes #47096.
2018-01-13fix commentsAriel Ben-Yehuda-5/+21
2018-01-13check_match: fix handling of privately uninhabited typesAriel Ben-Yehuda-9/+18
the match-checking code used to use TyErr for signaling "unknown, inhabited" types for a long time. It had been switched to using the exact type in #38069, to handle uninhabited types. However, in #39980, we discovered that we still needed the "unknown inhabited" logic, but I used `()` instead of `TyErr` to handle that. Revert to using `TyErr` to fix that problem.
2018-01-13Use delay_span_bug() over debug!()Seiichi Uchida-1/+2
2018-01-12Ignore CTFE errors while lowering patternsSeiichi Uchida-1/+1
Closes #43105.
2018-01-07Try to fix a perf regression by updating logMalo Jaffré-1/+1
Upgrade `log` to `0.4` in multiple crates.
2018-01-07Rollup merge of #47170 - eddyb:us-vs-usize, r=nikomatsakiskennytm-4/+4
rustc: use {U,I}size instead of {U,I}s shorthands. `Us`/`Is` come from a time when `us` and `is` were the literal suffixes that are now `usize` / `isize`. r? @nikomatsakis
2018-01-04rustc: Don't use relative paths for extended errorsAlex Crichton-0/+1
These no longer work now that Cargo changes the cwd of rustc while it's running. Instead use an absolute path that's set by rustbuild.
2018-01-04rustc: use {U,I}size instead of {U,I}s shorthands.Eduard-Mihai Burtescu-4/+4
2017-12-20Various tweaksEsteban Küber-2/+2
2017-12-19Use a label for catch-all pattern instead of noteEsteban Küber-1/+1
2017-12-12Move large chunks of miri from rustc::mir::interpret to rustc_mir::interpretOliver Schneider-296/+0
2017-12-12Put miri const eval checking behind -ZmiriOliver Schneider-20/+24
2017-12-06miri: don't use an associated constant for a Machine's own data.Eduard-Mihai Burtescu-4/+4
2017-12-06miri: move param_env from Machine to EvalContext.Eduard-Mihai Burtescu-2/+2
2017-12-06miri: monomorphize types iff they came from MIR.Eduard-Mihai Burtescu-3/+4
2017-12-06Update miri to rustc changesOliver Schneider-205/+441
2017-09-29Expose miri <-> ctfe differencesOliver Schneider-17/+17
miri needs to start storing everything in the TyCtxt so we can have relocations and aggregates
2017-09-29Adjust imports to librustc::mir::interpretOliver Schneider-1/+72
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.