about summary refs log tree commit diff
path: root/src/librustc_const_eval/_match.rs
AgeCommit message (Collapse)AuthorLines
2018-03-08Move librustc_const_eval to librustc_mirOliver Schneider-1217/+0
2018-03-08Produce instead of pointersOliver Schneider-32/+148
2018-03-05Turn features() into a query.Michael Woerister-2/+2
2018-02-23Introduce UnpackedKindvarkor-1/+1
This adds an `UnpackedKind` type as a typesafe counterpart to `Kind`. This should make future changes to kinds (such as const generics!) more resilient, as the type-checker should catch more potential issues.
2018-02-17fix more typos found by codespell.Matthias Krüger-1/+1
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.
2017-11-18rustc_mir: always downcast enums, even if univariant.Eduard-Mihai Burtescu-3/+3
2017-11-03Implemented RFC 2008 for enums (not including variants) and structs.David Wood-4/+69
2017-10-16refactor inhabitedness to have clearer public entry pointsNiko Matsakis-7/+5
2017-09-11rustc: evaluate fixed-length array length expressions lazily.Eduard-Mihai Burtescu-8/+10
2017-09-11rustc: use ty::Const for the length of TyArray.Eduard-Mihai Burtescu-4/+7
2017-09-11rustc: replace usize with u64 and ConstUsize.Eduard-Mihai Burtescu-17/+17
2017-09-11rustc: introduce ty::Const { ConstVal, Ty }.Eduard-Mihai Burtescu-18/+24
2017-09-11rustc: intern ConstVal's in TyCtxt.Eduard-Mihai Burtescu-22/+25
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-6/+6
Like #43008 (f668999), but _much more aggressive_.
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-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-03-27Fix various useless derefs and slicingsOliver Schneider-2/+2
2017-02-25rustc_const_eval: always demand typeck_tables for evaluating constants.Eduard-Mihai Burtescu-12/+13
2017-02-20check_match: don't treat privately uninhabited types as uninhabitedAriel Ben-Yehuda-30/+62
Fixes #38972.
2017-02-10Use global recursion limit when evaluating inhabitednessAndrew Cann-3/+3
2017-02-09Add recursion limit to inhabitedness checkAndrew Cann-1/+1
Fixes #39489. Add test aswell.
2017-02-03Add warning for () to ! switchAndrew Cann-2/+2
2017-01-30Merge ty::TyBox into ty::TyAdtVadim Petrochenkov-2/+0
2017-01-25Hide uninhabitedness checks behind feature gateAndrew Cann-4/+13
2017-01-19add exclusive range patterns under a feature gateOliver Schneider-17/+34
2017-01-04Fix build after rebaseAndrew Cann-10/+15
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-14/+14
Mostly just rename stuff. Visibility checks use DefIds rather than NodeIds now.
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-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-51/+92
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-11/+52
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: build Pattern instead of hir::Pat for pretty-printing.Eduard-Mihai Burtescu-83/+62
2016-12-22Refactor how global paths are represented (for both ast and hir).Jeffrey Seyfried-1/+0
2016-11-29rustc: simplify AdtDef by removing the field types and ty::ivar.Eduard-Mihai Burtescu-4/+2
2016-11-28rustc: embed path resolutions into the HIR instead of keeping DefMap.Eduard-Mihai Burtescu-3/+8
2016-11-28rustc: desugar UFCS as much as possible during HIR lowering.Eduard Burtescu-7/+4
2016-11-09Auto merge of #37603 - arielb1:max-slice-length, r=nikomatsakisbors-8/+97
_match: correct max_slice_length logic The logic used to be wildly wrong, but before the HAIR patch its wrongness was in most cases hidden by another bug. Fixes #37598. r? @nikomatsakis
2016-11-08add more commentAriel Ben-Yehuda-14/+61
2016-11-08Replace FnvHasher use with FxHasher.Nicholas Nethercote-3/+3
This speeds up compilation by 3--6% across most of rustc-benchmarks.
2016-11-05_match: correct max_slice_length logicAriel Ben-Yehuda-8/+50
The logic used to be wildly wrong, but before the HAIR patch its wrongness was hidden by another bug. Fixes #37598.
2016-10-26handle mixed byte literal and byte array patternsAriel Ben-Yehuda-45/+140
Convert byte literal pattern to byte array patterns when they are both used together. so matching them is properly handled. I could've done the conversion eagerly, but that could have caused a bad worst-case for massive byte-array matches. Fixes #18027. Fixes #25051. Fixes #26510.
2016-10-26remove StaticInliner and NaN checkingAriel Ben-Yehuda-5/+3
NaN checking was a lint for a deprecated feature. It can go away.
2016-10-26stop using MatchCheckCtxt to hold the param-env for check_matchAriel Ben-Yehuda-18/+0