summary refs log tree commit diff
path: root/src/librustc/traits/structural_impls.rs
AgeCommit message (Collapse)AuthorLines
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
2019-01-12Point at the match discriminant when arm pattern has a type mismatchEsteban Küber-0/+3
2018-12-27Handle sub-typing in chalk-enginescalexm-0/+3
2018-12-27Implement "lifetime juggling" methods from chalk integration traitscalexm-2/+26
Fixes #55097.
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-03pass the parameter environment to `traits::find_associated_item`Ariel Ben-Yehuda-2/+2
dropping the param-env on the floor is obviously the wrong thing to do. The ICE was probably exposed by #54490 adding the problem-exposing use of `traits::find_associated_item`. Fixes #55380.
2018-11-24Move `BoundTy` debruijn index to the `TyKind` enum variantscalexm-1/+1
2018-11-13Reorder code in `rustc::traits::structural_impls`scalexm-340/+340
2018-11-13Bypass ppaux for `Outlives` predicatesscalexm-4/+34
2018-11-13Pretty print quantified goals and clausesscalexm-5/+144
2018-11-03Added support for trait aliases as bounds.Alexander Regueiro-6/+36
2018-10-25preserve const eval error information through trait error systemRalf Jung-1/+1
2018-10-25Report const eval error inside the queryOliver Schneider-3/+1
2018-10-17Categorize chalk clausesscalexm-2/+7
2018-10-17Use `Environment` instead of `ty::ParamEnv` in chalk contextscalexm-1/+37
2018-10-08Pass around interned refs to goals and not goalsscalexm-17/+17
2018-09-29don't elide lifetimes in paths in librustc/Zack M. Davis-21/+21
This seemed like a good way to kick the tires on the elided-lifetimes-in-paths lint (#52069)—seems to work! This was also pretty tedious—it sure would be nice if `cargo fix` worked on this codebase (#53896)!
2018-09-26Auto merge of #54199 - nikomatsakis:predicate_may_hold-failure, r=eddybbors-1/+1
overlook overflows in rustdoc trait solving Context: The new rustdoc "auto trait" feature walks across impls and tries to run trait solving on them with a lot of unconstrained variables. This is prone to overflows. These overflows used to cause an ICE because of a caching bug (fixed in this PR). But even once that is fixed, it means that rustdoc causes an overflow rather than generating docs. This PR therefore adds a new helper that propagates the overflow error out. This requires rustdoc to then decide what to do when it encounters such an overflow: technically, an overflow represents neither "yes" nor "no", but rather a failure to make a decision. I've decided to opt on the side of treating this as "yes, implemented", since rustdoc already takes an optimistic view. This may prove to include too many items, but I *suspect* not. We could probably reduce the rate of overflows by unifying more of the parameters from the impl -- right now we only seem to consider the self type. Moreover, in the future, as we transition to Chalk, overflow errors are expected to just "go away" (in some cases, though, queries might return an ambiguous result). Fixes #52873 cc @QuietMisdreavus -- this is the stuff we were talking about earlier cc @GuillaumeGomez -- this supersedes #53687