about summary refs log tree commit diff
path: root/src/librustc_trait_selection
AgeCommit message (Collapse)AuthorLines
2020-04-24Auto merge of #71215 - ↵bors-28/+47
marmeladema:issue70853/librustc_middle-local-def-id-2, r=eddyb Simplify `local_def_id` and `as_local_hir_id` See #70853
2020-04-24Rollup merge of #71426 - contrun:fix-e0751-explanation, r=estebankDylan DPC-1/+1
fix error code in E0751.md reference: https://github.com/rust-lang/rust/issues/71304
2020-04-23Address comments from reviewmarmeladema-4/+3
2020-04-23Modify `as_local_hir_id` to return a bare `HirId`marmeladema-8/+7
2020-04-23Modify `as_local_hir_id` to accept a `LocalDefId` instead of a `DefId`marmeladema-23/+43
2020-04-23librustc_middle: return LocalDefId instead of DefId in local_def_idmarmeladema-1/+2
2020-04-23fix error code for E0751YI-1/+1
2020-04-22Move `{Free,}RegionRelations` and `FreeRegionMap` out of `rustc_middle`Dylan MacKenzie-1/+1
2020-04-22Rollup merge of #71203 - csmoe:issue-71137, r=csmoeDylan DPC-6/+18
Correct await span for async-await error reporting Closes #71137 r? @tmandry
2020-04-22Rollup merge of #70970 - eddyb:trait-vs-impl-mismatch, r=oli-obkDylan DPC-3/+4
Detect mistyped associated consts in `Instance::resolve`. *Based on #71049 to prevent redundant/misleading downstream errors.* Fixes #70942 by refusing to resolve an associated `const` if it doesn't have the same type in the `impl` that it does in the `trait` (which we assume had errored, and `delay_span_bug` guards against bugs).
2020-04-22add test for correct await spancsmoe-9/+15
2020-04-22Rollup merge of #70998 - estebank:suggest-impl-trait-empty-fn, r=varkorYuki Okushi-32/+92
Suggest `-> impl Trait` and `-> Box<dyn Trait>` on fn that doesn't return During development, a function could have a return type set that is a bare trait object by accident. We already suggest using either a boxed trait object or `impl Trait` if the return paths will allow it. We now do so too when there are *no* return paths or they all resolve to `!`. We still don't handle cases where the trait object is *not* the entirety of the return type gracefully. Closes #38376.
2020-04-21Rollup merge of #71174 - Nokel81:fix-async-main-error, r=petrochenkovDylan DPC-12/+7
Check that main/start is not async * Add new error code E0752 * Add span to hir::IsAsync::Yes * Emit an error if main or the start function is marked as async * Add two regression tests This PR fixes #68523.
2020-04-20Ensure tail expression will have a `Ty` for E0746Esteban Küber-48/+73
When the return type is `!Sized` we look for all the returned expressions in the body to fetch their types and provide a reasonable suggestion. The tail expression of the body is normally evaluated after checking whether the return type is `Sized`. Changing the order of the evaluation produces undesirable knock down effects, so we detect the specific case that newcomers are likely to encounter ,returning a single bare trait object, and only in that case we evaluate the tail expression's type so that the suggestion will be accurate.
2020-04-20Remove some allocations in predicate evaluationEsteban Küber-5/+7
2020-04-20Use more `Iterator`s instead of `Vec`sEsteban Küber-51/+35
2020-04-20Remove unnecessary allocationEsteban Küber-26/+25
2020-04-20Remove some `Vec` allocations in an effort to improve perfEsteban Küber-33/+25
2020-04-20Suggest `-> impl Trait` and `-> Box<dyn Trait>` on fn that doesn't returnEsteban Küber-25/+60
During development, a function could have a return type set that is a bare trait object by accident. We already suggest using either a boxed trait object or `impl Trait` if the return paths will allow it. We now do so too when there are *no* return paths or they all resolve to `!`. We still don't handle cases where the trait object is *not* the entirety of the return type gracefully.
2020-04-20Check that main/start is not asyncSebastian Malton-12/+7
* Add new error code E0752 * Add span to hir::IsAsync::Yes * Emit an error if main or the start function is marked as async * Add two regression tests Fix formatting errors and bless test outputs * move tests to ui/async-await fix test error text remove span from IsAsync
2020-04-19Dogfood more or_patterns in the compilerJosh Stone-35/+30
2020-04-19Auto merge of #69793 - estebank:predicate-obligations-4, r=nikomatsakisbors-183/+67
Maintain chain of derived obligations When evaluating the derived obligations from super traits, maintain a reference to the original obligation in order to give more actionable context in the output. Continuation (and built on) #69745, subset of #69709. r? @eddyb
2020-04-18Add label to item source of bound obligationEsteban Küber-2/+2
2020-04-18Do not emit note for projected derived obligationsEsteban Küber-3/+15
2020-04-18Remove `AssocTypeBound` and propagate bound `Span`sEsteban Küber-188/+50
2020-04-18Maintain chain of derived obligationsEsteban Küber-0/+10
When evaluating the derived obligations from super traits, maintain a reference to the original obligation in order to give more actionable context in the output.
2020-04-18remove build warningsTshepang Lekhonkhobe-2/+2
Code blocks that are not annotated are assumed to be Rust
2020-04-18Detect mistyped associated consts in `Instance::resolve`.Eduard-Mihai Burtescu-3/+4
2020-04-17Auto merge of #71049 - eddyb:const-err, r=oli-obkbors-4/+13
Add `ConstKind::Error` and convert `ErrorHandled::Reported` to it. By replicating the `ty::Error` approach to encoding "an error has occurred", all of the mechanisms that skip redundant/downstream errors are engaged and help out (see the reduction in test output). This PR also adds `ErrorHandled::Linted` for the lint case because using `ErrorHandled::Reported` *without* having emitted an error that is *guaranteed* to stop compilation, is incorrect now. r? @oli-obk cc @rust-lang/wg-const-eval @varkor @yodaldevoid
2020-04-17record await span inside GeneratorInteriorTypeCausecsmoe-12/+18
2020-04-16mir/interpret: only use `ErrorHandled::Reported` for `ErrorReported`.Eduard-Mihai Burtescu-3/+12
2020-04-16ty: add `ty::ConstKind::Error` to replace `tcx.consts.err`.Eduard-Mihai Burtescu-1/+1
2020-04-16Rollup merge of #71179 - matthiaskrgr:cl6ppy, r=Dylan-DPCDylan DPC-13/+13
fix more clippy warnings
2020-04-16Rollup merge of #71141 - Duddino:master, r=estebankDylan DPC-1/+22
Provide better compiler output when using `?` on `Option` in fn returning `Result` and vice-versa Fixes #71089
2020-04-16don't clone types that are copy (clippy::clone_on_copy)Matthias Krüger-11/+11
2020-04-15Fix clippy warningsMatthias Krüger-2/+2
clippy::{filter_next,single_char_pattern,unit_arg,identity_conversion,nonminimal_bool}
2020-04-15Provide better compiler output when using `?` on `Option` in fn returning ↵Duddino-2/+2
`Result` and vice-versa
2020-04-14Provide better compiler output when using `?` on `Option` in fn returning ↵Duddino-1/+22
`Result` and vice-versa
2020-04-14traits/query/normalize: add some `debug!` logging for the result.Eduard-Mihai Burtescu-2/+13
2020-04-14Auto merge of #70679 - tmandry:issue-68112, r=nikomatsakisbors-82/+162
Improve async-await/generator obligation errors in some cases Fixes #68112. This change is best read one commit at a time (I add a test at the beginning and update it in each change after). The `test2` function is a case I found while writing the test that we don't handle with this code yet. I don't attempt to fix it in this PR, but it's a good candidate for future work. r? @davidtwco, @nikomatsakis
2020-04-13Incorporate feedback into diagnosticsTyler Mandry-26/+18
2020-04-13Fix style nitsTyler Mandry-45/+37
2020-04-13Include type info when available for awaited exprTyler Mandry-6/+8
2020-04-13rustfmtTyler Mandry-26/+33
2020-04-13Don't double-annotate the same SpanTyler Mandry-1/+3
2020-04-13Use clearer message when obligation is caused by await exprTyler Mandry-34/+108
2020-04-13Use "generator" instead of "future" when appropriateTyler Mandry-16/+13
2020-04-13Don't annotate type when type is opaqueTyler Mandry-1/+6
2020-04-13Improve span labelTyler Mandry-10/+18
2020-04-13Use inner/outer generator naming instead of first/lastTyler Mandry-12/+13
I personally find this clearer.