about summary refs log tree commit diff
path: root/src/test/ui/closures
AgeCommit message (Collapse)AuthorLines
2021-01-17Rollup merge of #80635 - sexxi-goose:use-place-instead-of-symbol, ↵Mara Bos-0/+251
r=nikomatsakis` Improve diagnostics when closure doesn't meet trait bound Improves the diagnostics when closure doesn't meet trait bound by modifying `TypeckResuts::closure_kind_origins` such that `hir::Place` is used instead of `Symbol`. Using `hir::Place` to describe which capture influenced the decision of selecting a trait a closure satisfies to (Fn/FnMut/FnOnce, Copy) allows us to show precise path in the diagnostics when `capture_disjoint_field` feature is enabled. Closes rust-lang/project-rfc-2229/issues/21 r? ```@nikomatsakis```
2021-01-16fix line numbersChris Pardy-25/+25
2021-01-15fix tidyChris Pardy-5/+2
2021-01-15Improve diagnostics for Precise CaptureChris Pardy-2/+436
2021-01-13Rollup merge of #78901 - arora-aman:fix_closure_coerce, r=estebankDylan DPC-0/+87
diagnostics: Note capturing closures can't be coerced to fns Fixes #72457, fixes #71895 r? `@estebank`
2021-01-02use hir::Place instead of Symbol in closure_kind_originRoxane-0/+251
2021-01-01Move block-related testsYuki Okushi-0/+180
2020-12-29Remove `compile-fail` test suiteVadim Petrochenkov-0/+31
2020-12-11Test cases for RFC 2229Aman Arora-0/+914
2020-11-29diagnostics: Note capturing closures can't be coerced to fnsAman Arora-0/+87
Fixes: #72457, #71895
2020-11-13Log closure as wellAman Arora-215/+716
2020-11-10Add test for capturing enumsAman Arora-0/+134
2020-11-10Address review comments 2Aman Arora-27/+27
2020-11-10More pattern testcasesAman Arora-63/+314
2020-11-10Reduce verbosity of capture analysis logsRoxane Fruytier-876/+218
Co-authored-by: Jenny Wills <wills.jenniferg@gmail.com> Co-authored-by: Aman Arora <me@aman-arora.com>
2020-11-10Update tests with min capture informationAman Arora-0/+454
Co-authored-by: Chris Pardy <chrispardy36@gmail.com> Co-authored-by: Logan Mosier <logmosier@gmail.com>
2020-11-10Add helper function for Capture Esclations and expressionsAman Arora-2/+9
Co-authored-by: Dhruv Jauhar <dhruvjhr@gmail.com>
2020-11-10Add initial set of testcases for RFC 2229Aman Arora-2/+907
Co-authored-by: Dhruv Jauhar <dhruvjhr@gmail.com>
2020-11-10Indroduce feature flag for RFC-2229Aman Arora-0/+34
Signed-off-by: Aman Arora <me@aman-arora.com>
2020-10-29Make anonymous binders start at 0Jack Huey-2/+2
2020-10-27Add unsized_fn_params featureSantiago Pastorino-1/+1
2020-10-22Explain where the closure return type was inferredAaron Hill-0/+38
Fixes #78193
2020-10-06Fix tests from rebaseMatthew Jasper-3/+3
2020-10-06Normalize projection bounds when considering candidatesMatthew Jasper-2/+21
This unfortunately requires some winnowing hacks to avoid now ambiguous candidates.
2020-09-28Add tests for updated closure/generator printingAman Arora-0/+218
Co-authored-by: Dhruv Jauhar <dhruvjhr@gmail.com> Co-authored-by: Logan Mosier <logmosier@gmail.com>
2020-09-28pretty.rs: Update Closure and Generator printAman Arora-13/+13
Co-authored-by: Dhruv Jauhar <dhruvjhr@gmail.com> Co-authored-by: Logan Mosier <logmosier@gmail.com>
2020-09-17Only visit types once when walking the type treeValerii Lashmanov-0/+59
This fixes #72408. Nested closures were resulting in exponential compilation time. As a performance optimization this change introduces MiniSet, which is a simple small storage optimized set.
2020-09-02pretty: trim paths of unique symbolsDan Aloni-15/+15
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2020-07-27mv std libs to library/mark-2/+2
2020-07-14Remove redundant explanatory `note` for type parametersEsteban Küber-2/+0
2020-06-28Update testsDylan MacKenzie-12/+2
2020-06-22move leak-check to during coherence, candidate evalNiko Matsakis-17/+7
In particular, it no longer occurs during the subtyping check. This is important for enabling lazy normalization, because the subtyping check will be producing sub-obligations that could affect its results. Consider an example like for<'a> fn(<&'a as Mirror>::Item) = fn(&'b u8) where `<T as Mirror>::Item = T` for all `T`. We will wish to produce a new subobligation like <'!1 as Mirror>::Item = &'b u8 This will, after being solved, ultimately yield a constraint that `'!1 = 'b` which will fail. But with the leak-check being performed on subtyping, there is no opportunity to normalize `<'!1 as Mirror>::Item` (unless we invoke that normalization directly from within subtyping, and I would prefer that subtyping and unification are distinct operations rather than part of the trait solving stack). The reason to keep the leak check during coherence and trait evaluation is partly for backwards compatibility. The coherence change permits impls for `fn(T)` and `fn(&T)` to co-exist, and the trait evaluation change means that we can distinguish those two cases without ambiguity errors. It also avoids recreating #57639, where we were incorrectly choosing a where clause that would have failed the leak check over the impl which succeeds. The other reason to keep the leak check in those places is that I think it is actually close to the model we want. To the point, I think the trait solver ought to have the job of "breaking down" higher-ranked region obligation like ``!1: '2` into into region obligations that operate on things in the root universe, at which point they should be handed off to polonius. The leak check isn't *really* doing that -- these obligations are still handed to the region solver to process -- but if/when we do adopt that model, the decision to pass/fail would be happening in roughly this part of the code. This change had somewhat more side-effects than I anticipated. It seems like there are cases where the leak-check was not being enforced during method proving and trait selection. I haven't quite tracked this down but I think it ought to be documented, so that we know what precisely we are committing to. One surprising test was `issue-30786.rs`. The behavior there seems a bit "fishy" to me, but the problem is not related to the leak check change as far as I can tell, but more to do with the closure signature inference code and perhaps the associated type projection, which together seem to be conspiring to produce an unexpected signature. Nonetheless, it is an example of where changing the leak-check can have some unexpected consequences: we're now failing to resolve a method earlier than we were, which suggests we might change some method resolutions that would have been ambiguous to be successful. TODO: * figure out remainig test failures * add new coherence tests for the patterns we ARE disallowing
2020-06-15Tweak "non-primitive cast" errorEsteban Küber-3/+1
- Suggest borrowing expression if it would allow cast to work. - Suggest using `<Type>::from(<expr>)` when appropriate. - Minor tweak to `;` typo suggestion. Partily address #47136.
2020-05-29liveness: Warn about unused captured variablesTomasz Miąsko-4/+4
2020-05-22Update testsMatthew Jasper-140/+121
2020-05-18Rollup merge of #71599 - ldm0:fnclo, r=nikomatsakisDylan DPC-0/+424
Support coercion between (FnDef | Closure) and (FnDef | Closure) Fixes #46742, fixes #48109 Inject `Closure` into the `FnDef x FnDef` coercion special case, which makes coercion of `(FnDef | Closure) x (FnDef | Closure)` possible, where closures should be **non-capturing**.
2020-05-09Test for coercion between (FnDef | Closure) and (FnDef | Closure)Donough Liu-0/+424
2020-05-08Skip tests on emscriptenYuki Okushi-0/+1
2020-05-06Move tests from `test/run-fail` to UIYuki Okushi-0/+9
2020-04-16ty: convert `ErrorHandled::Reported` to `ConstKind::Error`.Eduard-Mihai Burtescu-24/+3
2020-04-08Small tweaks to required bound spanEsteban Küber-2/+2
2020-04-08Use `PredicateObligation`s instead of `Predicate`sEsteban Küber-1/+1
Keep more information about trait binding failures.
2020-04-02tests: remove ignore directives from tests that mention core/alloc/std spans.Eduard-Mihai Burtescu-8/+4
2020-03-30Rollup merge of #70546 - lqd:polonius_update, r=nikomatsakisDylan DPC-3/+3
Polonius: update to 0.12.1, fix more move errors false positives, update test expectations This PR: - updates `polonius-engine` to version 0.12.1 to fix some move errors false positives - fixes a fact generation mistake creating the other move errors false positives - updates the test expectations for the polonius compare-mode so that all (minus the 2 OOMs) ui tests pass again (matching the [analysis doc](https://hackmd.io/CjYB0fs4Q9CweyeTdKWyEg?view) starting at case 34) In my opinion, this is safe to rollup. r? @nikomatsakis
2020-03-30bless output of ui test ↵Remy Rakic-3/+3
closures/closure-expected-type/expect-region-supply-region.rs trivial diagnostics grammar change
2020-03-29Tweak `suggest_constraining_type_param`Esteban Küber-13/+10
Some of the bound restriction structured suggestions were incorrect while others had subpar output.
2020-03-23Evaluate repeat expression lengths as late as possibleOliver Scherer-2/+11
2020-02-11Auto merge of #68929 - matprec:consistent-issue-references, r=Dylan-DPCbors-1/+1
Make issue references consistent Fixes https://github.com/rust-lang/rust/issues/62976 cc https://github.com/rust-lang/rust/pull/63008 r? @varkor because you reviewed the original pr
2020-02-09--bless --compare-mode=nllMatthias Prechtl-1/+1
2020-02-09Improve reporting errors and suggestions for trait boundsPatryk Wychowaniec-8/+16