about summary refs log tree commit diff
path: root/src/librustc/traits/structural_impls.rs
AgeCommit message (Collapse)AuthorLines
2020-03-30rustc -> rustc_middle part 1Mazdak Farrokhzad-654/+0
2020-03-23add missing visit_constsBastian Kauschke-0/+14
2020-03-06Don't redundantly repeat field names (clippy::redundant_field_names)Matthias Krüger-3/+3
2020-03-04Use .map() to modify data inside Options instead of using .and_then(|x| ↵Matthias Krüger-3/+3
Some(y)) (clippy::option_and_then_some)
2020-03-03Rollup merge of #69619 - matthiaskrgr:misc, r=eddybYuki Okushi-1/+1
more cleanups * use starts_with() instead of chars().next() == Some(x) * use subsec_micros() instead of subsec_nanos() / 1000 * use for (idx, item) in iter.enumerate() instead of manually counting loop iterations with variables * use values() or keys() respectively when iterating only over keys or values of maps.
2020-03-02Remove chalk integrationCAD97-72/+0
2020-03-02use values() or keys() respectively when iterating only over keys or values ↵Matthias Krüger-1/+1
of maps.
2020-02-16Make librustc compile.Camille GILLOT-0/+712
2020-02-16Move librustc/{traits,infer} to librustc_infer.Camille GILLOT-71/+0
2020-02-05Split traits::structural_impls in two.Camille GILLOT-703/+1
2020-02-04remove redundant imports (clippy::single_component_path_imports)Matthias Krüger-1/+0
2020-01-02Normalize `syntax::symbol` imports.Mazdak Farrokhzad-1/+1
2019-12-30discriminant -> scrutineeMazdak Farrokhzad-2/+2
2019-12-30Blame user type in pat type error.Mazdak Farrokhzad-1/+3
2019-12-30MatchExpressionArmPattern -> PatternMazdak Farrokhzad-3/+1
Current name is too specific for incoming changes.
2019-12-22Format the worldMark Rousskov-132/+80
2019-12-20Check associated type implementations for generic mismatchesMatthew Jasper-0/+9
2019-11-18Retire EnumLiftImpl.Camille GILLOT-49/+0
2019-11-13Use TypeFoldable derive macro.Camille GILLOT-140/+0
2019-10-31Point at where clauses where the associated item was restrictedEsteban Küber-1/+1
2019-10-28suggest `const_in_array_repeat_expression` flagDavid Wood-1/+1
This commit adds a suggestion to add the `#![feature(const_in_array_repeat_expression)]` attribute to the crate when a promotable expression is used in a repeat expression. Signed-off-by: David Wood <david@davidtw.co>
2019-10-27Auto merge of #65519 - pnkfelix:issue-63438-trait-based-structural-match, ↵bors-0/+1
r=matthewjasper trait-based structural match implementation Moves from using a `#[structural_match]` attribute to using a marker trait (or pair of such traits, really) instead. Fix #63438. (This however does not remove the hacks that I believe were put into place to support the previous approach of injecting the attribute based on the presence of both derives... I have left that for follow-on work.)
2019-10-27Auto merge of #65288 - estebank:point-at-assoc-type, r=nikomatsakisbors-0/+1
Point at associated type for some obligations Partially address #57663.
2019-10-25Migrate from `#[structural_match]` attribute a lang-item trait.Felix S. Klock II-0/+1
(Or more precisely, a pair of such traits: one for `derive(PartialEq)` and one for `derive(Eq)`.) ((The addition of the second marker trait, `StructuralEq`, is largely a hack to work-around `fn (&T)` not implementing `PartialEq` and `Eq`; see also issue rust-lang/rust#46989; otherwise I would just check if `Eq` is implemented.)) Note: this does not use trait fulfillment error-reporting machinery; it just uses the trait system to determine if the ADT was tagged or not. (Nonetheless, I have kept an `on_unimplemented` message on the new trait for structural_match check, even though it is currently not used.) Note also: this does *not* resolve the ICE from rust-lang/rust#65466, as noted in a comment added in this commit. Further work is necessary to resolve that and other problems with the structural match checking, especially to do so without breaking stable code (adapted from test fn-ptr-is-structurally-matchable.rs): ```rust fn r_sm_to(_: &SM) {} fn main() { const CFN6: Wrap<fn(&SM)> = Wrap(r_sm_to); let input: Wrap<fn(&SM)> = Wrap(r_sm_to); match Wrap(input) { Wrap(CFN6) => {} Wrap(_) => {} }; } ``` where we would hit a problem with the strategy of unconditionally checking for `PartialEq` because the type `for <'a> fn(&'a SM)` does not currently even *implement* `PartialEq`. ---- added review feedback: * use an or-pattern * eschew `return` when tail position will do. * don't need fresh_expansion; just add `structural_match` to appropriate `allow_internal_unstable` attributes. also fixed example in doc comment so that it actually compiles.
2019-10-23Rollup merge of #65657 - nnethercote:rm-InternedString-properly, r=eddybMazdak Farrokhzad-5/+5
Remove `InternedString` This PR removes `InternedString` by converting all occurrences to `Symbol`. There are a handful of places that need to use the symbol chars instead of the symbol index, e.g. for stable sorting; local conversions `LocalInternedString` is used in those places. r? @eddyb
2019-10-22Point at associated type for some obligationsEsteban Küber-0/+1
2019-10-22RFC 2027: "first draft" of implementationMathias Blikstad-0/+4
These are a squashed series of commits.
2019-10-21Convert some `InternedString`s to `Symbols`.Nicholas Nethercote-5/+5
This avoids the needs for various conversions, and makes the code slightly faster, because `Symbol` comparisons and hashing is faster.
2019-09-25Rename `sty` to `kind`varkor-1/+1
2019-09-24Remove blanket silencing of "type annotation needed" errorsEsteban Küber-1/+2
Remove blanket check for existence of other errors before emitting "type annotation needed" errors, and add some eager checks to avoid adding obligations when they refer to types that reference `[type error]` in order to reduce unneded errors.
2019-09-22On obligation errors point at the unfulfilled binding when possibleEsteban Küber-0/+1
2019-09-09Shrink `ObligationCauseCode` by boxing `IfExpression`.Nicholas Nethercote-5/+7
The reduction in `memcpy` calls outweighs the cost of the extra allocations, for a net performance win.
2019-09-09Shrink `ObligationCauseCode` by boxing `MatchExpressionArm`.Nicholas Nethercote-4/+4
The reduction in `memcpy` calls greatly outweighs the cost of the extra allocations, for a net performance win.
2019-08-08Use associated_type_bounds where applicable - closes #61738Ilija Tovilo-4/+2
2019-06-14Unify all uses of 'gcx and 'tcx.Eduard-Mihai Burtescu-15/+15
2019-06-12rustc: replace `TyCtxt<'tcx, 'gcx, 'tcx>` with `TyCtxt<'gcx, 'tcx>`.Eduard-Mihai Burtescu-10/+10
2019-06-12Fix fallout from `deny(unused_lifetimes)`.Eduard-Mihai Burtescu-10/+10
2019-06-12rustc: replace `TyCtxt<'a, 'gcx, 'tcx>` with `TyCtxt<'tcx, 'gcx, 'tcx>`.Eduard-Mihai Burtescu-10/+10
2019-06-11rustc: deny(unused_lifetimes).Eduard-Mihai Burtescu-2/+2
2019-06-05Aggregation of drive-by cosmetic changes.Alexander Regueiro-4/+4
2019-05-20Introduce `InternedString::intern`.Nicholas Nethercote-10/+4
`InternedString::intern(x)` is preferable to `Symbol::intern(x).as_interned_str()`, because the former involves one call to `with_interner` while the latter involves two. The case within InternedString::decode() is particularly hot, and this change reduces the number of `with_interner` calls by up to 13%.
2019-04-28Fix lint findings in librustcflip1995-2/+2
2019-04-10Suggest removing `?` to resolve type errors.David Wood-0/+2
This commit adds a suggestion to remove the `?` from expressions if removing the `?` would resolve a type error.
2019-03-15rustc: make util::ppaux private.Eduard-Mihai Burtescu-2/+3
2019-02-14Rollup merge of #58267 - estebank:match-arms, r=matthewjasperMazdak Farrokhzad-3/+14
Tweak "incompatible match arms" error - Point at the body expression of the match arm with the type error. - Point at the prior match arms explicitly stating the evaluated type. - Point at the entire match expr in a secondary span, instead of primary. - For type errors in the first match arm, the cause is outside of the match, treat as implicit block error to give a more appropriate error. Fix #46776, fix #57206. CC #24157, #38234.
2019-02-08review comments: (marginally) reduce memory consumtionEsteban Küber-4/+9
2019-02-07Reweork incompatible match arms errorEsteban Küber-3/+9
- Point at the body expression of the match arm with the type error. - Point at the prior match arms explicitely stating the evaluated type. - Point at the entire match expr in a secondary span, instead of primary. - For type errors in the first match arm, the cause is outside of the match, treat as implicit block error to give a more appropriate error.
2019-02-05move librustc to 2018Mark Mansi-11/+11
2019-01-13Suggest removal of semicolon when appropriateEsteban Küber-1/+5
2019-01-13Tweak output of type mismatch between "then" and `else` `if` armsEsteban Küber-1/+1