about summary refs log tree commit diff
path: root/src/test/ui/closures
AgeCommit message (Collapse)AuthorLines
2021-10-04Rollup merge of #89504 - Aaron1011:rpit-nll-static, r=nikomatsakisManish Goregaokar-2/+0
Don't suggest replacing region with 'static in NLL Fixes #73159 This is similar to #69350 - if the user didn't initially write out a 'static lifetime, adding 'static in response to a lifetime error is usually the wrong thing to do.
2021-10-04Stabilize try_reserveKornel-1/+0
2021-10-03Don't suggest replacing region with 'static in NLLAaron Hill-2/+0
Fixes #73159 This is similar to #69350 - if the user didn't initially write out a 'static lifetime, adding 'static in response to a lifetime error is usually the wrong thing to do.
2021-09-30Auto merge of #89282 - sexxi-goose:fix-88118, r=nikomatsakisbors-0/+36
2229: Consume IfLet expr When using the IfLet guard feature, we can ICE when attempting to resolve PlaceBuilders. For pattern matching, we currently don't consume the IfLet expression when "visiting" the arms leading us to not "read" all variables and hence not being able to resolve them. r? `@nikomatsakis` Closes https://github.com/rust-lang/rust/issues/88118
2021-09-26Fix testRoxane-9/+5
2021-09-262229: Consume IfLet exprRoxane-0/+40
2021-09-26Auto merge of #89144 - sexxi-goose:insig_stdlib, r=nikomatsakisbors-527/+240
2229: Mark insignificant dtor in stdlib I looked at all public [stdlib Drop implementations](https://doc.rust-lang.org/stable/std/ops/trait.Drop.html#implementors) and categorized them into Insigificant/Maybe/Significant Drop. Reasons are noted here: https://docs.google.com/spreadsheets/d/19edb9r5lo2UqMrCOVjV0fwcSdS-R7qvKNL76q7tO8VA/edit#gid=1838773501 One thing missing from this PR is tagging HashMap as insigificant destructor as that needs some discussion. r? `@Mark-Simulacrum` cc `@nikomatsakis`
2021-09-26Remove box syntax from most places in src/test outside of the issues direst31-2/+2
2021-09-24Update and add more testsWesley Wiser-65/+118
2021-09-23Fix tidy and respond to some feedbackWesley Wiser-2/+2
2021-09-23Drop fully captured upvars in the same order as the regular drop codeWesley Wiser-17/+17
Currently, with the new 2021 edition, if a closure captures all of the fields of an upvar, we'll drop those fields in the order they are used within the closure instead of the normal drop order (the definition order of the fields in the type). This changes that so we sort the captured fields by the definition order which causes them to drop in that same order as well. Fixes https://github.com/rust-lang/project-rfc-2229/issues/42
2021-09-23Add tests to verify the drop order of fields in fully captured upvarsWesley Wiser-0/+360
2021-09-22PR fixupAman Arora-46/+61
2021-09-21Handle type params in insig dtorsAman Arora-17/+45
2021-09-21Update testsAman Arora-559/+229
2021-09-17Rollup merge of #88883 - c410-f3r:tests, r=petrochenkovYuki Okushi-0/+74
Move some tests to more reasonable directories - 7 cc #73494 r? ``@petrochenkov``
2021-09-16Point at call span that introduced obligation for the argEsteban Kuber-2/+6
2021-09-15Move some tests to more reasonable directoriesCaio-0/+74
2021-09-09Ignore automatically derived impls of `Clone` and `Debug` in dead code analysisFabian Wolff-10/+15
2021-09-08Auto merge of #88477 - sexxi-goose:issue-88476, r=nikomatsakisbors-0/+206
2229: Don't move out of drop type Fixes #88476 r? `@nikomatsakis`
2021-09-032229: Don't move out of drop typeAman Arora-0/+206
2021-08-31Add test for closure migration where body is a block fragment.Mara Bos-0/+86
2021-08-31Auto merge of #88467 - sexxi-goose:issue-88431, r=nikomatsakisbors-33/+69
2229: Drop any deref in move closure Fixes: #88431 r? `@nikomatsakis`
2021-08-30Auto merge of #88466 - sexxi-goose:issue-88372, r=nikomatsakisbors-0/+19
2229: Handle update to capture kind properly Fixes: #88372 r? `@nikomatsakis`
2021-08-292229: Drop any deref in move closureAman Arora-33/+69
2021-08-292229: Handle update to capture kind properlyAman Arora-0/+19
2021-08-28Move match tests in match folderRoxane-35/+38
2021-08-28Create a specific match folder for match testsRoxane-0/+0
2021-08-28Add additional match test caseRoxane-0/+51
2021-08-28Handle match with non axhaustive variants in closuresRoxane-0/+114
2021-08-28Auto merge of #88390 - sexxi-goose:missing-case, r=nikomatsakisbors-0/+60
Add missing const edge case We don't "process" const so we need to check for additional cases when the PatKind is a Path. We need to make sure that if there is only one variant that there is no field. If there is one or more field, we will want to borrow the match scrutinee Closes https://github.com/rust-lang/rust/issues/88331 r? `@nikomatsakis`
2021-08-27Add missing const edge caseRoxane-0/+60
2021-08-25Auto merge of #85499 - jackh726:assoc-type-norm-rebase, r=nikomatsakisbors-34/+2
Normalize projections under binders Fixes #70243 Fixes #70120 Fixes #62529 Fixes #87219 Issues to followup on after (probably fixed, but no test added here): #76956 #56556 #79207 #85636 r? `@nikomatsakis`
2021-08-24Normalize associated types with bound varsJack Huey-34/+2
2021-08-24Auto merge of #88271 - sexxi-goose:liveness, r=nikomatsakisbors-33/+4
2229: Consider varaiables mentioned in closure as used Fixes: https://github.com/rust-lang/project-rfc-2229/issues/57 r? `@nikomatsakis`
2021-08-24Auto merge of #88266 - nikomatsakis:issue-87879, r=jackh726bors-0/+34
resolve type variables after checking casts r? `@jackh726` Fixes #87814 Fixes #88118 Supercedes #87879 (cc `@ldm0)`
2021-08-232229: Consider varaiables mentioned in closure as usedAman Arora-33/+4
2021-08-23fix testNiko Matsakis-0/+1
2021-08-23Auto merge of #88265 - m-ou-se:rollup-soymv20, r=m-ou-sebors-2/+2
Rollup of 6 pull requests Successful merges: - #87976 (Account for tabs when highlighting multiline code suggestions) - #88174 (Clarify some wording in Rust 2021 lint docs) - #88188 (Greatly improve limitation handling on parallel rustdoc GUI test run) - #88230 (Fix typos “a”→“an”) - #88232 (Add notes to macro-not-found diagnostics to point out how things with the same name were not a match.) - #88259 (Do not mark `-Z thir-unsafeck` as unsound anymore) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-08-23add trailing newlineNiko Matsakis-1/+1
2021-08-23select obligations after `check_casts`liudingming-0/+33
Otherwise, we can get into a situation where you have a subtype obligation `#1 <: #2` pending, #1 is constrained by `check_casts`, but #2` is unaffected. Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2021-08-23Rollup merge of #88230 - steffahn:a_an, r=oli-obkMara Bos-2/+2
Fix typos “a”→“an” Fix typos in comments; found using a regex to find some easy instance of incorrect usage of a vs. an. While automation was used to find these, every change was checked manually. Changes in submodules get separate PRs: * https://github.com/rust-lang/stdarch/pull/1201 * https://github.com/rust-lang/cargo/pull/9821 * https://github.com/rust-lang/miri/pull/1874 * https://github.com/rust-lang/rls/pull/1746 * https://github.com/rust-analyzer/rust-analyzer/pull/9984 _folks @ rust-analyzer are fast at merging…_ * https://github.com/rust-analyzer/rust-analyzer/pull/9985 * https://github.com/rust-analyzer/rust-analyzer/pull/9987 * https://github.com/rust-analyzer/rust-analyzer/pull/9989 _For `clippy`, I don’t know if the changes should better better be moved to a PR to the original repo._ <hr> This has some overlap with #88226, but neither is a strict superset of the other. If you want multiple commits, I can split it up; in that case, make sure to suggest a criterion for splitting.
2021-08-23Auto merge of #87676 - sexxi-goose:truncate_unique, r=nikomatsakisbors-16/+16
2229: Handle MutBorrow/UniqueImmBorrow better We only want to use UniqueImmBorrow when the capture place is truncated and we drop Deref of a MutRef. r? `@nikomatsakis` Fixes: https://github.com/rust-lang/project-rfc-2229/issues/56
2021-08-22Fix typos “a”→“an”Frank Steffahn-2/+2
2021-08-21Improve error reporting for closure return type mismatchesFabian Wolff-0/+50
2021-08-20Auto merge of #88039 - sexxi-goose:fix-87987, r=nikomatsakisbors-0/+54
RFC2229 Only compute place if upvars can be resolved Closes https://github.com/rust-lang/rust/issues/87987 This PR fixes an ICE when trying to unwrap an Err. This error appears when trying to convert a PlaceBuilder into Place when upvars can't yet be resolved. We should only try to convert a PlaceBuilder into Place if upvars can be resolved. r? `@nikomatsakis`
2021-08-19Auto merge of #87996 - sexxi-goose:fix-87988, r=nikomatsakisbors-0/+63
RFC2229 Add missing edge case Closes https://github.com/rust-lang/rust/issues/87988 This PR fixes an ICE where a match discriminant is not being read when expected. This ICE was the result of a missing edge case which assumed that if a pattern is of type `PatKind::TupleStruct(..) | PatKind::Path(..) | PatKind::Struct(..) | PatKind::Tuple(..)` then a place could only be a multi variant if the place is of type kind Adt.
2021-08-18Auto merge of #87738 - lqd:polonius-master, r=nikomatsakisbors-24/+5
Update `polonius-engine` to 0.13.0 This PR updates the use of `polonius-engine` to the recently released 0.13.0: - this version renamed a lot of relations to match the current terminology - "illegal subset relationships errors" (AKA "subset errors" or "universal region errors" in rustc parlance) have been implemented in all variants, and therefore the `Hybrid` variant can be the rustc default once again - some of the blessed expectations were updated: new tests have been added since the last time I updated the tests, diagnostics have changed, etc. In particular: - a few tests had trivial expectations changes such as basic diagnostics changes for the migrate-mode and full NLLs - others were recursion and lengths limits which emits a file, and under the polonius compare-mode, the folder has a different name - a few tests were ignored in the NLL compare-mode for reasons that obviously also apply to Polonius - some diagnostics were unified so that older expectations no longer made sense: the NLL and Polonius outputs were identical. - in a few cases Polonius gets a chance to emit more errors than NLLs A few tests in the compare-mode still are super slow and trigger the 60s warning, or OOM rustc during fact generation, and I've detailed these [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/186049-t-compiler.2Fwg-polonius/topic/Challenges.20for.20move.2Finit.2C.20liveness.2C.20and.20.60Location.3A.3AAll.60): - `src/test/ui/numbers-arithmetic/saturating-float-casts.rs` -> OOM during rustc fact generation - `src/test/ui/numbers-arithmetic/num-wrapping.rs` - `src/test/ui/issues/issue-72933-match-stack-overflow.rs` - `src/test/ui/issues/issue-74564-if-expr-stack-overflow.rs` - `src/test/ui/repr/repr-no-niche.rs` In addition, 2 tests don't currently pass and I didn't want to bless them now: they deal with HRTBs and miss errors that NLLs emit. We're currently trying to see if we need chalk to deal with HRTB errors (as we thought we would have to) but during the recent sprint, we discovered that we may be able to detect some of these errors in a way that resembles subset errors: - `ui/hrtb/hrtb-just-for-static.rs` -> 3 errors in NLL, 2 in polonius: a missing error about HRTB + needing to outlive 'static - `ui/issues/issue-26217.rs` -> missing HRTB that makes the test compile instead of emitting an error We'll keep talking about this at the next sprint as well. cc `@rust-lang/wg-polonius` r? `@nikomatsakis`
2021-08-17Auto merge of #87668 - estebank:tweak-bound-output, r=oli-obkbors-16/+20
Use note for pointing at bound introducing requirement Modify output for pointing where a trait bound obligation is introduced in an E0277 from using a span label to using a note in order to always preserve order of the output: Before: ``` error[E0277]: `<<Self as Case1>::A as Iterator>::Item` doesn't implement `Debug` --> $DIR/bounds-on-assoc-in-trait.rs:18:28 | LL | type A: Iterator<Item: Debug>; | ^^^^^ `<<Self as Case1>::A as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug` | ::: $SRC_DIR/core/src/fmt/mod.rs:LL:COL | LL | pub trait Debug { | --------------- required by this bound in `Debug` | = help: the trait `Debug` is not implemented for `<<Self as Case1>::A as Iterator>::Item` ``` After: ``` error[E0277]: `<<Self as Case1>::A as Iterator>::Item` doesn't implement `Debug` --> $DIR/bounds-on-assoc-in-trait.rs:18:28 | LL | type A: Iterator<Item: Debug>; | ^^^^^ `<<Self as Case1>::A as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = help: the trait `Debug` is not implemented for `<<Self as Case1>::A as Iterator>::Item` note: required by a bound in `Debug` --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL | LL | pub trait Debug { | ^^^^^^^^^^^^^^^ required by this bound in `Debug` ```
2021-08-16Use note to point at bound introducing requirementEsteban Küber-16/+20