summary refs log tree commit diff
path: root/src/librustc_const_eval
AgeCommit message (Collapse)AuthorLines
2017-03-09Fix ICE: don't use `struct_variant` on enumsEsteban Küber-1/+5
Fix #40221 and add unittest.
2017-02-25use a more conservative inhabitableness ruleAriel Ben-Yehuda-1/+15
This is a [breaking-change] from 1.15, because this used to compile: ```Rust enum Void {} fn foo(x: &Void) { match x {} } ```
2017-02-25check_match: don't treat privately uninhabited types as uninhabitedAriel Ben-Yehuda-30/+82
Fixes #38972.
2017-02-10Fix make tidyAndrew Cann-3/+3
2017-02-10Remove use of ptr::eqAndrew Cann-13/+18
2017-02-10Uninhabited while-let pattern fixAndrew Cann-4/+16
2017-01-30Merge ty::TyBox into ty::TyAdtVadim Petrochenkov-3/+1
2017-01-27Rollup merge of #39290 - canndrew:hide-uninhabitedness, r=nikomatsakisAlex Crichton-4/+13
Hide uninhabitedness checks behind feature gate This reverts the fix to match exhaustiveness checking so that it can be discussed. The new code is now hidden behind the `never_type` feature gate.
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-23/+23
2017-01-25rename `Tables` to `TypeckTables`Niko Matsakis-11/+11
2017-01-25Hide uninhabitedness checks behind feature gateAndrew Cann-4/+13
2017-01-25Auto merge of #35712 - oli-obk:exclusive_range_patterns, r=nikomatsakisbors-24/+47
exclusive range patterns adds `..` patterns to the language under a feature gate (`exclusive_range_pattern`). This allows turning ``` rust match i { 0...9 => {}, 10...19 => {}, 20...29 => {}, _ => {} } ``` into ``` rust match i { 0..10 => {}, 10..20 => {}, 20..30 => {}, _ => {} } ```
2017-01-22Auto merge of #39127 - canndrew:unreachable-pattern-errors-into-warnings, ↵bors-11/+4
r=arielb1 Change unreachable pattern ICEs to warnings Allow code with unreachable `?` and `for` patterns to compile. Add some tests.
2017-01-22Remove unused `extern crate`s.Jeffrey Seyfried-2/+0
2017-01-21Fix some nitsAndrew Cann-0/+2
2017-01-19add exclusive range patterns under a feature gateOliver Schneider-24/+47
2017-01-17Change unreachable patterns ICEs to warningsAndrew Cann-11/+2
Allow code with unreachable `?` and `for` patterns to compile. Add some tests.
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-30/+44
2017-01-06rustc: keep track of tables everywhere as if they were per-body.Eduard-Mihai Burtescu-213/+218
2017-01-06fix doc test for E0001Andrew Cann-1/+1
2017-01-05Un-remove E0001, put a notice on it insteadAndrew Cann-0/+27
2017-01-04Fix build after rebaseAndrew Cann-23/+31
2017-01-03Spelling. s/forrest/forestAndrew Cann-4/+4
2017-01-03fix comment that got split in twoNiko Matsakis-3/+2
2017-01-03Fix build after rebase.Andrew Cann-16/+18
Mostly just rename stuff. Visibility checks use DefIds rather than NodeIds now.
2017-01-03Remove E0001 diagnosticAndrew Cann-25/+0
2017-01-03Disable unreachable patterns error entirelyAndrew Cann-12/+9
2017-01-03Refactor is_uninhabitedAndrew Cann-7/+7
We now cache the inhabitedness of types in the GlobalCtxt. Rather than calculating whether a type is visibly uninhabited from a given NodeId we calculate the full set of NodeIds from which a type is visibly uninhabited then cache that set. We can then use that to answer queries about the inhabitedness of a type relative to any given node.
2017-01-03Fix build after rebaseAndrew Cann-5/+5
2017-01-03Style fixAndrew Cann-2/+1
2017-01-03Improve error message, fix and add tests.Andrew Cann-28/+41
Changes the non-exhaustive match error message to generate more general witnesses.
2017-01-03More pattern matching for empty types changesAndrew Cann-84/+128
Fix is_uninhabited for enum types. It used to assume that an enums variant's fields were all private. Fix MIR generation for irrefutable Variant pattern matches. This allows code like this to work: let x: Result<32, !> = Ok(123); let Ok(y) = x; Carry type information on dummy wildcard patterns. Sometimes we need to expand these patterns into their constructors and we don't want to be expanding a TyError into a Constructor::Single.
2017-01-03Make is_useful handle empty types properlyAndrew Cann-19/+66
2017-01-03Start enabling empty types in pattern matching.Andrew Cann-12/+17
Remove the assumption at the start of is_useful that any suitably-long array of wildcard patterns is useful relative the any empty vector. Instead we just continue to recurse column-wise over the matrix. This assumption is false in the presence of empty types. eg. in the simplest case: let x: ! = ...; match x { // This pattern should not be considered useful by the algorithm _ => ... }
2017-01-01rustc_const_eval: convert constants to Pattern instead of hir::Pat.Eduard-Mihai Burtescu-188/+180
2017-01-01rustc_const_eval: build Pattern instead of hir::Pat for pretty-printing.Eduard-Mihai Burtescu-105/+231
2016-12-30Such large. Very 128. Much bits.Simonas Kazlauskas-38/+57
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-5/+9
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-43/+18
2016-12-28rustc: separate bodies for static/(associated)const and embedded constants.Eduard-Mihai Burtescu-26/+33
2016-12-28rustc: separate TraitItem from their parent Item, just like ImplItem.Eduard-Mihai Burtescu-2/+2
2016-12-22Refactor how global paths are represented (for both ast and hir).Jeffrey Seyfried-1/+0
2016-12-02Auto merge of #38053 - eddyb:lazy-9, r=nikomatsakisbors-24/+12
[9/n] rustc: move type information out of AdtDef and TraitDef. _This is part of a series ([prev](https://github.com/rust-lang/rust/pull/37688) | [next]()) 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> Both `AdtDef` and `TraitDef` contained type information (field types, generics and predicates) which was required to create them, preventing their use before that type information exists, or in the case of field types, *mutation* was required, leading to a variance-magicking implementation of `ivar`s. This PR takes that information out and the resulting cleaner setup could even eventually end up merged with HIR, because, just like `AssociatedItem` before it, there's no dependency on types anymore. (With one exception, variant discriminants should probably be moved into their own map later.)
2016-11-30Update the bootstrap compilerAlex Crichton-2/+0
Now that we've got a beta build, let's use it!
2016-11-29rustc: simplify AdtDef by removing the field types and ty::ivar.Eduard-Mihai Burtescu-24/+12
2016-11-29revamp `Visitor` with a single method for controlling nested visitsNiko Matsakis-5/+9
2016-11-29Fix rebase breakageFlorian Diebold-3/+6