summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
AgeCommit message (Collapse)AuthorLines
2020-12-27Prevent caching projections in the case of cyclesMatthew Jasper-6/+12
When normalizing a projection which results in a cycle, we would cache the result of `project_type` without the nested obligations (because they're not needed for inference). This would result in the nested obligations only being handled once in fulfill, which would avoid the cycle error. Fixes #79714, a regresion from #79305 caused by the removal of `get_paranoid_cache_value_obligation`.
2020-12-27Make recursion limit fatal in projectMatthew Jasper-1/+8
This avoid the hang/oom from #79714
2020-12-27Revert change to evaluation orderMatthew Jasper-3/+3
This change breaks some code and doesn't appear to enable any new code.
2020-11-11Rollup merge of #78832 - lcnr:const-evaluatable-unevaluated, r=oli-obkJonas Schievink-0/+17
look at assoc ct, check the type of nodes an example where types matter are function objects, see the added test which previously passed. Now does a shallow comparison of unevaluated constants. r? ```@oli-obk```
2020-11-10Changed unwrap_or to unwrap_or_else in some places.Nicholas-Baron-1/+1
The discussion seems to have resolved that this lint is a bit "noisy" in that applying it in all places would result in a reduction in readability. A few of the trivial functions (like `Path::new`) are fine to leave outside of closures. The general rule seems to be that anything that is obviously an allocation (`Box`, `Vec`, `vec![]`) should be in a closure, even if it is a 0-sized allocation.
2020-11-08Auto merge of #78410 - lcnr:revert75443, r=nikomatsakisbors-2/+2
revert #75443, update mir validator This PR reverts rust-lang#75443 to fix rust-lang#75992 and instead uses rust-lang#75419 to fix rust-lang#75313. Adapts rust-lang#75419 to correctly deal with unevaluated constants as otherwise some `feature(const_evaluatable_checked)` tests would ICE. Note that rust-lang#72793 was also fixed by rust-lang#75443, but as that issue only concerns `feature(type_alias_impl_trait)` I deleted that test case for now and would reopen that issue. rust-lang#75443 may have also allowed some other code to now successfully compile which would make this revert a breaking change after 2 stable versions, but I hope that this is a purely theoretical concern. See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/generator.20upvars/near/214617274 for more reasoning about this. r? `@nikomatsakis` `@eddyb` `@RalfJung`
2020-11-07look at assoc ct, check the type of nodesBastian Kauschke-0/+17
2020-11-06Auto merge of #77856 - GuillaumeGomez:automatic-links-lint, r=jyn514,ollie27bors-1/+1
Add non_autolinks lint Part of #77501. r? `@jyn514`
2020-11-05Fix even more URLsGuillaume Gomez-1/+1
2020-11-04fix a couple of clippy warnings:Matthias Krüger-6/+2
filter_next manual_strip redundant_static_lifetimes single_char_pattern unnecessary_cast unused_unit op_ref redundant_closure useless_conversion
2020-11-02revert #75443 update mir validatorBastian Kauschke-2/+2
2020-11-02Fix formatYuki Okushi-90/+95
2020-11-02Only separate notes if span is multilineYuki Okushi-5/+14
2020-11-02Add "this has type `{}` which {}" noteYuki Okushi-0/+4
2020-11-02Address some code reviewsYuki Okushi-94/+85
2020-11-02Separate complex multispan into some notesYuki Okushi-29/+114
2020-10-30Remove implicit `Continue` typeLeSeulArtichaut-11/+11
2020-10-30Use `ControlFlow::is{break,continue}`LeSeulArtichaut-3/+4
2020-10-30TypeVisitor: use `ControlFlow` in rustc_{infer,lint,trait_selection}LeSeulArtichaut-68/+78
2020-10-29Rollup merge of #78422 - estebank:fix-78372, r=pnkfelixJonas Schievink-7/+13
Do not ICE on invalid input Fix #78372.
2020-10-28Rollup merge of #78365 - lcnr:const-eval-obj-safety, r=oli-obkDylan DPC-47/+99
check object safety of generic constants As `Self` can only be effectively used in constants with `const_evaluatable_checked` this should not matter outside of it. Implements the first item of #72219 > Object safety interactions with constants r? @oli-obk for now cc @nikomatsakis
2020-10-27Add unsized_fn_params featureSantiago Pastorino-2/+2
2020-10-26Do not ICE on invalid inputEsteban Küber-7/+13
2020-10-26debug log `AbstractConst::new`Bastian Kauschke-0/+1
2020-10-26Rollup merge of #78214 - estebank:match-semicolon, r=oli-obkDylan DPC-5/+5
Tweak match arm semicolon removal suggestion to account for futures * Tweak and extend "use `.await`" suggestions * Suggest removal of semicolon on prior match arm * Account for `impl Future` when suggesting semicolon removal * Silence some errors when encountering `await foo()?` as can't be certain what the intent was *Thanks to https://twitter.com/a_hoverbear/status/1318960787105353728 for pointing this out!*
2020-10-25check for object safety violations in constantsBastian Kauschke-47/+98
2020-10-24Rollup merge of #78272 - lcnr:abstract-const-unused-node, r=oli-obkJonas Schievink-21/+64
const_evaluatable_checked: deal with unused nodes + div r? @oli-obk
2020-10-23review commentsEsteban Küber-14/+10
2020-10-23Do not ICE with TraitPredicates containing [type error]Esteban Küber-6/+13
Fix #77919.
2020-10-23Tweak "use `.await`" suggestionEsteban Küber-5/+5
2020-10-23reviewBastian Kauschke-32/+36
2020-10-23const_eval_checked: deal with unused nodes + divBastian Kauschke-12/+51
2020-10-22Normalize when finding trait object candidatesMatthew Jasper-65/+66
2020-10-21Fix ICE from projection cycleMatthew Jasper-20/+9
Cycles in normalization can cause evaluations to change from Unknown to Err. This means that some selection that were applicable no longer are. To avoid this: * Selection candidates that are known to be applicable are prefered over candidates that are not. * We don't ICE if a candidate is no longer applicable.
2020-10-21Rollup merge of #78002 - estebank:issue-77598, r=oli-obkYuki Okushi-48/+63
Tweak "object unsafe" errors CC #77598.
2020-10-20Rollup merge of #78076 - est31:orphan_mod, r=Mark-SimulacrumGuillaume Gomez-0/+0
Move orphan module-name/mod.rs files into module-name.rs files
2020-10-20review commentsEsteban Küber-45/+46
2020-10-20Tweak "object unsafe" errorsEsteban Küber-28/+42
Fix #77598.
2020-10-20Rollup merge of #78111 - SNCPlay42:not-always-self, r=lcnrYuki Okushi-15/+15
Trait predicate ambiguities are not always in `Self` When reporting ambiguities in trait predicates, the compiler incorrectly assumed the ambiguity was always in the type the trait should be implemented on, and never the generic parameters of the trait. This caused silly suggestions for predicates like `<KnownType as Trait<_>>`, such as giving explicit types to completely unrelated variables that happened to be of type `KnownType`. This also reverts #73027, which worked around this issue in some cases and does not appear to be necessary any more. fixes #77982 fixes #78055
2020-10-19don't assume trait ambiguity happens in `Self`SNCPlay42-15/+15
2020-10-19Auto merge of #77908 - bugadani:obl-forest, r=nnethercotebors-6/+4
Try to make ObligationForest more efficient This PR tries to decrease the number of allocations in ObligationForest, as well as moves some cold path code to an uninlined function.
2020-10-18Move orphan module-name/mod.rs files into module-name.rs filesest31-0/+0
2020-10-18Auto merge of #77306 - lcnr:inline-ok, r=eddybbors-4/+7
normalize substs while inlining fixes #68347 or more precisely, this fixes the same ICE in rust analyser as veloren is pinned to a specific nightly and had an error with the current one. I didn't look into creating an MVCE here as that seems fairly annoying, will spend a few minutes doing so rn. (failed) r? `@eddyb` cc `@bjorn3`
2020-10-16Review commentsJack Huey-13/+12
2020-10-16map_bound_ref -> rebindJack Huey-37/+32
2020-10-16Use map_bound(_ref) instead of Binder::bind when possibleJack Huey-40/+60
2020-10-15Turn Outcome into an opaque type to remove some runtime checksDániel Buga-6/+4
2020-10-15Auto merge of #77873 - sexxi-goose:use_tuple_inference_for_closures, ↵bors-9/+53
r=nikomatsakis Replace tuple of infer vars for upvar_tys with single infer var This commit allows us to decide the number of captures required after completing capture ananysis, which is required as part of implementing RFC-2229. closes https://github.com/rust-lang/project-rfc-2229/issues/4 r? `@nikomatsakis`
2020-10-14Address commentsRoxane-26/+14
2020-10-14Remove unused code from remaining compiler cratesest31-4/+0