summary refs log tree commit diff
path: root/compiler/rustc_mir_build/src
AgeCommit message (Collapse)AuthorLines
2020-11-15Don't re-export std::ops::ControlFlow in the compiler.Leonora Tindall-1/+2
2020-09-26Speed up `IntRange::from_pat`Dylan MacKenzie-3/+27
Previously, this method called the more general `pat_constructor` function, which can return other pattern variants besides `IntRange`. Then it throws away any non-`IntRange` variants. Specialize it so work is only done when it could result in an `IntRange`.
2020-09-26Auto merge of #70743 - oli-obk:eager_const_to_pat_conversion, r=eddybbors-110/+340
Fully destructure constants into patterns r? `@varkor` as discussed in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/constants.20in.20patterns/near/192789924 we should probably crater it once reviewed
2020-09-24Auto merge of #76918 - ishitatsuyuki:match-fastpath, r=oli-obkbors-22/+165
Add fast path for match checking This adds a fast path that would reduce the complexity to linear on matches consisting of only variant patterns (i.e. enum matches). (Also see: #7462) Unfortunately, I was too lazy to add a similar fast path for constants (mostly for integer matches), ideally that could be added another day. TBH, I'm not confident with the performance claims due to the fact that enums tends to be small and FxHashMap could add a lot of overhead. r? `@Mark-Simulacrum` needs perf
2020-09-24Document `FallbackToConstRef` and make sure we don't accidentally use itOliver Scherer-4/+19
2020-09-24Deduplicate the "needs partialeq derive" message creation sitesOliver Scherer-21/+13
2020-09-24Use correct type in diagnostics againOliver Scherer-48/+45
2020-09-23Make sure we keep emitting a hard errorOliver Scherer-18/+36
2020-09-23Make sure we report a future incompat error in all casesOliver Scherer-1/+19
2020-09-23Name function correctlyOliver Scherer-3/+3
2020-09-23Make sure we don't hide errors just because a lint has been emittedOliver Scherer-7/+20
2020-09-23Deduplicate errors in const to pat conversionOliver Scherer-5/+28
2020-09-23Talk about unpredictable instead of "not deterministic"Oliver Scherer-2/+2
2020-09-23Remove the "lift constant to reference" logicOliver Scherer-46/+28
2020-09-22Add debug assertions against slow path reference resultsIshi Tatsuyuki-10/+37
2020-09-21Improve code and documentation clarityIshi Tatsuyuki-41/+75
2020-09-21fix typo in docs and commentsyuk1ty-1/+1
2020-09-20Use precise errors during const to pat conversion instead of a catch-all on ↵Oliver Scherer-12/+73
the main constant
2020-09-20Lint on function pointers used in patternsOliver Scherer-1/+18
2020-09-20Split check for `PartialEq` impl into a methodOliver Scherer-28/+35
2020-09-20Rollup merge of #76890 - matthiaskrgr:matches_simpl, r=lcnrRalf Jung-3/+2
use matches!() macro for simple if let conditions
2020-09-20Implement destructuring for all aggregates and for referencesOliver Scherer-27/+118
2020-09-20Merge tuple and struct pattern generation.Oliver Scherer-5/+1
2020-09-20array patternBastian Kauschke-4/+4
2020-09-20use `array_windows` instead of `windows` in the compilerBastian Kauschke-3/+3
2020-09-19Add fast path for match checkingishitatsuyuki-13/+95
2020-09-19Rollup merge of #76757 - matthiaskrgr:clippy_try_into, r=lcnrRalf Jung-1/+1
don't convert types to the same type with try_into (clippy::useless_conversion)
2020-09-18use matches!() macro for simple if let conditionsMatthias Krüger-3/+2
2020-09-15don't convert types to the same type with try_into (clippy::useless_conversion)Matthias Krüger-1/+1
2020-09-10Note when a a move/borrow error is caused by a deref coercionAaron Hill-7/+22
Fixes #73268 When a deref coercion occurs, we may end up with a move error if the base value has been partially moved out of. However, we do not indicate anywhere that a deref coercion is occuring, resulting in an error message with a confusing span. This PR adds an explicit note to move errors when a deref coercion is involved. We mention the name of the type that the deref-coercion resolved to, as well as the `Deref::Target` associated type being used.
2020-09-10Auto merge of #75573 - Aaron1011:feature/const-mutation-lint, r=oli-obkbors-3/+21
Add CONST_ITEM_MUTATION lint Fixes #74053 Fixes #55721 This PR adds a new lint `CONST_ITEM_MUTATION`. Given an item `const FOO: SomeType = ..`, this lint fires on: * Attempting to write directly to a field (`FOO.field = some_val`) or array entry (`FOO.array_field[0] = val`) * Taking a mutable reference to the `const` item (`&mut FOO`), including through an autoderef `FOO.some_mut_self_method()` The lint message explains that since each use of a constant creates a new temporary, the original `const` item will not be modified.
2020-09-07Add CONST_ITEM_MUTATION lintAaron Hill-3/+21
Fixes #74053 Fixes #55721 This PR adds a new lint `CONST_ITEM_MUTATION`. Given an item `const FOO: SomeType = ..`, this lint fires on: * Attempting to write directly to a field (`FOO.field = some_val`) or array entry (`FOO.array_field[0] = val`) * Taking a mutable reference to the `const` item (`&mut FOO`), including through an autoderef `FOO.some_mut_self_method()` The lint message explains that since each use of a constant creates a new temporary, the original `const` item will not be modified.
2020-09-07Rollup merge of #76318 - scottmcm:one-control-flow, r=ecstatic-morseDylan DPC-3/+4
Use ops::ControlFlow in rustc_data_structures::graph::iterate Since I only know about this because you mentioned it, r? @ecstatic-morse If we're not supposed to use new `core` things in compiler for a while then feel free to close, but it felt reasonable to merge the two types since they're the same, and it might be convenient for people to use `?` in their traversal code. (This doesn't do the type parameter swap; NoraCodes has signed up to do that one.)
2020-09-04Change ty.kind to a methodLeSeulArtichaut-92/+86
2020-09-04Use ops::ControlFlow in graph::iterateScott McMurray-3/+4
2020-09-02pretty: trim paths of unique symbolsDan Aloni-2/+3
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2020-08-30mv compiler to compiler/mark-0/+15282