about summary refs log tree commit diff
path: root/src/librustc/traits
AgeCommit message (Collapse)AuthorLines
2019-09-24improve commentsAriel Ben-Yehuda-1/+1
2019-09-24resolve the rustc_reservation_impl attribute in 1 placeAriel Ben-Yehuda-14/+12
2019-09-24reserve `impl<T> From<!> for T`Ariel Ben-Yehuda-4/+17
this is necessary for never-type stabilization
2019-09-24Fix coherence checking for impl trait in type aliasesAaron Hill-6/+14
Fixes #63677 RFC #2071 (impl-trait-existential-types) does not explicitly state how impl trait type alises should interact with coherence. However, there's only one choice which makes sense - coherence should look at the underlying type (i.e. the 'defining' type of the impl trait) of the type alias, just like we do for non-impl-trait type aliases. Specifically, impl trait type alises which resolve to a local type should be treated like a local type with respect to coherence (e.g. impl trait type aliases which resolve to a forieign type should be treated as a foreign type, and those that resolve to a local type should be treated as a local type). Since neither inherent impls nor direct trait impl (i.e. `impl MyType` or `impl MyTrait for MyType`) are allowd for type aliases, this usually does not come up. Before we ever attempt to do coherence checking, we will have errored out if an impl trait type alias was used directly in an 'impl' clause. However, during trait selection, we sometimes need to prove bounds like 'T: Sized' for some type 'T'. If 'T' is an impl trait type alias, this requires to know the coherence behavior for impl trait type aliases when we perform coherence checking. Note: Since determining the underlying type of an impl trait type alias requires us to perform body type checking, this commit causes us to type check some bodies easlier than we otherwise would have. However, since this is done through a query, this shouldn't cause any problems For completeness, I've added an additional test of the coherence-related behavior of impl trait type aliases.
2019-09-22hack to avoid incorrect suggestionEsteban Küber-0/+7
2019-09-22On obligation errors point at the unfulfilled binding when possibleEsteban Küber-4/+22
2019-09-21Rollup merge of #63907 - estebank:assoc-type-mismatch, r=oli-obkMazdak Farrokhzad-19/+18
Add explanation to type mismatch involving type params and assoc types CC #63711
2019-09-21Rollup merge of #64342 - glorv:master, r=varkorMazdak Farrokhzad-2/+2
factor out pluralisation remains after #64280 there are two case that doesn't not match the original macro pattern at [here](https://github.com/rust-lang/rust/blob/master/src/librustc_lint/unused.rs#L146) and [here](https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/diagnostics.rs#L539) as the provided param is already a bool or the check condition is not `x != 1`, so I change the macro accept a boolean expr instead of number to fit all the cases. @Centril please review Fixes #64238.
2019-09-20Specialize the `stalled_on` handling in `process_obligation()`.Nicholas Nethercote-19/+36
Optimizing for the common numbers of entries in `stalled_on` wins about 4% on `keccak` and `inflate`.
2019-09-19review commentsEsteban Küber-0/+7
2019-09-19When possible, suggest fn callEsteban Küber-25/+53
2019-09-20factor out pluralisation remains after #64280gaolei-2/+2
2019-09-19Auto merge of #64545 - nnethercote:ObligForest-more, r=nmatsakisbors-6/+11
More `ObligationForest` improvements Following on from #64500, these commits alsomake the code both nicer and faster. r? @nikomatsakis
2019-09-18Add explanation to type mismatch involving type params and assoc typesEsteban Küber-19/+18
2019-09-19Fix a minor grammar nit, update UI testsJames Munns-1/+1
2019-09-19Add a specialized version of `shallow_resolve()`.Nicholas Nethercote-3/+1
The super-hot call site of `inlined_shallow_resolve()` basically does `r.inlined_shallow_resolve(ty) != ty`. This commit introduces a version of that function specialized for that particular call pattern, `shallow_resolve_changed()`. Incredibly, this reduces the instruction count for `keccak` by 5%. The commit also renames `inlined_shallow_resolve()` as `shallow_resolve()` and removes the `inline(always)` annotation, as it's no longer nearly so hot.
2019-09-19Use explicit iteration instead of `all()` in `process_obligation()`.Nicholas Nethercote-4/+11
Amazingly enough, this is a 3.5% instruction count win on `keccak`.
2019-09-17Fix re-rebalance coherence implementation for fundamental typesGeorg Semmler-1/+9
Fixes #64412
2019-09-09Shrink `ObligationCauseCode` by boxing `IfExpression`.Nicholas Nethercote-13/+18
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-15/+19
The reduction in `memcpy` calls greatly outweighs the cost of the extra allocations, for a net performance win.
2019-09-09Add some assertions on obligation type sizes.Nicholas Nethercote-0/+12
These are types that get memcpy'd a lot.
2019-09-07Apply suggestions from code reviewAlexander Regueiro-1/+1
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-09-07Aggregation of cosmetic changes made during work on REPL PRs: librustcAlexander Regueiro-21/+22
2019-09-06Fixed grammar/style in error messages and reblessed tests.Alexander Regueiro-3/+4
2019-09-05Rollup merge of #64141 - nnethercote:minimize-LocalInternedString, ↵Mazdak Farrokhzad-9/+10
r=petrochenkov Minimize uses of `LocalInternedString` `LocalInternedString` is described as "An alternative to `Symbol` and `InternedString`, useful when the chars within the symbol need to be accessed. It is best used for temporary values." This PR makes the code match that comment, by removing all non-local uses of `LocalInternedString`. This allows the removal of a number of operations on `LocalInternedString` and a couple of uses of `unsafe`.
2019-09-04Remove `LocalInternedString` uses from `librustc/traits/`.Nicholas Nethercote-9/+10
2019-09-03review commentsEsteban Küber-1/+3
2019-09-02account for DUMMY_SP and correct wordingEsteban Küber-4/+4
2019-09-02On object safety violation, point at source when possibleEsteban Küber-22/+37
2019-09-02Refer to "`self` type" instead of "receiver type"Esteban Küber-7/+9
2019-09-01review commentEsteban Küber-2/+1
2019-08-31fix rebaseEsteban Küber-1/+1
2019-08-31review comments: reword commentEsteban Küber-4/+4
2019-08-31Suggest call fn ctor passed as arg to fn with type param boundsEsteban Küber-7/+61
2019-08-31Use span label instead of note for cause in E0631Esteban Küber-14/+23
2019-08-29Rollup merge of #63961 - JohnTitor:improve-require-lang-item, r=estebankMazdak Farrokhzad-1/+1
Add Option<Span> to `require_lang_item` Fixes #63954 I'm not sure where to take `Some(span)` or something so I use `None` in many places. r? @estebank
2019-08-28Auto merge of #63820 - oli-obk:eager_const_eval, r=nikomatsakisbors-71/+3
Simplify eager normalization of constants r? @nikomatsakis
2019-08-28Add Option<Span> to `require_lang_item`Yuki Okushi-1/+1
2019-08-27Cleanup: Consistently use `Param` instead of `Arg` #62426Kevin Per-1/+2
2019-08-23Simplify eager normalization of constantsOliver Scherer-71/+3
2019-08-19review commentsEsteban Küber-2/+2
2019-08-19Use constraint span when lowering associated typesEsteban Küber-7/+10
2019-08-19Auto merge of #63463 - matthewjasper:ty_param_cleanup, r=petrochenkovbors-52/+57
Don't special case the `Self` parameter by name This results in a couple of small diagnostic regressions. They could be avoided by keeping the special case just for diagnostics, but that seems worse. closes #50125 cc #60869
2019-08-18Pre intern the `Self` parameter typeMatthew Jasper-34/+21
Use this to simplify the object safety code a bit.
2019-08-15hygiene: `ExpnInfo` -> `ExpnData`Vadim Petrochenkov-3/+3
For naming consistency with everything else in this area
2019-08-15hygiene: Remove `Option`s from functions returning `ExpnInfo`Vadim Petrochenkov-4/+4
The expansion info is not optional and should always exist
2019-08-15`Ident::with_empty_ctxt` -> `Ident::with_dummy_span`Vadim Petrochenkov-1/+1
`Ident` has had a full span rather than just a `SyntaxContext` for a long time now.
2019-08-11Remove `is_self` and `has_self_ty` methodsMatthew Jasper-63/+81
2019-08-08Use associated_type_bounds where applicable - closes #61738Ilija Tovilo-5/+3
2019-08-06Rollup merge of #63264 - arielb1:revert-private-coherence-errors, r=estebankMazdak Farrokhzad-7/+2
Revert "Rollup merge of #62696 - chocol4te:fix_#62194, r=estebank" This reverts commit df21a6f040a7011d509769a61ac7af9502636b33 (#62696), reversing changes made to cc16d0486933e02237190366de2eb43df2215c11. That PR makes error messages worse than before, and we couldn't come up with a way of actually making them better, so revert it for now. Any idea for making this error message better is welcome! Fixes #63145. r? @estebank