about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
AgeCommit message (Collapse)AuthorLines
2021-11-08impl Copy/Clone for arrays in std, not in compilerbstrie-7/+4
2021-11-08fmtDeadbeef-28/+8
2021-11-08Make select_* methods return Vec for TraitEngineDeadbeef-65/+84
2021-11-07more clippy fixesMatthias Krüger-13/+8
2021-11-07Remove some fields from `ObligationCauseCode`Matthew Jasper-11/+4
2021-11-07Rename functions reflect that inline const is also "typeck_child"Gary Guo-1/+1
2021-11-07Give inline const separate DefKindGary Guo-2/+2
2021-11-06Improve terminology around "after typeck"pierwill-6/+8
2021-11-06use matches!() macro in more placesMatthias Krüger-4/+1
2021-11-06Auto merge of #88441 - jackh726:closure_norm, r=nikomatsakisbors-12/+38
Normalize obligations for closure confirmation Based on #90017 Fixes #74261 Fixes #71955 Fixes #88459 r? `@nikomatsakis`
2021-11-05Auto merge of #90577 - matthiaskrgr:clippy_perf_nov, r=petrochenkovbors-1/+1
clippy::perf fixes
2021-11-04clippy::perf fixesMatthias Krüger-1/+1
2021-11-04Erase regions within `vtable_trait_first_method_offset`.Charles Lew-1/+4
2021-11-02Rollup merge of #90417 - lcnr:stabilize-relaxed-struct-unsizing, r=wesleywiserMatthias Krüger-40/+12
stabilize `relaxed_struct_unsize` closes #81793 the fcp is already complete.
2021-10-31Combine drain_filter callsAaron Hill-4/+4
2021-10-30Use SsoHashSetAaron Hill-2/+2
2021-10-30Deduplicate projection sub-obligationsAaron Hill-0/+6
2021-10-30Rollup merge of #90375 - yanok:master, r=lcnrGuillaume Gomez-2/+3
Use `is_global` in `candidate_should_be_dropped_in_favor_of` This manifistated in #90195 with compiler being unable to keep one candidate for a trait impl, if where is a global impl and more than one trait bound in the where clause. Before #87280 `candidate_should_be_dropped_in_favor_of` was using `TypeFoldable::is_global()` that was enough to discard the two `ParamCandidate`s. But #87280 changed it to use `TypeFoldable::is_known_global()` instead, which is pessimistic, so now the compiler drops the global impl instead (because `is_known_global` is not sure) and then can't decide between the two `ParamCandidate`s. Switching it to use `is_global` again solves the issue. Fixes #90195.
2021-10-30stabilize `relaxed_struct_unsize`lcnr-40/+12
2021-10-29Auto merge of #90380 - Mark-Simulacrum:revert-89558-query-stable-lint, r=lcnrbors-1/+0
Revert "Add rustc lint, warning when iterating over hashmaps" Fixes perf regressions introduced in https://github.com/rust-lang/rust/pull/90235 by temporarily reverting the relevant PR.
2021-10-28Revert "Add rustc lint, warning when iterating over hashmaps"Mark Rousskov-1/+0
2021-10-28Move instantiate_opaque_types to rustc_infer.Oli Scherer-288/+5
It does not depend on anything from rustc_trait_selection anymore.
2021-10-28Move some functions into `rustc_infer`.Oli Scherer-317/+1
They don't depend on trait selection anymore, so there is no need for an extension trait.
2021-10-28Manually inline a function that is only ever called at the end of another ↵Oli Scherer-33/+6
function
2021-10-28Remove dead code.Oli Scherer-11/+1
We don't do member constraint checks in regionck anymore. All member constraint checks are done in mir borrowck.
2021-10-28Reformat the changed line to make tidy happyIlya Yanok-2/+3
2021-10-28Use `is_global` in `candidate_should_be_dropped_in_favor_of`Ilya Yanok-1/+1
This manifistated in #90195 with compiler being unable to keep one candidate for a trait impl, if where is a global impl and more than one trait bound in the where clause. Before #87280 `candidate_should_be_dropped_in_favor_of` was using `TypeFoldable::is_global()` that was enough to discard the two `ParamCandidate`s. But #87280 changed it to use `TypeFoldable::is_known_global()` instead, which is pessimistic, so now the compiler drops the global impl instead (because `is_known_global` is not sure) and then can't decide between the two `ParamCandidate`s. Switching it to use `is_global` again solves the issue. Fixes #90195.
2021-10-25fix(rustc_typeck): report function argument errors on matching typeMichael Howell-0/+6
Fixes #90101
2021-10-25Rollup merge of #89889 - estebank:unmet-send-bound-on-foreign-future, r=tmandryMatthias Krüger-77/+70
Use the "nice E0277 errors"[1] for `!Send` `impl Future` from foreign crate Partly address #78543 by making the error quieter. We don't have access to the `typeck` tables from foreign crates, so we used to completely skip the new code when checking foreign crates. Now, we carry on and don't provide as nice output (we don't clarify *what* is making the `Future: !Send`), but at least we no longer emit a sea of derived obligations in the output. [1]: https://blog.rust-lang.org/inside-rust/2019/10/11/AsyncAwait-Not-Send-Error-Improvements.html r? `@tmandry`
2021-10-24Auto merge of #89427 - estebank:collect-overlapping-impls, r=jackh726bors-32/+189
Point at overlapping impls when type annotations are needed Address https://github.com/rust-lang/rust/issues/89254.
2021-10-24Use the "nice E0277 errors"[1] for `!Send` `impl Future` from foreign crateEsteban Kuber-77/+70
Partly address #78543 by making the error quieter. We don't have access to the `typeck` tables from foreign crates, so we used to completely skip the new code when checking foreign crates. Now, we carry on and don't provide as nice output (we don't clarify *what* is making the `Future: !Send`), but at least we no longer emit a sea of derived obligations in the output. [1]: https://blog.rust-lang.org/inside-rust/2019/10/11/AsyncAwait-Not-Send-Error-Improvements.html
2021-10-24Point at overlapping impls when type annotations are neededEsteban Kuber-32/+189
2021-10-24Rollup merge of #89558 - lcnr:query-stable-lint, r=estebankMatthias Krüger-0/+1
Add rustc lint, warning when iterating over hashmaps r? rust-lang/wg-incr-comp
2021-10-23Auto merge of #90104 - spastorino:coherence-for-negative-trait, r=nikomatsakisbors-154/+265
Implement coherence checks for negative trait impls The main purpose of this PR is to be able to [move Error trait to core](https://github.com/rust-lang/project-error-handling/issues/3). This feature is necessary to handle the following from impl on box. ```rust impl From<&str> for Box<dyn Error> { ... } ``` Without having negative traits affect coherence moving the error trait into `core` and moving that `From` impl to `alloc` will cause the from impl to no longer compiler because of a potential future incompatibility. The compiler indicates that `&str` _could_ introduce an `Error` impl in the future, and thus prevents the `From` impl in `alloc` that would cause overlap with `From<E: Error> for Box<dyn Error>`. Adding `impl !Error for &str {}` with the negative trait coherence feature will disable this error by encoding a stability guarantee that `&str` will never implement `Error`, making the `From` impl compile. We would have this in `alloc`: ```rust impl From<&str> for Box<dyn Error> {} // A impl<E> From<E> for Box<dyn Error> where E: Error {} // B ``` and this in `core`: ```rust trait Error {} impl !Error for &str {} ``` r? `@nikomatsakis` This PR was built on top of `@yaahc` PR #85764. Language team proposal: to https://github.com/rust-lang/lang-team/issues/96
2021-10-23Avoid code duplication by extracting checks into fnsSantiago Pastorino-11/+18
2021-10-22Hide negative coherence checks under negative_impls feature flagSantiago Pastorino-4/+5
2021-10-22Assemple trait alias candidates for negative polaritySantiago Pastorino-0/+1
This doesn't work properly yet, we would probably need to implement an `assembly_neg_candidates` and consider things like `T: !AB` as `T: !A` || `T: !B`
2021-10-22Add rustc_strict_coherence attribute and use it to check overlapSantiago Pastorino-2/+13
2021-10-22Add comment about the only way to prove NotImplemented hereSantiago Pastorino-0/+2
2021-10-22Fix filter_impls commentSantiago Pastorino-2/+2
2021-10-22Fix debug method nameSantiago Pastorino-1/+1
2021-10-22Move const filter to filter_implsSantiago Pastorino-35/+44
2021-10-22Document overlap check filterSantiago Pastorino-1/+21
2021-10-22Rollup merge of #90028 - tmiasko:structural-match-closure, r=spastorinoYuki Okushi-1/+5
Reject closures in patterns Fixes #90013.
2021-10-21Rollup merge of #88644 - eopb:abstractconst_leaf_subst, r=lcnrYuki Okushi-23/+22
`AbstractConst` private fields Calls `subst` in `AbstractConst::root` when `Node` is `Leaf`. r? ``@lcnr``
2021-10-20Fix allow_negative_impls logicSantiago Pastorino-2/+2
2021-10-20Add TraitObligation::polarity() for better encapsulationSantiago Pastorino-14/+8
2021-10-20Filter candidates when goal and impl polarity doesn't matchSantiago Pastorino-9/+27
2021-10-20Use predicate_must_hold_modulo_regionsSantiago Pastorino-1/+1
2021-10-20Filter out Negative impls on intercrate mode's ambiguous reasoningSantiago Pastorino-23/+30